[Insight-users] CastImageFilter: Error when casting to long long

Willi Huber surfersparadise85-itk at yahoo.com
Sat Apr 20 09:49:50 EDT 2013


Hello,

I want to do some casting without success.
For the purpose of generating an integral image and the bounded range in e.g. char I want to cast the image prior to caculating the integrals.
Whenever I cast to long which is sufficient for 2D images it works all fine and also for small 3D test images when casting to long I get all the values I want to.

Bu when I try casting to datatype long long using the CastImageFilter the output of the cast is an empty image, i.e. and image with index={0,0,0}, spacing={0,0,0}, size={0,0,0} and so on. So only standard values.
I had a look into the CastImageFilter-code and there is also a concept check Concept::Convertible< typename TInputImage::PixelType,  typename TOutputImage::PixelType >
So why does this happen?

Short snippet of my code:
                                typedef itk::Image<long long, 3> ImageType;
typedef itk::Image<unsigned short, Dimensions> InputImageType;
typedef itk::CastImageFilter<InputImageType, ImageType> CastType;

typename CastType::Pointer caster = CastType::New();

typename InputImageType::Pointer image = imageW->get<InputImageType>(); //imageW is a wrapper that allows handling of an image without knowing its type
caster->SetInput(image);
typename ImageType::Pointer integral = caster->GetOutput();

After execution of the previous code integral keeps and empty image. Not a itkSmartPointer that points to Null but a real image of my type without content as described above.

I hope you can help me.

Thanks in advance,
Willi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130420/24e93924/attachment.htm>


More information about the Insight-users mailing list