ITK  5.0.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:
49  ITK_DISALLOW_COPY_AND_ASSIGN(StatisticsRelabelImageFilter);
50 
56 
58  using InputImageType = TInputImage;
59  using OutputImageType = TInputImage;
60  using InputImagePointer = typename InputImageType::Pointer;
61  using InputImageConstPointer = typename InputImageType::ConstPointer;
63  using InputImagePixelType = typename InputImageType::PixelType;
64  using OutputImagePointer = typename OutputImageType::Pointer;
65  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
67  using OutputImagePixelType = typename OutputImageType::PixelType;
68 
69  using FeatureImageType = TFeatureImage;
70  using FeatureImagePointer = typename FeatureImageType::Pointer;
71  using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
72  using FeatureImagePixelType = typename FeatureImageType::PixelType;
73 
75  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
76  static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
77  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
78 
86 
88  itkNewMacro(Self);
89 
91  itkTypeMacro(StatisticsRelabelImageFilter,
93 
94 #ifdef ITK_USE_CONCEPT_CHECKING
95  // Begin concept checking
96  itkConceptMacro( InputEqualityComparableCheck,
98  itkConceptMacro( IntConvertibleToInputCheck,
100  itkConceptMacro( InputOStreamWritableCheck,
102  // End concept checking
103 #endif
104 
109  itkSetMacro(BackgroundValue, OutputImagePixelType);
110  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
112 
118  itkGetConstMacro(ReverseOrdering, bool);
119  itkSetMacro(ReverseOrdering, bool);
120  itkBooleanMacro(ReverseOrdering);
122 
126  itkGetConstMacro(Attribute, AttributeType);
127  itkSetMacro(Attribute, AttributeType);
128  void SetAttribute(const std::string & s)
129  {
130  this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
131  }
133 
135  void SetFeatureImage(TFeatureImage *input)
136  {
137  // Process object is not const-correct so the const casting is required.
138  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
139  }
140 
143  {
144  return static_cast< FeatureImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
145  }
146 
149  {
150  this->SetInput(input);
151  }
152 
155  {
156  this->SetFeatureImage(input);
157  }
158 
159 protected:
161  ~StatisticsRelabelImageFilter() override = default;
162  void PrintSelf(std::ostream & os, Indent indent) const override;
163 
167  void GenerateInputRequestedRegion() override;
168 
170  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) override;
171 
174  void GenerateData() override;
175 
176 private:
180 }; // end of class
181 } // end namespace itk
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 #include "itkStatisticsRelabelImageFilter.hxx"
185 #endif
186 
187 #endif
convert a labeled image to a label collection image
typename OutputImageType::RegionType OutputImageRegionType
Light weight base class for most itk classes.
typename LabelObjectType::AttributeType AttributeType
typename InputImageType::PixelType InputImagePixelType
relabel objects according to their shape attributes
typename Superclass::AttributeType AttributeType
typename InputImageType::RegionType InputImageRegionType
typename FeatureImageType::Pointer FeatureImagePointer
typename FeatureImageType::PixelType FeatureImagePixelType
typename FeatureImageType::ConstPointer FeatureImageConstPointer
relabel objects according to their shape attributes
A Label object to store the common attributes related to the statistics of the object.
typename OutputImageType::Pointer OutputImagePointer
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
typename InputImageType::ConstPointer InputImageConstPointer
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
typename InputImageType::Pointer InputImagePointer
The valuator class for the StatisticsLabelObject.
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
typename OutputImageType::ConstPointer OutputImageConstPointer
typename OutputImageType::PixelType OutputImagePixelType
Converts a LabelMap to a labeled image.