ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkAttributeUniqueLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 {
45 template<typename TImage, typename TAttributeAccessor=
46  typename Functor::AttributeLabelObjectAccessor< typename TImage::LabelObjectType > >
47 class ITK_TEMPLATE_EXPORT AttributeUniqueLabelMapFilter :
48  public InPlaceLabelMapFilter<TImage>
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_ASSIGN(AttributeUniqueLabelMapFilter);
52 
58 
60  using ImageType = TImage;
61  using ImagePointer = typename ImageType::Pointer;
62  using ImageConstPointer = typename ImageType::ConstPointer;
63  using PixelType = typename ImageType::PixelType;
64  using IndexType = typename ImageType::IndexType;
65  using LabelObjectType = typename ImageType::LabelObjectType;
66 
67  using AttributeAccessorType = TAttributeAccessor;
69 
70  using LineType = typename LabelObjectType::LineType;
71 
73  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
74 
76  itkNewMacro(Self);
77 
79  itkTypeMacro(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 );
102 
103 protected:
105  ~AttributeUniqueLabelMapFilter() override = default;
106 
107  void GenerateData() override;
108 
109  void PrintSelf(std::ostream& os, Indent indent) const override;
110 
112 
113 private:
115  {
116  using LineType = typename LabelObjectType::LineType;
117 
119  {
120  this->line = l;
121  this->labelObject = lo;
122  }
125  };
126 
128  {
129  public:
130  bool operator()( const LineOfLabelObject & lla, const LineOfLabelObject & llb )
131  {
132  for( int i=ImageDimension-1; i>=0; i-- )
133  {
134  if( lla.line.GetIndex()[i] > llb.line.GetIndex()[i] )
135  {
136  return true;
137  }
138  else if( lla.line.GetIndex()[i] < llb.line.GetIndex()[i] )
139  {
140  return false;
141  }
142  }
143  return false;
144  }
145  };
146 
147 }; // end of class
148 
149 } // end namespace itk
150 
151 #ifndef ITK_MANUAL_INSTANTIATION
152 #include "itkAttributeUniqueLabelMapFilter.hxx"
153 #endif
154 
155 #endif
Light weight base class for most itk classes.
bool operator()(const LineOfLabelObject &lla, const LineOfLabelObject &llb)
typename LabelObjectType::LabelType AttributeValueType
Make sure that the objects are not overlapping.
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:49