Orfeo Toolbox  4.0
itkRelabelComponentImageFilter.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 __itkRelabelComponentImageFilter_h
19 #define __itkRelabelComponentImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
22 #include "itkImage.h"
23 #include <vector>
24 
25 namespace itk
26 {
78 template< typename TInputImage, typename TOutputImage >
80  public InPlaceImageFilter< TInputImage, TOutputImage >
81 {
82 public:
88 
93 
98  typedef typename TOutputImage::PixelType OutputPixelType;
99  typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
100  typedef typename TInputImage::PixelType InputPixelType;
101  typedef typename TInputImage::InternalPixelType InputInternalPixelType;
102  itkStaticConstMacro(ImageDimension, unsigned int,
103  TOutputImage::ImageDimension);
104  itkStaticConstMacro(InputImageDimension, unsigned int,
105  TInputImage::ImageDimension);
106 
110  typedef TInputImage InputImageType;
111  typedef TOutputImage OutputImageType;
112  typedef typename TInputImage::IndexType IndexType;
113  typedef typename TInputImage::SizeType SizeType;
114  typedef typename TOutputImage::RegionType RegionType;
115 
121 
126 
130  itkNewMacro(Self);
131 
133  typedef IdentifierType LabelType;
134 
137 
140  itkGetConstMacro(NumberOfObjects, LabelType);
141 
142  typedef std::vector< ObjectSizeType > ObjectSizeInPixelsContainerType;
143  typedef std::vector< float > ObjectSizeInPhysicalUnitsContainerType;
144 
150  itkGetConstMacro(OriginalNumberOfObjects, LabelType);
151 
154  itkSetMacro(NumberOfObjectsToPrint, LabelType);
155  itkGetConstReferenceMacro(NumberOfObjectsToPrint, LabelType);
156 
163  itkSetMacro(MinimumObjectSize, ObjectSizeType);
164 
170  itkGetConstMacro(MinimumObjectSize, ObjectSizeType);
171 
178  {
179  // The GetConstReferenceMacro can't be used here becase this container
180  // doesn't have an ostream<< operator overloaded.
181  return this->m_SizeOfObjectsInPixels;
182  }
183 
190  {
191  // The GetConstReferenceMacro can't be used here becase this container
192  // doesn't have an ostream<< operator overloaded.
193  return this->m_SizeOfObjectsInPhysicalUnits;
194  }
195 
200  {
201  if ( obj > 0 && obj <= m_NumberOfObjects )
202  {
203  return m_SizeOfObjectsInPixels[obj - 1];
204  }
205  else
206  {
207  return 0;
208  }
209  }
210 
215  {
216  if ( obj > 0 && obj <= m_NumberOfObjects )
217  {
218  return m_SizeOfObjectsInPhysicalUnits[obj - 1];
219  }
220  else
221  {
222  return 0;
223  }
224  }
225 
226 #ifdef ITK_USE_CONCEPT_CHECKING
227  // Begin concept checking
228  itkConceptMacro( InputEqualityComparableCheck,
230  itkConceptMacro( UnsignedLongConvertibleToInputCheck,
232  itkConceptMacro( OutputLongConvertibleToUnsignedLongCheck,
234  itkConceptMacro( InputConvertibleToOutputCheck,
236  itkConceptMacro( SameDimensionCheck,
238  // End concept checking
239 #endif
240 
241 protected:
242 
246  { this->InPlaceOff(); }
248 
252  void GenerateData();
253 
258 
260  void PrintSelf(std::ostream & os, Indent indent) const;
261 
266  };
267 
268  // put the function objects here for sorting in descending order
270  {
271 public:
274  {
275  if ( a.m_SizeInPixels > b.m_SizeInPixels )
276  {
277  return true;
278  }
279  else if ( a.m_SizeInPixels < b.m_SizeInPixels )
280  {
281  return false;
282  }
283  // size in pixels and physical units are the same, sort based on
284  // original object number
285  else if ( a.m_ObjectNumber < b.m_ObjectNumber )
286  {
287  return true;
288  }
289  else
290  {
291  return false;
292  }
293  }
294  };
295 
296 private:
297  RelabelComponentImageFilter(const Self &); //purposely not implemented
298  void operator=(const Self &); //purposely not implemented
299 
304 
307 };
308 } // end namespace itk
309 
310 #ifndef ITK_MANUAL_INSTANTIATION
312 #endif
313 
314 #endif

Generated at Sat Mar 8 2014 15:27:40 for Orfeo Toolbox with doxygen 1.8.3.1