ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkStatisticsRelabelImageFilter.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 itkStatisticsRelabelImageFilter_h
19 #define itkStatisticsRelabelImageFilter_h
20 
25 
26 namespace itk
27 {
44 template< typename TInputImage, typename TFeatureImage >
45 class ITK_TEMPLATE_EXPORT StatisticsRelabelImageFilter:
46  public ImageToImageFilter< TInputImage, TInputImage >
47 {
48 public:
54 
56  typedef TInputImage InputImageType;
57  typedef TInputImage OutputImageType;
58  typedef typename InputImageType::Pointer InputImagePointer;
59  typedef typename InputImageType::ConstPointer InputImageConstPointer;
60  typedef typename InputImageType::RegionType InputImageRegionType;
61  typedef typename InputImageType::PixelType InputImagePixelType;
62  typedef typename OutputImageType::Pointer OutputImagePointer;
63  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
64  typedef typename OutputImageType::RegionType OutputImageRegionType;
65  typedef typename OutputImageType::PixelType OutputImagePixelType;
66 
67  typedef TFeatureImage FeatureImageType;
68  typedef typename FeatureImageType::Pointer FeatureImagePointer;
69  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
70  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
71 
73  itkStaticConstMacro(InputImageDimension, unsigned int,
74  TInputImage::ImageDimension);
75  itkStaticConstMacro(OutputImageDimension, unsigned int,
76  TInputImage::ImageDimension);
77  itkStaticConstMacro(ImageDimension, unsigned int,
78  TInputImage::ImageDimension);
80 
88 
90  itkNewMacro(Self);
91 
93  itkTypeMacro(StatisticsRelabelImageFilter,
95 
96 #ifdef ITK_USE_CONCEPT_CHECKING
97  // Begin concept checking
98  itkConceptMacro( InputEqualityComparableCheck,
100  itkConceptMacro( IntConvertibleToInputCheck,
102  itkConceptMacro( InputOStreamWritableCheck,
104  // End concept checking
105 #endif
106 
111  itkSetMacro(BackgroundValue, OutputImagePixelType);
112  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
114 
120  itkGetConstMacro(ReverseOrdering, bool);
121  itkSetMacro(ReverseOrdering, bool);
122  itkBooleanMacro(ReverseOrdering);
124 
128  itkGetConstMacro(Attribute, AttributeType);
129  itkSetMacro(Attribute, AttributeType);
130  void SetAttribute(const std::string & s)
131  {
132  this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
133  }
135 
137  void SetFeatureImage(TFeatureImage *input)
138  {
139  // Process object is not const-correct so the const casting is required.
140  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
141  }
142 
145  {
146  return static_cast< FeatureImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
147  }
148 
151  {
152  this->SetInput(input);
153  }
154 
157  {
158  this->SetFeatureImage(input);
159  }
160 
161 protected:
164  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
165 
169  void GenerateInputRequestedRegion() ITK_OVERRIDE;
170 
172  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
173 
176  void GenerateData() ITK_OVERRIDE;
177 
178 private:
179  ITK_DISALLOW_COPY_AND_ASSIGN(StatisticsRelabelImageFilter);
180 
181  OutputImagePixelType m_BackgroundValue;
182  bool m_ReverseOrdering;
183  AttributeType m_Attribute;
184 }; // end of class
185 } // end namespace itk
186 
187 #ifndef ITK_MANUAL_INSTANTIATION
188 #include "itkStatisticsRelabelImageFilter.hxx"
189 #endif
190 
191 #endif
convert a labeled image to a label collection image
Light weight base class for most itk classes.
OutputImageType::ConstPointer OutputImageConstPointer
Superclass::AttributeType AttributeType
relabel objects according to their shape attributes
StatisticsLabelMapFilter< LabelMapType, TFeatureImage > LabelObjectValuatorType
FeatureImageType::ConstPointer FeatureImageConstPointer
StatisticsLabelObject< InputImagePixelType, itkGetStaticConstMacro(ImageDimension) > LabelObjectType
ImageToImageFilter< TInputImage, TInputImage > Superclass
relabel objects according to their shape attributes
A Label object to store the common attributes related to the statistics of the object.
LabelMapToLabelImageFilter< LabelMapType, OutputImageType > BinarizerType
LabelObjectType::AttributeType AttributeType
LabelImageToLabelMapFilter< InputImageType, LabelMapType > LabelizerType
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
InputImageType::ConstPointer InputImageConstPointer
The valuator class for the StatisticsLabelObject.
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
StatisticsRelabelLabelMapFilter< LabelMapType > RelabelType
Converts a LabelMap to a labeled image.