ITK  6.0.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  * https://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 : public ImageToImageFilter<TInputImage, TInputImage>
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_MOVE(StatisticsRelabelImageFilter);
49 
55 
57  using InputImageType = TInputImage;
58  using OutputImageType = TInputImage;
62  using InputImagePixelType = typename InputImageType::PixelType;
66  using OutputImagePixelType = typename OutputImageType::PixelType;
67 
68  using FeatureImageType = TFeatureImage;
71  using FeatureImagePixelType = typename FeatureImageType::PixelType;
72 
74  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
75  static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
76  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
77 
82  using AttributeType = typename LabelObjectType::AttributeType;
85 
87  itkNewMacro(Self);
88 
90  itkOverrideGetNameOfClassMacro(StatisticsRelabelImageFilter);
91 
92 #ifdef ITK_USE_CONCEPT_CHECKING
93  // Begin concept checking
97  // End concept checking
98 #endif
99 
104  itkSetMacro(BackgroundValue, OutputImagePixelType);
105  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
113  itkGetConstMacro(ReverseOrdering, bool);
114  itkSetMacro(ReverseOrdering, bool);
115  itkBooleanMacro(ReverseOrdering);
121  itkGetConstMacro(Attribute, AttributeType);
122  itkSetMacro(Attribute, AttributeType);
123  void
124  SetAttribute(const std::string & s)
125  {
126  this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
127  }
131  void
132  SetFeatureImage(TFeatureImage * input)
133  {
134  // Process object is not const-correct so the const casting is required.
135  this->SetNthInput(1, const_cast<TFeatureImage *>(input));
136  }
137 
139  FeatureImageType *
141  {
142  return static_cast<FeatureImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
143  }
144 
146  void
148  {
149  this->SetInput(input);
150  }
151 
153  void
155  {
156  this->SetFeatureImage(input);
157  }
158 
159 protected:
161  ~StatisticsRelabelImageFilter() override = default;
162  void
163  PrintSelf(std::ostream & os, Indent indent) const override;
164 
168  void
169  GenerateInputRequestedRegion() override;
170 
172  void
173  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
174 
177  void
178  GenerateData() override;
179 
180 private:
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
itkLabelImageToLabelMapFilter.h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::StatisticsRelabelImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkStatisticsRelabelImageFilter.h:61
itk::StatisticsRelabelImageFilter
relabel objects according to their shape attributes
Definition: itkStatisticsRelabelImageFilter.h:45
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::StatisticsRelabelImageFilter::SetInput1
void SetInput1(InputImageType *input)
Definition: itkStatisticsRelabelImageFilter.h:147
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:638
itk::StatisticsRelabelImageFilter::AttributeType
typename LabelObjectType::AttributeType AttributeType
Definition: itkStatisticsRelabelImageFilter.h:82
itk::StatisticsRelabelImageFilter::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkStatisticsRelabelImageFilter.h:65
itk::StatisticsLabelMapFilter
The valuator class for the StatisticsLabelObject.
Definition: itkStatisticsLabelMapFilter.h:41
itk::StatisticsRelabelImageFilter::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkStatisticsRelabelImageFilter.h:66
itkStatisticsLabelMapFilter.h
itk::LabelImageToLabelMapFilter
convert a labeled image to a label collection image
Definition: itkLabelImageToLabelMapFilter.h:49
itk::StatisticsRelabelImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkStatisticsRelabelImageFilter.h:62
itk::StatisticsRelabelImageFilter::FeatureImagePointer
typename FeatureImageType::Pointer FeatureImagePointer
Definition: itkStatisticsRelabelImageFilter.h:69
itk::StatisticsRelabelImageFilter::SetFeatureImage
void SetFeatureImage(TFeatureImage *input)
Definition: itkStatisticsRelabelImageFilter.h:132
itk::StatisticsRelabelImageFilter::InputImageType
TInputImage InputImageType
Definition: itkStatisticsRelabelImageFilter.h:57
itk::StatisticsLabelObject
A Label object to store the common attributes related to the statistics of the object.
Definition: itkStatisticsLabelObject.h:41
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::StatisticsRelabelImageFilter::SetInput2
void SetInput2(FeatureImageType *input)
Definition: itkStatisticsRelabelImageFilter.h:154
itk::StatisticsRelabelImageFilter::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkStatisticsRelabelImageFilter.h:63
itk::StatisticsRelabelImageFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkStatisticsRelabelImageFilter.h:64
itk::LabelMap
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
itk::StatisticsRelabelImageFilter::FeatureImagePixelType
typename FeatureImageType::PixelType FeatureImagePixelType
Definition: itkStatisticsRelabelImageFilter.h:71
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkStatisticsRelabelLabelMapFilter.h
itk::StatisticsRelabelImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkStatisticsRelabelImageFilter.h:59
itk::StatisticsRelabelLabelMapFilter
relabel objects according to their shape attributes
Definition: itkStatisticsRelabelLabelMapFilter.h:44
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::StatisticsRelabelImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkStatisticsRelabelImageFilter.h:60
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::LabelMapToLabelImageFilter
Converts a LabelMap to a labeled image.
Definition: itkLabelMapToLabelImageFilter.h:46
itk::StatisticsRelabelImageFilter::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkStatisticsRelabelImageFilter.h:70
itkLabelMapToLabelImageFilter.h
itk::StatisticsRelabelImageFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkStatisticsRelabelImageFilter.h:68
itk::StatisticsRelabelImageFilter::OutputImageType
TInputImage OutputImageType
Definition: itkStatisticsRelabelImageFilter.h:58
itk::StatisticsRelabelImageFilter::GetFeatureImage
FeatureImageType * GetFeatureImage()
Definition: itkStatisticsRelabelImageFilter.h:140
itk::StatisticsRelabelImageFilter::SetAttribute
void SetAttribute(const std::string &s)
Definition: itkStatisticsRelabelImageFilter.h:124
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:306
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293