42 namespace imageProcessing
47 template<
typename dtype>
51 STATIC_ASSERT_ARITHMETIC(dtype);
70 centerOfMass(inCluster);
79 double row() const noexcept
90 double col() const noexcept
112 double eod() const noexcept
151 return row_ == rhs.row_ && col_ == rhs.col_ && intensity_ == rhs.intensity_ && eod_ == rhs.eod_;
164 return !(*
this == rhs);
180 return intensity_ < rhs.intensity_ ? false :
true;
193 inStream << inCentriod.
str();
201 dtype intensity_{ 0 };
212 void centerOfMass(
const Cluster<dtype>& inCluster)
214 const Shape clusterShape(inCluster.height(), inCluster.width());
215 NdArray<dtype> clusterArray(clusterShape);
216 clusterArray.zeros();
218 const uint32 rowMin = inCluster.rowMin();
219 const uint32 colMin = inCluster.colMin();
221 for (
auto& pixel : inCluster)
223 clusterArray(pixel.row - rowMin, pixel.col - colMin) = pixel.intensity;
227 row_ = rowCol.front() + rowMin;
228 col_ = rowCol.back() + colMin;
holds the information for a centroid
Definition: Centroid.hpp:49
bool operator<(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:178
double eod() const noexcept
Definition: Centroid.hpp:112
void print() const
Definition: Centroid.hpp:136
double col() const noexcept
Definition: Centroid.hpp:90
bool operator==(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:149
Centroid(const Cluster< dtype > &inCluster)
Definition: Centroid.hpp:66
friend std::ostream & operator<<(std::ostream &inStream, const Centroid< dtype > &inCentriod)
Definition: Centroid.hpp:191
bool operator!=(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:162
dtype intensity() const noexcept
Definition: Centroid.hpp:101
double row() const noexcept
Definition: Centroid.hpp:79
std::string str() const
Definition: Centroid.hpp:123
Holds the information for a cluster of pixels.
Definition: Cluster.hpp:54
std::string num2str(dtype inNumber)
Definition: num2str.hpp:46
Definition: Coordinate.hpp:45
NdArray< double > centerOfMass(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: centerOfMass.hpp:47
std::uint32_t uint32
Definition: Types.hpp:40