ITK  5.4.0
Insight Toolkit
itkLabelMapToBinaryImageFilter.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 itkLabelMapToBinaryImageFilter_h
19#define itkLabelMapToBinaryImageFilter_h
20
21#include "itkLabelMapFilter.h"
22
23namespace itk
24{
44template <typename TInputImage, typename TOutputImage>
45class ITK_TEMPLATE_EXPORT LabelMapToBinaryImageFilter : public LabelMapFilter<TInputImage, TOutputImage>
46{
47public:
48 ITK_DISALLOW_COPY_AND_MOVE(LabelMapToBinaryImageFilter);
49
55
57 using InputImageType = TInputImage;
58 using OutputImageType = TOutputImage;
62 using InputImagePixelType = typename InputImageType::PixelType;
63 using LabelObjectType = typename InputImageType::LabelObjectType;
64
68 using OutputImagePixelType = typename OutputImageType::PixelType;
70
72 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
73 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
74
76 itkNewMacro(Self);
77
79 itkOverrideGetNameOfClassMacro(LabelMapToBinaryImageFilter);
80
85 itkSetMacro(BackgroundValue, OutputImagePixelType);
86 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
93 itkSetMacro(ForegroundValue, OutputImagePixelType);
94 itkGetConstMacro(ForegroundValue, OutputImagePixelType);
99 void
101 {
102 // Process object is not const-correct so the const casting is required.
103 this->SetNthInput(1, const_cast<OutputImageType *>(input));
104 }
105
106 OutputImageType *
108 {
109 return static_cast<OutputImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
110 }
111
113 void
115 {
116 this->SetInput(input);
117 }
118
120 void
122 {
123 this->SetBackgroundImage(input);
124 }
125
126protected:
128 ~LabelMapToBinaryImageFilter() override = default;
129
133 void
135
137 void
138 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
139
140 void
141 GenerateData() override;
142
143 void
144 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
145
146 // part of a compile error workaround for GCC 4.8.5-28 (Red Hat) from 20150623
147 void
149 {
150 Superclass::DynamicThreadedGenerateData(outputRegion);
151 }
152
153 void
155
156 void
157 PrintSelf(std::ostream & os, Indent indent) const override;
158
159private:
160 OutputImagePixelType m_BackgroundValue{};
161 OutputImagePixelType m_ForegroundValue{};
162}; // end of class
163} // end namespace itk
164
165#ifndef ITK_MANUAL_INSTANTIATION
166# include "itkLabelMapToBinaryImageFilter.hxx"
167#endif
168
169#endif
Base class for all data objects in ITK.
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::Pointer InputImagePointer
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for filters that take an image as input and overwrite that image as the output.
typename InputImageType::LabelObjectType LabelObjectType
typename OutputImageType::ConstPointer OutputImageConstPointer
Convert a LabelMap to a binary image.
void SuperclassDynamicTGD(const OutputImageRegionType &outputRegion)
void SetInput2(const OutputImageType *input)
void GenerateInputRequestedRegion() override
void SetBackgroundImage(const OutputImageType *input)
void PrintSelf(std::ostream &os, Indent indent) const override
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void SetInput1(const InputImageType *input)
void EnlargeOutputRequestedRegion(DataObject *) override
void ThreadedProcessLabelObject(LabelObjectType *labelObject) override
~LabelMapToBinaryImageFilter() override=default
typename OutputImageType::IndexType IndexType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....