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

Bill Lorensen bill.lorensen at gmail.com
Sat Apr 20 11:24:58 EDT 2013


ITK uses a demand driven pipeline (as does VTK).

Update on a down stream filter will propagate upstream. If you need
intermediate results in a pipeline then you must apply Update at the point
you want the data.




On Sat, Apr 20, 2013 at 10:36 AM, Willi Huber <
surfersparadise85-itk at yahoo.com> wrote:

> 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
>
>
>
> _____________________________________
> 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
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130420/45f92fac/attachment-0001.htm>


More information about the Insight-users mailing list