18#ifndef itkVectorIndexSelectionCastImageFilter_h
19#define itkVectorIndexSelectionCastImageFilter_h
27template <
typename TInput,
typename TOutput>
56 return static_cast<TOutput
>(A[
m_Index]);
87template <
typename TInputImage,
typename TOutputImage>
92 Functor::VectorIndexSelectionCast<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
130#ifdef ITK_USE_CONCEPT_CHECKING
143 const unsigned int index = this->
GetIndex();
144 const TInputImage * image = this->
GetInput();
146 const unsigned int numberOfRunTimeComponents = image->GetNumberOfComponentsPerPixel();
148 using PixelType =
typename TInputImage::PixelType;
154 const unsigned int numberOfCompileTimeComponents =
sizeof(PixelRealType) /
sizeof(PixelScalarRealType);
156 unsigned int numberOfComponents = numberOfRunTimeComponents;
158 if (numberOfCompileTimeComponents > numberOfRunTimeComponents)
160 numberOfComponents = numberOfCompileTimeComponents;
163 if (index >= numberOfComponents)
165 itkExceptionMacro(
"Selected index = " << index
166 <<
" is greater than the number of components = " << numberOfComponents);
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(VectorIndexSelectionCast)
bool operator==(const VectorIndexSelectionCast &other) const
~VectorIndexSelectionCast()=default
TOutput operator()(const TInput &A) const
unsigned int GetIndex() const
VectorIndexSelectionCast()
void SetIndex(unsigned int i)
Base class for all process objects that output image data.
const InputImageType * GetInput() const
Define additional traits for native types such as int or float.
virtual void Modified() const
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Implements pixel-wise generic operation on one image.
FunctorType & GetFunctor()
Extracts the selected index of the vector that is the input pixel type.
unsigned int GetIndex() const
void SetIndex(unsigned int i)
void BeforeThreadedGenerateData() override
VectorIndexSelectionCastImageFilter()=default
~VectorIndexSelectionCastImageFilter() override=default
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....