18 #ifndef itkMaskImageFilter_h
19 #define itkMaskImageFilter_h
35 template <
typename TInput,
typename TMask,
typename TOutput = TInput>
57 return static_cast<TOutput>(A);
94 template <
typename TPixelType>
101 template <
typename TValue>
147 template <
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());