42 namespace imageProcessing
47 template<
typename dtype>
51 STATIC_ASSERT_ARITHMETIC(dtype);
70 centerOfMass(inCluster);
80 double row() const noexcept
92 double col() const noexcept
116 double eod() const noexcept
158 return row_ == rhs.row_ && col_ == rhs.col_ && intensity_ == rhs.intensity_ && eod_ == rhs.eod_;
173 return !(*
this == rhs);
191 return intensity_ < rhs.intensity_ ? false :
true;
205 inStream << inCentriod.
str();
213 dtype intensity_{ 0 };
225 void centerOfMass(
const Cluster<dtype>& inCluster)
227 const Shape clusterShape(inCluster.height(), inCluster.width());
228 NdArray<dtype> clusterArray(clusterShape);
229 clusterArray.zeros();
231 const uint32 rowMin = inCluster.rowMin();
232 const uint32 colMin = inCluster.colMin();
234 for (
auto& pixel : inCluster)
236 clusterArray(pixel.row - rowMin, pixel.col - colMin) = pixel.intensity;
240 row_ = rowCol.front() + rowMin;
241 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:189
double eod() const noexcept
Definition: Centroid.hpp:116
void print() const
Definition: Centroid.hpp:141
double col() const noexcept
Definition: Centroid.hpp:92
bool operator==(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:156
Centroid(const Cluster< dtype > &inCluster)
Definition: Centroid.hpp:66
friend std::ostream & operator<<(std::ostream &inStream, const Centroid< dtype > &inCentriod)
Definition: Centroid.hpp:203
bool operator!=(const Centroid< dtype > &rhs) const noexcept
Definition: Centroid.hpp:171
dtype intensity() const noexcept
Definition: Centroid.hpp:104
double row() const noexcept
Definition: Centroid.hpp:80
std::string str() const
Definition: Centroid.hpp:128
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