Skip to content

Commit

Permalink
Merge pull request #4640 from thewtex/label-geometry-format
Browse files Browse the repository at this point in the history
STYLE: Apply clang-format to LabelGeometryImageFilter
  • Loading branch information
thewtex authored May 2, 2024
2 parents 0ffa6d5 + ef99075 commit 0ea4ae9
Showing 1 changed file with 40 additions and 89 deletions.
129 changes: 40 additions & 89 deletions Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ namespace itk
* \endsphinx
*/
template <typename TLabelImage, typename TIntensityImage = TLabelImage>
class ITK_TEMPLATE_EXPORT
[[deprecated("This class contains known computational bugs. See class documentation for details.")]]
LabelGeometryImageFilter : public ImageToImageFilter<TLabelImage, TIntensityImage>
class ITK_TEMPLATE_EXPORT [[deprecated(
"This class contains known computational bugs. See class documentation for details.")]] LabelGeometryImageFilter
: public ImageToImageFilter<TLabelImage, TIntensityImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(LabelGeometryImageFilter);
Expand Down Expand Up @@ -254,8 +254,7 @@ class ITK_TEMPLATE_EXPORT
// Macros for enabling the calculation of additional features.
itkGetMacro(CalculatePixelIndices, bool);
itkBooleanMacro(CalculatePixelIndices);
void
SetCalculatePixelIndices(const bool value)
void SetCalculatePixelIndices(const bool value)
{
// CalculateOrientedBoundingBox, CalculateOrientedLabelImage, and
// CalculateOrientedIntensityImage all need CalculatePixelIndices to be
Expand All @@ -281,8 +280,7 @@ class ITK_TEMPLATE_EXPORT

itkGetMacro(CalculateOrientedBoundingBox, bool);
itkBooleanMacro(CalculateOrientedBoundingBox);
void
SetCalculateOrientedBoundingBox(const bool value)
void SetCalculateOrientedBoundingBox(const bool value)
{
if (this->m_CalculateOrientedBoundingBox != value)
{
Expand All @@ -300,8 +298,7 @@ class ITK_TEMPLATE_EXPORT

itkGetMacro(CalculateOrientedLabelRegions, bool);
itkBooleanMacro(CalculateOrientedLabelRegions);
void
SetCalculateOrientedLabelRegions(const bool value)
void SetCalculateOrientedLabelRegions(const bool value)
{
if (this->m_CalculateOrientedLabelRegions != value)
{
Expand All @@ -319,8 +316,7 @@ class ITK_TEMPLATE_EXPORT

itkGetMacro(CalculateOrientedIntensityRegions, bool);
itkBooleanMacro(CalculateOrientedIntensityRegions);
void
SetCalculateOrientedIntensityRegions(const bool value)
void SetCalculateOrientedIntensityRegions(const bool value)
{
if (this->m_CalculateOrientedIntensityRegions != value)
{
Expand All @@ -337,156 +333,114 @@ class ITK_TEMPLATE_EXPORT
}

/** Set the intensity image */
void
SetIntensityInput(const TIntensityImage * input)
void SetIntensityInput(const TIntensityImage * input)
{
// Process object is not const-correct so the const casting is required.
this->SetNthInput(1, const_cast<TIntensityImage *>(input));
}

/** Get the label image */
const TIntensityImage *
GetIntensityInput() const
const TIntensityImage * GetIntensityInput() const
{
return static_cast<TIntensityImage *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
}

/** Does the specified label exist? Can only be called after
* a call to Update(). */
bool
HasLabel(LabelPixelType label) const
{
return m_LabelGeometryMapper.find(label) != m_LabelGeometryMapper.end();
}
bool HasLabel(LabelPixelType label) const { return m_LabelGeometryMapper.find(label) != m_LabelGeometryMapper.end(); }

/** Get the number of labels used */
SizeValueType
GetNumberOfObjects() const
{
return m_LabelGeometryMapper.size();
}
SizeValueType GetNumberOfObjects() const { return m_LabelGeometryMapper.size(); }

SizeValueType
GetNumberOfLabels() const
{
return this->GetNumberOfObjects();
}
SizeValueType GetNumberOfLabels() const { return this->GetNumberOfObjects(); }

/** Get the labels that are in the image. */
std::vector<LabelPixelType>
GetLabels() const
{
return m_AllLabels;
}
std::vector<LabelPixelType> GetLabels() const { return m_AllLabels; }

/** Return the all pixel indices for a label. */
LabelIndicesType
GetPixelIndices(LabelPixelType label) const;
LabelIndicesType GetPixelIndices(LabelPixelType label) const;

/** Return the number of pixels for a label. This is the same as
* the volume and the zero order moment */
SizeValueType
GetVolume(LabelPixelType label) const;
SizeValueType GetVolume(LabelPixelType label) const;

/** Return the computed integrated pixel intensity for a label. */
RealType
GetIntegratedIntensity(LabelPixelType label) const;
RealType GetIntegratedIntensity(LabelPixelType label) const;

/** Return the unweighted centroid for a label. */
LabelPointType
GetCentroid(LabelPixelType label) const;
LabelPointType GetCentroid(LabelPixelType label) const;

/** Return the weighted centroid for a label. */
LabelPointType
GetWeightedCentroid(LabelPixelType label) const;
LabelPointType GetWeightedCentroid(LabelPixelType label) const;

/** Return the eigenvalues as a vector. */
VectorType
GetEigenvalues(LabelPixelType label) const;
VectorType GetEigenvalues(LabelPixelType label) const;

/** Return the eigenvectors as a matrix. */
MatrixType
GetEigenvectors(LabelPixelType label) const;
MatrixType GetEigenvectors(LabelPixelType label) const;

/** Return the axes length for a label. */
AxesLengthType
GetAxesLength(LabelPixelType label) const;
AxesLengthType GetAxesLength(LabelPixelType label) const;

/** Return the minor axis length for a label. This is a convenience
* class that returns the shortest length from GetAxesLength. */
RealType
GetMinorAxisLength(LabelPixelType label) const;
RealType GetMinorAxisLength(LabelPixelType label) const;

/** Return the major axis length for a label. This is a convenience
* class that returns the longest length from GetAxesLength. */
RealType
GetMajorAxisLength(LabelPixelType label) const;
RealType GetMajorAxisLength(LabelPixelType label) const;

/** Return the eccentricity for a label. */
RealType
GetEccentricity(LabelPixelType label) const;
RealType GetEccentricity(LabelPixelType label) const;

/** Return the elongation for a label. This is defined as the
* length of the major axis divided by the length of the minor axis. */
RealType
GetElongation(LabelPixelType label) const;
RealType GetElongation(LabelPixelType label) const;

/** Return the orientation for a label defined in radians. */
RealType
GetOrientation(LabelPixelType label) const;
RealType GetOrientation(LabelPixelType label) const;

/** Return the computed bounding box for a label.
* This is organized in min/max pairs as [min(X), max(X), min(Y),
* max(Y), min(Z), max(Z),...] */
BoundingBoxType
GetBoundingBox(LabelPixelType label) const;
BoundingBoxType GetBoundingBox(LabelPixelType label) const;

/** Return the volume of the bounding box. */
RealType
GetBoundingBoxVolume(LabelPixelType label) const;
RealType GetBoundingBoxVolume(LabelPixelType label) const;

/** Return the size of the bounding box. */
LabelSizeType
GetBoundingBoxSize(LabelPixelType label) const;
LabelSizeType GetBoundingBoxSize(LabelPixelType label) const;

/** Return the oriented bounding box vertices. The order of the
* vertices corresponds with binary counting, where min is zero and
* max is one. For example, in 2D, binary counting will give
* [0,0],[0,1],[1,0],[1,1], which corresponds to
* [minX,minY],[minX,maxY],[maxX,minY],[maxX,maxY]. Each
* vertex is defined as an ND point. */
BoundingBoxVerticesType
GetOrientedBoundingBoxVertices(LabelPixelType label) const;
BoundingBoxVerticesType GetOrientedBoundingBoxVertices(LabelPixelType label) const;

/** Return the volume of the oriented bounding box. */
RealType
GetOrientedBoundingBoxVolume(LabelPixelType label) const;
RealType GetOrientedBoundingBoxVolume(LabelPixelType label) const;

/** Return the size of the oriented bounding box. */
LabelPointType
GetOrientedBoundingBoxSize(LabelPixelType label) const;
LabelPointType GetOrientedBoundingBoxSize(LabelPixelType label) const;

/** Return the origin of the oriented bounding box. */
LabelPointType
GetOrientedBoundingBoxOrigin(LabelPixelType label) const;
LabelPointType GetOrientedBoundingBoxOrigin(LabelPixelType label) const;

/** Return the rotation matrix defined by the
* eigenvalues/eigenvectors. */
MatrixType
GetRotationMatrix(LabelPixelType label) const;
MatrixType GetRotationMatrix(LabelPixelType label) const;

/** Return the region defined by the bounding box. */
RegionType
GetRegion(LabelPixelType label) const;
RegionType GetRegion(LabelPixelType label) const;

/** Return the label region defined by the oriented bounding box. */
TLabelImage *
GetOrientedLabelImage(LabelPixelType label) const;
TLabelImage * GetOrientedLabelImage(LabelPixelType label) const;

/** Return the intensity region defined by the oriented bounding
* box. */
TIntensityImage *
GetOrientedIntensityImage(LabelPixelType label) const;
TIntensityImage * GetOrientedIntensityImage(LabelPixelType label) const;

#ifdef ITK_USE_CONCEPT_CHECKING
// Begin concept checking
Expand All @@ -497,15 +451,12 @@ class ITK_TEMPLATE_EXPORT
protected:
LabelGeometryImageFilter();
~LabelGeometryImageFilter() override = default;
void
PrintSelf(std::ostream & os, Indent indent) const override;
void PrintSelf(std::ostream & os, Indent indent) const override;

void
GenerateData() override;
void GenerateData() override;

private:
bool
CalculateOrientedBoundingBoxVertices(vnl_symmetric_eigensystem<double> eig, LabelGeometry & m_LabelGeometry);
bool CalculateOrientedBoundingBoxVertices(vnl_symmetric_eigensystem<double> eig, LabelGeometry & m_LabelGeometry);

bool m_CalculatePixelIndices{};
bool m_CalculateOrientedBoundingBox{};
Expand Down

0 comments on commit 0ea4ae9

Please sign in to comment.