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
24namespace itk
25{
46template <typename TImage,
47 typename TAttributeAccessor =
48 typename Functor::AttributeLabelObjectAccessor<typename TImage::LabelObjectType>>
49class ITK_TEMPLATE_EXPORT AttributeUniqueLabelMapFilter : public InPlaceLabelMapFilter<TImage>
50{
51public:
52 ITK_DISALLOW_COPY_AND_MOVE(AttributeUniqueLabelMapFilter);
53
59
61 using ImageType = TImage;
64 using PixelType = typename ImageType::PixelType;
66 using LabelObjectType = typename ImageType::LabelObjectType;
67
68 using AttributeAccessorType = TAttributeAccessor;
69 using AttributeValueType = typename AttributeAccessorType::AttributeValueType;
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);
103protected:
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
115private:
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
bool operator()(const LineOfLabelObject &lla, const LineOfLabelObject &llb)
Make sure that the objects are not overlapping.
void PrintSelf(std::ostream &os, Indent indent) const override
typename AttributeAccessorType::AttributeValueType AttributeValueType
typename ImageType::ConstPointer ImageConstPointer
~AttributeUniqueLabelMapFilter() override=default
typename LabelObjectType::LineType LineType
typename ImageType::LabelObjectType LabelObjectType
Base class for filters that takes an image as input and overwrites that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....