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] );
84 template<
class TInputImage,
class TOutputImage >
88 Functor::VectorIndexSelectionCast< typename TInputImage::PixelType,
89 typename TOutputImage::PixelType > >
95 TInputImage, TOutputImage,
97 typename TOutputImage::PixelType > >
110 void SetIndex(
unsigned int i)
112 if ( i != this->GetFunctor().GetIndex() )
114 this->GetFunctor().SetIndex(i);
120 unsigned int GetIndex(
void)
const
122 return this->GetFunctor().GetIndex();
125 #ifdef ITK_USE_CONCEPT_CHECKING
137 virtual void BeforeThreadedGenerateData()
139 const unsigned int index = this->GetIndex();
140 const TInputImage *image = this->GetInput();
142 const unsigned int numberOfRunTimeComponents =
143 image->GetNumberOfComponentsPerPixel();
145 typedef typename TInputImage::PixelType PixelType;
153 const unsigned int numberOfCompileTimeComponents =
154 sizeof( PixelRealType ) /
sizeof( PixelScalarRealType );
156 unsigned int numberOfComponents = numberOfRunTimeComponents;
158 if ( numberOfCompileTimeComponents > numberOfRunTimeComponents )
160 numberOfComponents = numberOfCompileTimeComponents;
163 if ( index >= numberOfComponents )
166 <<
"Selected index = " << index
167 <<
" is greater than the number of components = "
168 << numberOfComponents);
174 void operator=(
const Self &);