18#ifndef itkMaskNegatedImageFilter_h
19#define itkMaskNegatedImageFilter_h
35template <
typename TInput,
typename TMask,
typename TOutput = TInput>
58 return static_cast<TOutput
>(A);
91 template <
typename TPixelType>
98 template <
typename TValue>
144template <
typename TInputImage,
typename TMaskImage,
typename TOutputImage = TInputImage>
156 MaskNegatedInput<typename TInputImage::PixelType, typename TMaskImage::PixelType, typename TOutputImage::PixelType>;
176 this->GetFunctor().SetOutsideValue(outsideValue);
181 const typename TOutputImage::PixelType &
184 return this->GetFunctor().GetOutsideValue();
191 if (this->GetMaskingValue() != maskingValue)
193 this->GetFunctor().SetMaskingValue(maskingValue);
200 const typename TMaskImage::PixelType &
203 return this->GetFunctor().GetMaskingValue();
214 this->SetNthInput(1,
const_cast<MaskImageType *
>(maskImage));
217 const MaskImageType *
223#ifdef ITK_USE_CONCEPT_CHECKING
238 Superclass::PrintSelf(os, indent);
239 os << indent <<
"OutsideValue: " << this->GetOutsideValue() << std::endl;
245 using PixelType =
typename TOutputImage::PixelType;
246 this->CheckOutsideValue(
static_cast<PixelType *
>(
nullptr));
249 this->SetFunctor(this->GetFunctor());
262 template <
typename TPixelType>
267 template <
typename TValue>
278 zeroVector.Fill(TValue{});
280 if (currentValue == zeroVector)
282 zeroVector.SetSize(this->GetOutput()->GetVectorLength());
283 zeroVector.Fill(TValue{});
284 this->GetFunctor().SetOutsideValue(zeroVector);
286 else if (this->GetFunctor().GetOutsideValue().GetSize() != this->GetOutput()->GetVectorLength())
288 itkExceptionMacro(
"Number of components in OutsideValue: "
289 << this->GetFunctor().GetOutsideValue().GetSize() <<
" is not the same as the "
290 <<
"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 the negation (or logical compliment) of a mask.
MaskNegatedImageFilter()=default
void BeforeThreadedGenerateData() override
void SetOutsideValue(const typename TOutputImage::PixelType &outsideValue)
void SetMaskImage(const MaskImageType *maskImage)
void CheckOutsideValue(const TPixelType *)
const TMaskImage::PixelType & GetMaskingValue() const
void CheckOutsideValue(const VariableLengthVector< TValue > *)
void SetMaskingValue(const typename TMaskImage::PixelType &maskingValue)
~MaskNegatedImageFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
const TOutputImage::PixelType & GetOutsideValue() const
const MaskImageType * GetMaskImage()
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....