18 #ifndef __itkVectorIndexSelectionCastImageFilter_h
19 #define __itkVectorIndexSelectionCastImageFilter_h
27 template<
class TInput,
class TOutput >
48 return !( *
this != other );
53 return static_cast< TOutput
>( A[
m_Index] );
82 template<
class TInputImage,
class TOutputImage >
86 Functor::VectorIndexSelectionCast< typename TInputImage::PixelType,
87 typename TOutputImage::PixelType > >
93 TInputImage, TOutputImage,
95 typename TOutputImage::PixelType > >
108 void SetIndex(
unsigned int i)
110 if ( i != this->GetFunctor().GetIndex() )
112 this->GetFunctor().SetIndex(i);
118 unsigned int GetIndex(
void)
const
120 return this->GetFunctor().GetIndex();
123 #ifdef ITK_USE_CONCEPT_CHECKING
135 virtual void BeforeThreadedGenerateData()
137 const unsigned int index = this->GetIndex();
138 const TInputImage *image = this->GetInput();
140 const unsigned int numberOfRunTimeComponents =
141 image->GetNumberOfComponentsPerPixel();
143 typedef typename TInputImage::PixelType PixelType;
151 const unsigned int numberOfCompileTimeComponents =
152 sizeof( PixelRealType ) /
sizeof( PixelScalarRealType );
154 unsigned int numberOfComponents = numberOfRunTimeComponents;
156 if ( numberOfCompileTimeComponents > numberOfRunTimeComponents )
158 numberOfComponents = numberOfCompileTimeComponents;
161 if ( index >= numberOfComponents )
164 <<
"Selected index = " << index
165 <<
" is greater than the number of components = "
166 << numberOfComponents);
172 void operator=(
const Self &);