18#ifndef itkMaskImageFilter_h
19#define itkMaskImageFilter_h
35template <
typename TInput,
typename TMask,
typename TOutput = TInput>
57 return static_cast<TOutput
>(A);
92 template <
typename TPixelType>
99 template <
typename TValue>
145template <
typename TInputImage,
typename TMaskImage,
typename TOutputImage = TInputImage>
157 MaskInput<typename TInputImage::PixelType, typename TMaskImage::PixelType, typename TOutputImage::PixelType>;
181 const MaskImageType *
195 this->
GetFunctor().SetOutsideValue(outsideValue);
200 const typename TOutputImage::PixelType &
213 this->
GetFunctor().SetMaskingValue(maskingValue);
219 const typename TMaskImage::PixelType &
237 os << indent <<
"OutsideValue: " << this->
GetOutsideValue() << std::endl;
243 using PixelType =
typename TOutputImage::PixelType;
259 template <
typename TPixelType>
264 template <
typename TValue>
275 zeroVector.Fill(TValue{});
277 if (currentValue == zeroVector)
279 zeroVector.SetSize(this->
GetOutput()->GetVectorLength());
280 zeroVector.Fill(TValue{});
281 this->
GetFunctor().SetOutsideValue(zeroVector);
285 itkExceptionMacro(
"Number of components in OutsideValue: "
287 <<
"number of components in the image: " << this->
GetOutput()->GetVectorLength());
BinaryGeneratorImageFilter()
void SetFunctor(const std::function< ConstRefFunctionType > &f)
OutputImageType * GetOutput()
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
void CheckOutsideValue(const VariableLengthVector< TValue > *)
void BeforeThreadedGenerateData() override
void SetMaskingValue(const typename TMaskImage::PixelType &maskingValue)
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
const MaskImageType * GetMaskImage()
const TMaskImage::PixelType & GetMaskingValue() const
void CheckOutsideValue(const TPixelType *)
virtual const FunctorType & GetFunctor() const
void PrintSelf(std::ostream &os, Indent indent) const override
MaskImageFilter()=default
const TOutputImage::PixelType & GetOutsideValue() const
~MaskImageFilter() override=default
BinaryGeneratorImageFilter< TInputImage, TMaskImage, TOutputImage > Superclass
void SetMaskImage(const MaskImageType *maskImage)
Functor:: MaskInput< typename TInputImage::PixelType, typename TMaskImage::PixelType, typename TOutputImage::PixelType > FunctorType
void SetOutsideValue(const typename TOutputImage::PixelType &outsideValue)
FunctorType & GetFunctor()
virtual void Modified() const
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....