ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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;
61 using InputImagePointer = typename InputImageType::Pointer;
62 using InputImageConstPointer = typename InputImageType::ConstPointer;
63 using InputImageRegionType = typename InputImageType::RegionType;
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
69 using OutputImagePointer = typename OutputImageType::Pointer;
70 using OutputImageConstPointer = typename OutputImageType::ConstPointer;
71 using OutputImageRegionType = typename OutputImageType::RegionType;
72 using OutputImagePixelType = typename OutputImageType::PixelType;
73 using IndexType = typename OutputImageType::IndexType;
74 using SizeType = typename OutputImageType::SizeType;
75 using RegionType = typename OutputImageType::RegionType;
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);
125
130 itkGetConstMacro(Label, InputImagePixelType);
132
136 itkSetMacro(Negated, bool);
137 itkGetConstReferenceMacro(Negated, bool);
138 itkBooleanMacro(Negated);
140
144 itkSetMacro(Crop, bool);
145 itkGetConstReferenceMacro(Crop, bool);
146 itkBooleanMacro(Crop);
148
153 itkSetMacro(CropBorder, SizeType);
154 itkGetConstReferenceMacro(CropBorder, SizeType);
156
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 {
185 }
186
187 void
189
190 void
191 PrintSelf(std::ostream & os, Indent indent) const override;
192
193private:
196 bool m_Negated{ false };
197 bool m_Crop{ false };
199
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.
virtual void SetInput(const InputImageType *input)
Control indentation during Print() invocation.
Definition itkIndent.h:50
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void ThreadedProcessLabelObject(LabelObjectType *labelObject) override
~LabelMapMaskImageFilter() override=default
void SuperclassDynamicTGD(const OutputImageRegionType &outputRegion)
const OutputImageType * GetFeatureImage()
void EnlargeOutputRequestedRegion(DataObject *output) override
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)
void GenerateOutputInformation() override
void GenerateInputRequestedRegion() override
void SetFeatureImage(const TOutputImage *input)
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Implements transparent reference counting.
Generate a unique, increasing time value.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....