[Insight-developers] How to cast the itk::Image<PixelType, 3> * to itk::Image<itk::VariableLengthVector<PixelType>, 3> *

Binjie Qin bjqin at sjtu.edu.cn
Mon Jan 25 22:44:37 EST 2010


Dear insight-developers:

    There is PixelType (typedef signed short PixelType) conversion error of  
building gtractCoregBvalues at the GTRACT in the following code:

    typedef  
itk::VectorIndexSelectionCastImageFilter<NrrdImageType,IndexImageType>  
FixedImageType;
    FixedImageType::Pointer fixedImageExtractionFilter =  
FixedImageType::New();
     .
     .
     .

    typedef itk::VectorImageRegisterVersorRigidFilter<NrrdImageType,  
NrrdImageType> RegisterFilterType;
     RegisterFilterType::Pointer registerImageFilter =  
RegisterFilterType::New();
     .
     .
     .

     registerImageFilter->SetFixedImage(  
fixedImageExtractionFilter->GetOutput( ) );


     The outputimage PixelType of "fixedImageExtractionFilter->GetOutput(  
)" is TPixel=PixelType, PixelType is signed short.

     However the inputimage PixelType of  
"registerImageFilter->SetFixedImage (itk::Image<TPixel,VImageDimension>  
*)" is TPixel=itk::VariableLengthVector<PixelType>

     How to cast the "itk::Image<PixelType,3> *" to  
"itk::Image<itk::VariableLengthVector<PixelType>,3> *"?

     The itkScalarToArrayCastImageFilter is not useful because the  
VariableLengthVector<PixelType> is not a fixed array .

     If the cast should be implemented with static_cast of each PixelType  
by accessing each pixel value?


     Thank you in advance.


bjqin at SJTU



More information about the Insight-developers mailing list