18 #ifndef itkMaskImageFilter_h
19 #define itkMaskImageFilter_h
35 template <
typename TInput,
typename TMask,
typename TOutput = TInput>
57 return static_cast<TOutput>(A);
92 template <
typename TPixelType>
99 template <
typename TValue>
145 template <
typename TInputImage,
typename TMaskImage,
typename TOutputImage = TInputImage>
157 MaskInput<typename TInputImage::PixelType, typename TMaskImage::PixelType, typename TOutputImage::PixelType>;
179 this->SetNthInput(1, const_cast<MaskImageType *>(maskImage));
181 const MaskImageType *
195 this->GetFunctor().SetOutsideValue(outsideValue);
200 const typename TOutputImage::PixelType &
203 return this->GetFunctor().GetOutsideValue();
210 if (this->GetMaskingValue() != maskingValue)
213 this->GetFunctor().SetMaskingValue(maskingValue);
219 const typename TMaskImage::PixelType &
222 return this->GetFunctor().GetMaskingValue();
225 #ifdef ITK_USE_CONCEPT_CHECKING
240 Superclass::PrintSelf(os, indent);
241 os << indent <<
"OutsideValue: " << this->GetOutsideValue() << std::endl;
247 using PixelType =
typename TOutputImage::PixelType;
248 this->CheckOutsideValue(static_cast<PixelType *>(
nullptr));
250 this->SetFunctor(this->GetFunctor());
263 template <
typename TPixelType>
268 template <
typename TValue>
279 zeroVector.
Fill(TValue{});
281 if (currentValue == zeroVector)
283 zeroVector.SetSize(this->GetOutput()->GetVectorLength());
284 zeroVector.Fill(TValue{});
285 this->GetFunctor().SetOutsideValue(zeroVector);
287 else if (this->GetFunctor().GetOutsideValue().GetSize() != this->GetOutput()->GetVectorLength())
289 itkExceptionMacro(
"Number of components in OutsideValue: "
290 << this->GetFunctor().GetOutsideValue().GetSize() <<
" is not the same as the "
291 <<
"number of components in the image: " << this->GetOutput()->GetVectorLength());