ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkAttributeRelabelLabelMapFilter.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 itkAttributeRelabelLabelMapFilter_h
19 #define itkAttributeRelabelLabelMapFilter_h
20 
23 
24 namespace itk {
42 template<typename TImage, typename TAttributeAccessor=
43  typename Functor::AttributeLabelObjectAccessor< typename TImage::LabelObjectType > >
44 class ITK_TEMPLATE_EXPORT AttributeRelabelLabelMapFilter :
45  public InPlaceLabelMapFilter<TImage>
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_ASSIGN(AttributeRelabelLabelMapFilter);
49 
55 
57  using ImageType = TImage;
58  using ImagePointer = typename ImageType::Pointer;
59  using ImageConstPointer = typename ImageType::ConstPointer;
60  using PixelType = typename ImageType::PixelType;
61  using IndexType = typename ImageType::IndexType;
62  using LabelObjectType = typename ImageType::LabelObjectType;
63 
64  using AttributeAccessorType = TAttributeAccessor;
66 
68  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(AttributeRelabelLabelMapFilter,
76 
77 #ifdef ITK_USE_CONCEPT_CHECKING
78  // Begin concept checking
79 /* itkConceptMacro(InputEqualityComparableCheck,
80  (Concept::EqualityComparable<InputImagePixelType>));
81  itkConceptMacro(IntConvertibleToInputCheck,
82  (Concept::Convertible<int, InputImagePixelType>));
83  itkConceptMacro(InputOStreamWritableCheck,
84  (Concept::OStreamWritable<InputImagePixelType>));*/
85  // End concept checking
86 #endif
87 
93  itkSetMacro( ReverseOrdering, bool );
94  itkGetConstReferenceMacro( ReverseOrdering, bool );
95  itkBooleanMacro( ReverseOrdering );
97 
98 protected:
100  ~AttributeRelabelLabelMapFilter() override = default;
101 
102  void GenerateData() override;
103 
104  void PrintSelf(std::ostream& os, Indent indent) const override;
105 
107  {
108  public:
109  bool operator()( const typename LabelObjectType::Pointer & a, const typename LabelObjectType::Pointer & b )
110  {
111  return m_Accessor( a ) < m_Accessor( b );
112  }
113  ReverseComparator(): m_Accessor() {}
114  private:
116  };
117 
119  {
120  public:
121  bool operator()( const typename LabelObjectType::Pointer & a, const typename LabelObjectType::Pointer & b )
122  {
123  return m_Accessor( a ) > m_Accessor( b );
124  }
125  Comparator(): m_Accessor() {}
126  private:
128  };
129 
130 private:
132 
133 }; // end of class
134 
135 } // end namespace itk
136 
137 #ifndef ITK_MANUAL_INSTANTIATION
138 #include "itkAttributeRelabelLabelMapFilter.hxx"
139 #endif
140 
141 #endif
Light weight base class for most itk classes.
bool operator()(const typename LabelObjectType::Pointer &a, const typename LabelObjectType::Pointer &b)
typename LabelObjectType::LabelType AttributeValueType
bool operator()(const typename LabelObjectType::Pointer &a, const typename LabelObjectType::Pointer &b)
Base class for filters that takes an image as input and overwrites that image as the output...
relabel objects according to their shape attributes
Control indentation during Print() invocation.
Definition: itkIndent.h:49