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

Willi Huber surfersparadise85-itk at yahoo.com
Sat Apr 20 10:36:57 EDT 2013


Sorry,

I solved the problem.
It wasn't due to the datatype. I forgot calling caster->Update().
In the examples this method is never called. Why is this?

Cheers,
Willi



>________________________________
> Von: Willi Huber <surfersparadise85-itk at yahoo.com>
>An: "insight-users at itk.org" <insight-users at itk.org> 
>Gesendet: 15:49 Samstag, 20.April 2013
>Betreff: [Insight-users] CastImageFilter: Error when casting to long long
> 
>
>
>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
>_____________________________________
>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://www.kitware.com/products/protraining.php
>
>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-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130420/97b37a1b/attachment.htm>


More information about the Insight-users mailing list