18 #ifndef __itkMaskImageFilter_h
19 #define __itkMaskImageFilter_h
34 template<
class TInput,
class TMask,
class TOutput = TInput >
53 return !( *
this != other );
56 inline TOutput
operator()(
const TInput & A,
const TMask & B)
const
60 return static_cast< TOutput
>( A );
94 template <
class TPixelType >
100 template <
class TValueType >
144 template<
class TInputImage,
class TMaskImage,
class TOutputImage = TInputImage >
149 typename TInputImage::PixelType,
150 typename TMaskImage::PixelType,
151 typename TOutputImage::PixelType > >
159 typename TInputImage::PixelType,
160 typename TMaskImage::PixelType,
161 typename TOutputImage::PixelType >
184 this->SetNthInput( 1, const_cast< MaskImageType * >( maskImage ) );
193 void SetOutsideValue(
const typename TOutputImage::PixelType & outsideValue)
195 if ( this->GetOutsideValue() != outsideValue )
198 this->GetFunctor().SetOutsideValue(outsideValue);
203 const typename TOutputImage::PixelType & GetOutsideValue()
const
205 return this->GetFunctor().GetOutsideValue();
209 void SetMaskingValue(
const typename TMaskImage::PixelType & maskingValue)
214 this->GetFunctor().SetMaskingValue(maskingValue);
222 return this->GetFunctor().GetMaskingValue();
225 void BeforeThreadedGenerateData()
227 typedef typename TOutputImage::PixelType PixelType;
228 this->CheckOutsideValue( static_cast<PixelType*>(
NULL) );
231 #ifdef ITK_USE_CONCEPT_CHECKING
237 typename TOutputImage::PixelType > ) );
246 void PrintSelf(std::ostream & os,
Indent indent)
const
248 Superclass::PrintSelf(os, indent);
249 os << indent <<
"OutsideValue: " << this->GetOutsideValue() << std::endl;
254 void operator=(
const Self &);
256 template <
class TPixelType >
259 template <
class TValue >
268 this->GetFunctor().GetOutsideValue();
272 if ( currentValue == zeroVector )
274 zeroVector.SetSize( this->GetOutput()->GetVectorLength() );
276 this->GetFunctor().SetOutsideValue( zeroVector );
278 else if ( this->GetFunctor().GetOutsideValue().GetSize() !=
279 this->GetOutput()->GetVectorLength() )
282 <<
"Number of components in OutsideValue: "
283 << this->GetFunctor().GetOutsideValue().GetSize()
284 <<
" is not the same as the "
285 <<
"number of components in the image: "
286 << this->GetOutput()->GetVectorLength());