ITK  4.3.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<class TImage, class 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 
83 /* itkConceptMacro(InputEqualityComparableCheck,
84  (Concept::EqualityComparable<InputImagePixelType>));
85  itkConceptMacro(IntConvertibleToInputCheck,
86  (Concept::Convertible<int, InputImagePixelType>));
87  itkConceptMacro(InputOStreamWritableCheck,
88  (Concept::OStreamWritable<InputImagePixelType>));*/
89 
91 #endif
92 
98  itkSetMacro( ReverseOrdering, bool );
99  itkGetConstReferenceMacro( ReverseOrdering, bool );
100  itkBooleanMacro( ReverseOrdering );
102 
103 protected:
106 
107  void GenerateData();
108 
109  void PrintSelf(std::ostream& os, Indent indent) const;
110 
112 
113 private:
114  AttributeUniqueLabelMapFilter(const Self&); //purposely not implemented
115  void operator=(const Self&); //purposely not implemented
116 
118  {
119  typedef typename LabelObjectType::LineType LineType;
120 
122  {
123  this->line = l;
124  this->labelObject = lo;
125  }
128  };
129 
131  {
132  public:
133  bool operator()( const LineOfLabelObject & lla, const LineOfLabelObject & llb )
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
159