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

Luis Ibanez luis.ibanez at kitware.com
Tue Jan 26 10:18:18 EST 2010


Hi bjqin at SJTU,


You may want to use the filter:

Insight/Code/BasicFilters/
      itkImageToVectorImageFilter.h


   Regards,


        Luis



------------------------------------
On Mon, Jan 25, 2010 at 10:44 PM, Binjie Qin <bjqin at sjtu.edu.cn> wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list