ITK  4.9.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 > >
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 
111 
112 private:
113  AttributeUniqueLabelMapFilter(const Self&) ITK_DELETE_FUNCTION;
114  void operator=(const Self&) ITK_DELETE_FUNCTION;
115 
117  {
118  typedef typename LabelObjectType::LineType LineType;
119 
120  LineOfLabelObject( const LineType l, LabelObjectType * lo )
121  {
122  this->line = l;
123  this->labelObject = lo;
124  }
125  LineType line;
127  };
128 
130  {
131  public:
132  bool operator()( const LineOfLabelObject & lla, const LineOfLabelObject & llb )
133  {
134  for( int i=ImageDimension-1; i>=0; i-- )
135  {
136  if( lla.line.GetIndex()[i] > llb.line.GetIndex()[i] )
137  {
138  return true;
139  }
140  else if( lla.line.GetIndex()[i] < llb.line.GetIndex()[i] )
141  {
142  return false;
143  }
144  }
145  return false;
146  }
147  };
148 
149 }; // end of class
150 
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkAttributeUniqueLabelMapFilter.hxx"
155 #endif
156 
157 #endif
Light weight base class for most itk classes.
bool operator()(const LineOfLabelObject &lla, const LineOfLabelObject &llb)
void PrintSelf(std::ostream &os, Indent indent) const override
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