ITK  4.13.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:
56 
58  typedef TImage ImageType;
59  typedef typename ImageType::Pointer ImagePointer;
60  typedef typename ImageType::ConstPointer ImageConstPointer;
61  typedef typename ImageType::PixelType PixelType;
62  typedef typename ImageType::IndexType IndexType;
63  typedef typename ImageType::LabelObjectType LabelObjectType;
64 
65  typedef TAttributeAccessor AttributeAccessorType;
67 
68  typedef typename LabelObjectType::LineType LineType;
69 
71  itkStaticConstMacro(ImageDimension, unsigned int,
72  TImage::ImageDimension);
73 
75  itkNewMacro(Self);
76 
78  itkTypeMacro(AttributeUniqueLabelMapFilter,
80 
81 #ifdef ITK_USE_CONCEPT_CHECKING
82  // Begin concept checking
83 /* itkConceptMacro(InputEqualityComparableCheck,
84  (Concept::EqualityComparable<InputImagePixelType>));
85  itkConceptMacro(IntConvertibleToInputCheck,
86  (Concept::Convertible<int, InputImagePixelType>));
87  itkConceptMacro(InputOStreamWritableCheck,
88  (Concept::OStreamWritable<InputImagePixelType>));*/
89  // End concept checking
90 #endif
91 
97  itkSetMacro( ReverseOrdering, bool );
98  itkGetConstReferenceMacro( ReverseOrdering, bool );
99  itkBooleanMacro( ReverseOrdering );
101 
102 protected:
105 
106  void GenerateData() ITK_OVERRIDE;
107 
108  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
109 
110  bool m_ReverseOrdering;
111 
112 private:
113  ITK_DISALLOW_COPY_AND_ASSIGN(AttributeUniqueLabelMapFilter);
114 
116  {
117  typedef typename LabelObjectType::LineType LineType;
118 
119  LineOfLabelObject( const LineType l, LabelObjectType * lo )
120  {
121  this->line = l;
122  this->labelObject = lo;
123  }
124  LineType line;
126  };
127 
129  {
130  public:
131  bool operator()( const LineOfLabelObject & lla, const LineOfLabelObject & llb )
132  {
133  for( int i=ImageDimension-1; i>=0; i-- )
134  {
135  if( lla.line.GetIndex()[i] > llb.line.GetIndex()[i] )
136  {
137  return true;
138  }
139  else if( lla.line.GetIndex()[i] < llb.line.GetIndex()[i] )
140  {
141  return false;
142  }
143  }
144  return false;
145  }
146  };
147 
148 }; // end of class
149 
150 } // end namespace itk
151 
152 #ifndef ITK_MANUAL_INSTANTIATION
153 #include "itkAttributeUniqueLabelMapFilter.hxx"
154 #endif
155 
156 #endif
Light weight base class for most itk classes.
bool operator()(const LineOfLabelObject &lla, const LineOfLabelObject &llb)
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...
AttributeAccessorType::AttributeValueType AttributeValueType
Control indentation during Print() invocation.
Definition: itkIndent.h:49