18#ifndef itkMaskImageFilter_h
19#define itkMaskImageFilter_h
35template <
typename TInput,
typename TMask,
typename TOutput = TInput>
57 return static_cast<TOutput
>(A);
94 template <
typename TPixelType>
101 template <
typename TValue>
147template <
typename TInputImage,
typename TMaskImage,
typename TOutputImage = TInputImage>
159 MaskInput<typename TInputImage::PixelType, typename TMaskImage::PixelType, typename TOutputImage::PixelType>;
181 this->SetNthInput(1,
const_cast<MaskImageType *
>(maskImage));
183 const MaskImageType *
197 this->GetFunctor().SetOutsideValue(outsideValue);
202 const typename TOutputImage::PixelType &
205 return this->GetFunctor().GetOutsideValue();
212 if (this->GetMaskingValue() != maskingValue)
215 this->GetFunctor().SetMaskingValue(maskingValue);
221 const typename TMaskImage::PixelType &
224 return this->GetFunctor().GetMaskingValue();
227#ifdef ITK_USE_CONCEPT_CHECKING
242 Superclass::PrintSelf(os, indent);
243 os << indent <<
"OutsideValue: " << this->GetOutsideValue() << std::endl;
249 using PixelType =
typename TOutputImage::PixelType;
250 this->CheckOutsideValue(
static_cast<PixelType *
>(
nullptr));
252 this->SetFunctor(this->GetFunctor());
265 template <
typename TPixelType>
270 template <
typename TValue>
281 zeroVector.Fill(TValue{});
283 if (currentValue == zeroVector)
285 zeroVector.SetSize(this->GetOutput()->GetVectorLength());
286 zeroVector.Fill(TValue{});
287 this->GetFunctor().SetOutsideValue(zeroVector);
289 else if (this->GetFunctor().GetOutsideValue().GetSize() != this->GetOutput()->GetVectorLength())
291 itkExceptionMacro(
"Number of components in OutsideValue: "
292 << this->GetFunctor().GetOutsideValue().GetSize() <<
" is not the same as the "
293 <<
"number of components in the image: " << this->GetOutput()->GetVectorLength());
Implements pixel-wise generic operation of two images, or of an image and a constant.
Control indentation during Print() invocation.
Light weight base class for most itk classes.
Mask an image with a mask.
void CheckOutsideValue(const VariableLengthVector< TValue > *)
void BeforeThreadedGenerateData() override
void SetMaskingValue(const typename TMaskImage::PixelType &maskingValue)
const MaskImageType * GetMaskImage()
const TMaskImage::PixelType & GetMaskingValue() const
void CheckOutsideValue(const TPixelType *)
void PrintSelf(std::ostream &os, Indent indent) const override
MaskImageFilter()=default
const TOutputImage::PixelType & GetOutsideValue() const
~MaskImageFilter() override=default
void SetMaskImage(const MaskImageType *maskImage)
void SetOutsideValue(const typename TOutputImage::PixelType &outsideValue)
FunctorType & GetFunctor()
Define additional traits for native types such as int or float.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
#define itkConceptMacro(name, concept)
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....