18 #ifndef itkMaskImageFilter_h
19 #define itkMaskImageFilter_h
35 template <
typename TInput,
typename TMask,
typename TOutput = TInput>
60 return static_cast<TOutput>(A);
97 template <
typename TPixelType>
104 template <
typename TValue>
151 template <
typename TInputImage,
typename TMaskImage,
typename TOutputImage = TInputImage>
163 MaskInput<typename TInputImage::PixelType, typename TMaskImage::PixelType, typename TOutputImage::PixelType>;
185 this->SetNthInput(1, const_cast<MaskImageType *>(maskImage));
187 const MaskImageType *
201 this->GetFunctor().SetOutsideValue(outsideValue);
206 const typename TOutputImage::PixelType &
209 return this->GetFunctor().GetOutsideValue();
216 if (this->GetMaskingValue() != maskingValue)
219 this->GetFunctor().SetMaskingValue(maskingValue);
225 const typename TMaskImage::PixelType &
228 return this->GetFunctor().GetMaskingValue();
231 #ifdef ITK_USE_CONCEPT_CHECKING
246 Superclass::PrintSelf(os, indent);
247 os << indent <<
"OutsideValue: " << this->GetOutsideValue() << std::endl;
253 using PixelType =
typename TOutputImage::PixelType;
254 this->CheckOutsideValue(static_cast<PixelType *>(
nullptr));
256 this->SetFunctor(this->GetFunctor());
269 template <
typename TPixelType>
274 template <
typename TValue>
287 if (currentValue == zeroVector)
289 zeroVector.SetSize(this->GetOutput()->GetVectorLength());
291 this->GetFunctor().SetOutsideValue(zeroVector);
293 else if (this->GetFunctor().GetOutsideValue().GetSize() != this->GetOutput()->GetVectorLength())
295 itkExceptionMacro(<<
"Number of components in OutsideValue: " << this->GetFunctor().GetOutsideValue().GetSize()
296 <<
" is not the same as the "
297 <<
"number of components in the image: " << this->GetOutput()->GetVectorLength());