ITK  5.2.0
Insight Toolkit
itkStatisticsRelabelImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
45 template <typename TInputImage, typename TFeatureImage>
46 class ITK_TEMPLATE_EXPORT StatisticsRelabelImageFilter : 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 
92 
93 #ifdef ITK_USE_CONCEPT_CHECKING
94  // Begin concept checking
98  // End concept checking
99 #endif
100 
105  itkSetMacro(BackgroundValue, OutputImagePixelType);
106  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
108 
114  itkGetConstMacro(ReverseOrdering, bool);
115  itkSetMacro(ReverseOrdering, bool);
116  itkBooleanMacro(ReverseOrdering);
118 
122  itkGetConstMacro(Attribute, AttributeType);
123  itkSetMacro(Attribute, AttributeType);
124  void
125  SetAttribute(const std::string & s)
126  {
127  this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
128  }
130 
132  void
133  SetFeatureImage(TFeatureImage * input)
134  {
135  // Process object is not const-correct so the const casting is required.
136  this->SetNthInput(1, const_cast<TFeatureImage *>(input));
137  }
138 
140  FeatureImageType *
142  {
143  return static_cast<FeatureImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
144  }
145 
147  void
149  {
150  this->SetInput(input);
151  }
152 
154  void
156  {
157  this->SetFeatureImage(input);
158  }
159 
160 protected:
162  ~StatisticsRelabelImageFilter() override = default;
163  void
164  PrintSelf(std::ostream & os, Indent indent) const override;
165 
169  void
170  GenerateInputRequestedRegion() override;
171 
173  void
174  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
175 
178  void
179  GenerateData() override;
180 
181 private:
185 }; // end of class
186 } // end namespace itk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 # include "itkStatisticsRelabelImageFilter.hxx"
190 #endif
191 
192 #endif
itkLabelImageToLabelMapFilter.h
itk::StatisticsRelabelImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkStatisticsRelabelImageFilter.h:62
itk::StatisticsRelabelImageFilter
relabel objects according to their shape attributes
Definition: itkStatisticsRelabelImageFilter.h:46
itk::StatisticsRelabelImageFilter::SetInput1
void SetInput1(InputImageType *input)
Definition: itkStatisticsRelabelImageFilter.h:148
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:634
itk::StatisticsRelabelImageFilter::AttributeType
typename LabelObjectType::AttributeType AttributeType
Definition: itkStatisticsRelabelImageFilter.h:83
itk::StatisticsRelabelImageFilter::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkStatisticsRelabelImageFilter.h:66
itk::StatisticsLabelMapFilter
The valuator class for the StatisticsLabelObject.
Definition: itkStatisticsLabelMapFilter.h:42
itk::StatisticsRelabelImageFilter::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkStatisticsRelabelImageFilter.h:67
itkStatisticsLabelMapFilter.h
itk::LabelImageToLabelMapFilter
convert a labeled image to a label collection image
Definition: itkLabelImageToLabelMapFilter.h:50
itk::StatisticsRelabelImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkStatisticsRelabelImageFilter.h:63
itk::StatisticsRelabelImageFilter::FeatureImagePointer
typename FeatureImageType::Pointer FeatureImagePointer
Definition: itkStatisticsRelabelImageFilter.h:70
itk::StatisticsRelabelImageFilter::SetFeatureImage
void SetFeatureImage(TFeatureImage *input)
Definition: itkStatisticsRelabelImageFilter.h:133
itk::StatisticsRelabelImageFilter::InputImageType
TInputImage InputImageType
Definition: itkStatisticsRelabelImageFilter.h:58
itk::StatisticsLabelObject
A Label object to store the common attributes related to the statistics of the object.
Definition: itkStatisticsLabelObject.h:42
itk::StatisticsRelabelImageFilter::m_Attribute
AttributeType m_Attribute
Definition: itkStatisticsRelabelImageFilter.h:184
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::StatisticsRelabelImageFilter::SetInput2
void SetInput2(FeatureImageType *input)
Definition: itkStatisticsRelabelImageFilter.h:155
itk::StatisticsRelabelImageFilter::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkStatisticsRelabelImageFilter.h:64
itk::StatisticsRelabelImageFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkStatisticsRelabelImageFilter.h:65
itk::LabelMap
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:71
itk::StatisticsRelabelImageFilter::FeatureImagePixelType
typename FeatureImageType::PixelType FeatureImagePixelType
Definition: itkStatisticsRelabelImageFilter.h:72
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::StatisticsRelabelImageFilter::m_ReverseOrdering
bool m_ReverseOrdering
Definition: itkStatisticsRelabelImageFilter.h:183
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkStatisticsRelabelLabelMapFilter.h
itk::StatisticsRelabelImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkStatisticsRelabelImageFilter.h:60
itk::StatisticsRelabelLabelMapFilter
relabel objects according to their shape attributes
Definition: itkStatisticsRelabelLabelMapFilter.h:46
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:64
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::StatisticsRelabelImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkStatisticsRelabelImageFilter.h:61
itk::Concept::Convertible
Definition: itkConceptChecking.h:214
itk::LabelMapToLabelImageFilter
Converts a LabelMap to a labeled image.
Definition: itkLabelMapToLabelImageFilter.h:47
itk::StatisticsLabelObject::AttributeType
typename Superclass::AttributeType AttributeType
Definition: itkStatisticsLabelObject.h:81
itk::StatisticsRelabelImageFilter::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkStatisticsRelabelImageFilter.h:71
itk::StatisticsRelabelImageFilter::m_BackgroundValue
OutputImagePixelType m_BackgroundValue
Definition: itkStatisticsRelabelImageFilter.h:182
itkLabelMapToLabelImageFilter.h
itk::StatisticsRelabelImageFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkStatisticsRelabelImageFilter.h:69
itk::StatisticsRelabelImageFilter::OutputImageType
TInputImage OutputImageType
Definition: itkStatisticsRelabelImageFilter.h:59
itk::StatisticsRelabelImageFilter::GetFeatureImage
FeatureImageType * GetFeatureImage()
Definition: itkStatisticsRelabelImageFilter.h:141
itk::StatisticsRelabelImageFilter::SetAttribute
void SetAttribute(const std::string &s)
Definition: itkStatisticsRelabelImageFilter.h:125
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:304
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293