ITK  6.0.0
Insight Toolkit
itkAttributeUniqueLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkAttributeUniqueLabelMapFilter_h
19 #define itkAttributeUniqueLabelMapFilter_h
20 
23 
24 namespace itk
25 {
46 template <typename TImage,
47  typename TAttributeAccessor =
48  typename Functor::AttributeLabelObjectAccessor<typename TImage::LabelObjectType>>
49 class ITK_TEMPLATE_EXPORT AttributeUniqueLabelMapFilter : public InPlaceLabelMapFilter<TImage>
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_MOVE(AttributeUniqueLabelMapFilter);
53 
59 
61  using ImageType = TImage;
62  using ImagePointer = typename ImageType::Pointer;
64  using PixelType = typename ImageType::PixelType;
65  using IndexType = typename ImageType::IndexType;
66  using LabelObjectType = typename ImageType::LabelObjectType;
67 
68  using AttributeAccessorType = TAttributeAccessor;
70 
71  using LineType = typename LabelObjectType::LineType;
72 
74  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
75 
77  itkNewMacro(Self);
78 
80  itkOverrideGetNameOfClassMacro(AttributeUniqueLabelMapFilter);
81 
82 #ifdef ITK_USE_CONCEPT_CHECKING
83  // Begin concept checking
84  /* itkConceptMacro(InputEqualityComparableCheck,
85  (Concept::EqualityComparable<InputImagePixelType>));
86  itkConceptMacro(IntConvertibleToInputCheck,
87  (Concept::Convertible<int, InputImagePixelType>));
88  itkConceptMacro(InputOStreamWritableCheck,
89  (Concept::OStreamWritable<InputImagePixelType>));*/
90  // End concept checking
91 #endif
92 
98  itkSetMacro(ReverseOrdering, bool);
99  itkGetConstReferenceMacro(ReverseOrdering, bool);
100  itkBooleanMacro(ReverseOrdering);
103 protected:
105  ~AttributeUniqueLabelMapFilter() override = default;
106 
107  void
108  GenerateData() override;
109 
110  void
111  PrintSelf(std::ostream & os, Indent indent) const override;
112 
113  bool m_ReverseOrdering{};
114 
115 private:
117  {
118  using LineType = typename LabelObjectType::LineType;
119 
121  {
122  this->line = l;
123  this->labelObject = lo;
124  }
127  };
128 
130  {
131  public:
132  bool
134  {
135  for (int i = ImageDimension - 1; i >= 0; i--)
136  {
137  if (lla.line.GetIndex()[i] > llb.line.GetIndex()[i])
138  {
139  return true;
140  }
141  else if (lla.line.GetIndex()[i] < llb.line.GetIndex()[i])
142  {
143  return false;
144  }
145  }
146  return false;
147  }
148  };
149 
150 }; // end of class
151 
152 } // end namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 # include "itkAttributeUniqueLabelMapFilter.hxx"
156 #endif
157 
158 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::AttributeUniqueLabelMapFilter::LineOfLabelObject::LineType
typename LabelObjectType::LineType LineType
Definition: itkAttributeUniqueLabelMapFilter.h:118
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::LabelObjectType
typename ImageType::LabelObjectType LabelObjectType
Definition: itkAttributeUniqueLabelMapFilter.h:66
itk::InPlaceLabelMapFilter
Base class for filters that takes an image as input and overwrites that image as the output.
Definition: itkInPlaceLabelMapFilter.h:83
itk::AttributeUniqueLabelMapFilter
Make sure that the objects are not overlapping.
Definition: itkAttributeUniqueLabelMapFilter.h:49
itk::AttributeUniqueLabelMapFilter::LineOfLabelObject::LineOfLabelObject
LineOfLabelObject(const LineType l, LabelObjectType *lo)
Definition: itkAttributeUniqueLabelMapFilter.h:120
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkAttributeUniqueLabelMapFilter.h:63
itk::AttributeUniqueLabelMapFilter::LineOfLabelObject
Definition: itkAttributeUniqueLabelMapFilter.h:116
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImageType
TImage ImageType
Definition: itkAttributeUniqueLabelMapFilter.h:61
itk::AttributeUniqueLabelMapFilter::LineOfLabelObjectComparator
Definition: itkAttributeUniqueLabelMapFilter.h:129
itk::AttributeUniqueLabelMapFilter::LineOfLabelObjectComparator::operator()
bool operator()(const LineOfLabelObject &lla, const LineOfLabelObject &llb)
Definition: itkAttributeUniqueLabelMapFilter.h:133
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkAttributeUniqueLabelMapFilter.h:62
itk::AttributeUniqueLabelMapFilter::LineOfLabelObject::labelObject
LabelObjectType * labelObject
Definition: itkAttributeUniqueLabelMapFilter.h:126
itkAttributeLabelObject.h
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::LineType
typename LabelObjectType::LineType LineType
Definition: itkAttributeUniqueLabelMapFilter.h:71
itkInPlaceLabelMapFilter.h
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::IndexType
typename ImageType::IndexType IndexType
Definition: itkAttributeUniqueLabelMapFilter.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::AttributeUniqueLabelMapFilter::LineOfLabelObject::line
LineType line
Definition: itkAttributeUniqueLabelMapFilter.h:125
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::PixelType
typename ImageType::PixelType PixelType
Definition: itkAttributeUniqueLabelMapFilter.h:64
itk::Functor::LabelLabelObjectAccessor
Definition: itkLabelObjectAccessors.h:37
itk::AttributeUniqueLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::AttributeValueType
typename AttributeAccessorType::AttributeValueType AttributeValueType
Definition: itkAttributeUniqueLabelMapFilter.h:69
itk::Functor::LabelLabelObjectAccessor::AttributeValueType
typename LabelObjectType::LabelType AttributeValueType
Definition: itkLabelObjectAccessors.h:41