ITK  6.0.0
Insight Toolkit
itkLabelMapMaskImageFilter.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 itkLabelMapMaskImageFilter_h
19#define itkLabelMapMaskImageFilter_h
20
21#include "itkLabelMapFilter.h"
22
23namespace itk
24{
25
46template <typename TInputImage, typename TOutputImage>
47class ITK_TEMPLATE_EXPORT LabelMapMaskImageFilter : public LabelMapFilter<TInputImage, TOutputImage>
48{
49public:
50 ITK_DISALLOW_COPY_AND_MOVE(LabelMapMaskImageFilter);
51
57
59 using InputImageType = TInputImage;
60 using OutputImageType = TOutputImage;
64 using InputImagePixelType = typename InputImageType::PixelType;
65 using LabelObjectType = typename InputImageType::LabelObjectType;
66 using LabelType = typename LabelObjectType::LabelType;
67 using LengthType = typename LabelObjectType::LengthType;
68
72 using OutputImagePixelType = typename OutputImageType::PixelType;
76
77
79 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
80 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
81 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
82
84 itkNewMacro(Self);
85
87 itkOverrideGetNameOfClassMacro(LabelMapMaskImageFilter);
88
90 void
91 SetFeatureImage(const TOutputImage * input)
92 {
93 // Process object is not const-correct so the const casting is required.
94 this->SetNthInput(1, const_cast<TOutputImage *>(input));
95 }
96
98 const OutputImageType *
100 {
101 return static_cast<OutputImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
102 }
103
105 void
106 SetInput1(const TInputImage * input)
107 {
108 this->SetInput(input);
109 }
110
112 void
113 SetInput2(const TOutputImage * input)
114 {
115 this->SetFeatureImage(input);
116 }
117
122 itkSetMacro(BackgroundValue, OutputImagePixelType);
123 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
130 itkGetConstMacro(Label, InputImagePixelType);
136 itkSetMacro(Negated, bool);
137 itkGetConstReferenceMacro(Negated, bool);
138 itkBooleanMacro(Negated);
144 itkSetMacro(Crop, bool);
145 itkGetConstReferenceMacro(Crop, bool);
146 itkBooleanMacro(Crop);
153 itkSetMacro(CropBorder, SizeType);
154 itkGetConstReferenceMacro(CropBorder, SizeType);
157protected:
159 ~LabelMapMaskImageFilter() override = default;
160
164 void
166
168 void
169 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
170
171 void
173
174 void
175 GenerateData() override;
176
177 void
178 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
179
180 // part of a compile error workaround for GCC 4.8.5-28 (Red Hat) from 20150623
181 void
183 {
184 Superclass::DynamicThreadedGenerateData(outputRegion);
185 }
186
187 void
189
190 void
191 PrintSelf(std::ostream & os, Indent indent) const override;
192
193private:
195 OutputImagePixelType m_BackgroundValue{};
196 bool m_Negated{ false };
197 bool m_Crop{ false };
198 SizeType m_CropBorder{};
199
200 TimeStamp m_CropTimeStamp{};
201}; // end of class
202
203} // end namespace itk
204
205#ifndef ITK_MANUAL_INSTANTIATION
206# include "itkLabelMapMaskImageFilter.hxx"
207#endif
208
209#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
Mask and image with a LabelMap.
void EnlargeOutputRequestedRegion(DataObject *) override
void ThreadedProcessLabelObject(LabelObjectType *labelObject) override
~LabelMapMaskImageFilter() override=default
void SuperclassDynamicTGD(const OutputImageRegionType &outputRegion)
const OutputImageType * GetFeatureImage()
void PrintSelf(std::ostream &os, Indent indent) const override
void SetInput1(const TInputImage *input)
void GenerateData() override
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void SetInput2(const TOutputImage *input)
typename OutputImageType::IndexType IndexType
typename LabelObjectType::LengthType LengthType
void GenerateOutputInformation() override
void GenerateInputRequestedRegion() override
typename OutputImageType::SizeType SizeType
void SetFeatureImage(const TOutputImage *input)
typename LabelObjectType::LabelType LabelType
typename OutputImageType::RegionType RegionType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:61
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....