51 template<
typename dtype>
55 STATIC_ASSERT_ARITHMETIC(dtype);
60 using accumulator_t =
typename std::conditional<std::is_integral<dtype>::value,
int64,
double>::type;
75 clusterId_(inClusterId)
89 if (pixels_.size() != rhs.pixels_.size())
107 return !(*
this == rhs);
120 return pixels_[inIndex];
133 if (inIndex >= pixels_.size())
137 return pixels_[inIndex];
148 return pixels_.cbegin();
159 return pixels_.cend();
170 return static_cast<uint32>(pixels_.size());
236 return rowMax_ - rowMin_ + 1;
247 return colMax_ - colMin_ + 1;
269 return peakPixelIntensity_;
278 [[nodiscard]]
double eod() const noexcept
291 pixels_.push_back(inPixel);
302 eod_ =
static_cast<double>(peakPixelIntensity_) /
static_cast<double>(intensity_);
311 [[nodiscard]] std::string
str()
const
342 inStream << inCluster.
str();
349 int32 clusterId_{ -1 };
351 std::vector<Pixel<dtype>> pixels_{};
363 dtype peakPixelIntensity_{ 0 };
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
Holds the information for a cluster of pixels.
Definition: Cluster.hpp:53
typename std::conditional< std::is_integral< dtype >::value, int64, double >::type accumulator_t
Definition: Cluster.hpp:60
uint32 colMin() const noexcept
Definition: Cluster.hpp:212
typename std::vector< Pixel< dtype > >::const_iterator const_iterator
Definition: Cluster.hpp:59
double eod() const noexcept
Definition: Cluster.hpp:278
uint32 rowMax() const noexcept
Definition: Cluster.hpp:201
const_iterator begin() const noexcept
Definition: Cluster.hpp:146
uint32 height() const noexcept
Definition: Cluster.hpp:234
Cluster(uint32 inClusterId) noexcept
Definition: Cluster.hpp:74
bool operator==(const Cluster< dtype > &rhs) const noexcept
Definition: Cluster.hpp:87
friend std::ostream & operator<<(std::ostream &inStream, const Cluster< dtype > &inCluster)
Definition: Cluster.hpp:340
uint32 colMax() const noexcept
Definition: Cluster.hpp:223
void addPixel(const Pixel< dtype > &inPixel)
Definition: Cluster.hpp:289
bool operator!=(const Cluster< dtype > &rhs) const noexcept
Definition: Cluster.hpp:105
std::string str() const
Definition: Cluster.hpp:311
dtype peakPixelIntensity() const noexcept
Definition: Cluster.hpp:267
uint32 clusterId() const noexcept
Definition: Cluster.hpp:179
accumulator_t intensity() const noexcept
Definition: Cluster.hpp:256
uint32 rowMin() const noexcept
Definition: Cluster.hpp:190
const Pixel< dtype > & at(uint32 inIndex) const
Definition: Cluster.hpp:131
uint32 width() const noexcept
Definition: Cluster.hpp:245
uint32 size() const noexcept
Definition: Cluster.hpp:168
const Pixel< dtype > & operator[](uint32 inIndex) const noexcept
Definition: Cluster.hpp:118
const_iterator end() const noexcept
Definition: Cluster.hpp:157
void print() const
Definition: Cluster.hpp:327
Holds the information for a single pixel.
Definition: Pixel.hpp:46
dtype intensity
Definition: Pixel.hpp:55
uint32 col
Definition: Pixel.hpp:54
uint32 row
Definition: Pixel.hpp:53
std::string str() const
Definition: Pixel.hpp:136
Definition: applyThreshold.hpp:34
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:225
bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2) noexcept
Definition: StlAlgorithms.hpp:140
std::string num2str(dtype inNumber)
Definition: num2str.hpp:44
NdArray< dtype > min(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: min.hpp:44
std::int64_t int64
Definition: Types.hpp:35
std::int32_t int32
Definition: Types.hpp:36
std::uint32_t uint32
Definition: Types.hpp:40
NdArray< dtype > max(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: max.hpp:44