[Insight-users] problems with resample filter

Luis Ibanez luis.ibanez at kitware.com
Wed May 25 19:22:33 EDT 2005


Hi Bryn

You *should not* touch the regions of an image that
have been obtained from the GetOutput() of a filter.

The filter is still in control of the regions used
by the pipeline.

If what you want is to make sure that the Update()
generate the full image, then you should just call

      filter->UpdateLargestPossibleRegion()

instead of

      filter->Update()


Note also that the images that are generated as output
from a filter, cannot (should not) be modified. In other
words, they are read-only images.



 From your code snippet, we don't see where did you defined
the output grid for the resampled image. This is quite
important and its lack may well be the cause of the segmentation
faults.


For details on how to use the itk::ResampleImageFilter
correctly you may want to look at the ITK Software Guide


      http://www.itk.org/ItkSoftwareGuide.pdf


Section 6.9, pdf-pages 245 to 272.






      Regards,




        Luis





-------------------------------
Bryn Alexander Lloyd wrote:

> Hi,
> 
> I am trying to use the itk::ResampleImageFilter to upsample an image.
> As an example I would like create an image with 256x256 pixels from an
> image with 50x50 pixels.
> 
> For some reason if I try to access the output image data with an iterator,
> I get a segmentation fault.
> The same happens if I try to write an image after setting the
> BufferedRegion to the LargestPossibleRegion. (It seems to work if don't
> set the region to the largest possible). I am using the
> LinearImageInterpolatorFunction.
> 
> 
> Why is this? Can anybody help me with this?
> 
> Thanks,
> 
> 
> 
>   resamplefilter->SetOutputSpacing(Ioriginal->GetSpacing );
>   resamplefilter->SetOutputOrigin( Ioriginal->GetOrigin() );
> 
>   resamplefilter->SetInput( Isubsampled );
>   resamplefilter->Update();
>   Inew = resamplefilter->GetOutput();
> 
>   //Inew->SetBufferedRegion(Inew->GetLargestPossibleRegion());
>   //Inew->SetRequestedRegion(Inew->GetLargestPossibleRegion());
> 
>   writer->SetInput( Inew );
>   writer->SetFileName("Inew.mhd");
>   writer->Update();
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 





More information about the Insight-users mailing list