[Insight-users] Image assignment does not work

wanlin wanlinzhu at gmail.com
Thu Sep 2 09:41:06 EDT 2010


What about
void applyFilter(InternalImageType:
:Pointer & image,
itk::ImageToImageFilter<InternalImageType,InternalImageType>::Pointer
filter)

image=filter->GetOutput();//here image pointer inside function has been
changed, however, the image outside the function does not.




2010/9/2 Dženan Zukić <dzenanz at gmail.com>

> Hi everyone!
>
> I have the following routine:
>
> void applyFilter(InternalImageType::Pointer image,
> itk::ImageToImageFilter<InternalImageType,InternalImageType>::Pointer
> filter)
> {
> if (!checkImageLoaded())
> return;
> statusbar->showMessage("Applying filter:
> "+QString(filter->GetNameOfClass()));
>  filter->SetInput( image );
> filter->Update();
> image=filter->GetOutput();
>  updateVisualizing();
> resetVisualization();
> statusbar->showMessage("Ready");
> }
>
> and it is invoked like this:
>
> typedef itk::SmoothingRecursiveGaussianImageFilter < InternalImageType,
> InternalImageType> FilterType;
> FilterType::Pointer filter = FilterType::New();
> filter->SetSigmaArray(myImage->GetSpacing());
> applyFilter(myImage,
> (itk::ImageToImageFilter<InternalImageType,InternalImageType>::Pointer)filter);
>
> However, the above code produces no effect (the image does not change).
> When content of "applyFilter" is copied to invocation points, it works.
>
> What am I doing wrong?
>
> Regards,
> Dženan
>
> _____________________________________
> 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.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-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100902/212631ce/attachment.htm>


More information about the Insight-users mailing list