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>>
139 const unsigned int index = this->
GetIndex();
140 const TInputImage * image = this->
GetInput();
142 const unsigned int numberOfRunTimeComponents = image->GetNumberOfComponentsPerPixel();
144 using PixelType =
typename TInputImage::PixelType;
150 const unsigned int numberOfCompileTimeComponents =
sizeof(PixelRealType) /
sizeof(PixelScalarRealType);
152 unsigned int numberOfComponents = numberOfRunTimeComponents;
154 if (numberOfCompileTimeComponents > numberOfRunTimeComponents)
156 numberOfComponents = numberOfCompileTimeComponents;
159 if (index >= numberOfComponents)
161 itkExceptionMacro(
"Selected index = " << index
162 <<
" 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)
const InputImageType * GetInput() const
virtual void Modified() const
Implements transparent reference counting.
UnaryFunctorImageFilter()
FunctorType & GetFunctor()
unsigned int GetIndex() const
SmartPointer< Self > Pointer
void SetIndex(unsigned int i)
SmartPointer< const Self > ConstPointer
void BeforeThreadedGenerateData() override
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::VectorIndexSelectionCast< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
VectorIndexSelectionCastImageFilter()=default
VectorIndexSelectionCastImageFilter Self
~VectorIndexSelectionCastImageFilter() override=default
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....