[Insight-users] about itkResampleImageFilter

Luis Ibanez luis.ibanez at kitware.com
Sat Jul 29 18:12:06 EDT 2006


Hi Yixun,

It is a common mistake to get values from the Image before it has been
read with a reader.

In your code you are using the methods

   GetSpacing()
   GetOrigin()
   GetLargestPossibleRegion()


in the fixed image.

It is very likely that you have not updated yet the reader of the
fixed image, and therefore the image lacks any information at the
moment you are invoking all these methods.



   Regards,



       Luis



-----------------------
Yixun Liu wrote:
> Hi,
>  
> The fixedImage and movingImage both are 256 x 256 x 48. I use the grid 
> with size 256 x 256 x 1 and start index (0,0,24) as the resample grid. I 
> do as below,
>  
> typedef itk::Image<short, 3> ImageType;
> typedef itk::ResampleImageFilter<ImageType, ImageType>  ResampleFilterType;
> ResampleFilterType::Pointer resampler = ResampleFilterType::New();
>  
>  resampler->SetTransform( transform );
> // resampler->SetInterpolator(this->interpolator);
>  resampler->SetInput( movingImage );
>  size =  fixedImage->GetLargestPossibleRegion().GetSize();
>  size[2] = 1;
>  index[2] = 24;
>  index[0] = index[1] = 0;
>  this->resampler->SetSize(size);
>  this->resampler->SetOutputStartIndex(index);
>  this->resampler->SetOutputOrigin(  fixedImage->GetOrigin() );
>  this->resampler->SetOutputSpacing( fixedImage->GetSpacing() );
>  this->resampler->SetDefaultPixelValue( 100 );
>  this->resampler->Update();
>  
> After resampled I change the index from (0,0,24) to (0,0,16). However 
> itk exception throwed. I debug into ITK and found the 
> possiblelargestregion change from (0,0,24) to (0,0,16), but the 
> requestregion still is (0,0,24). The requestregion is not in the range 
> of the possiblelargestregion, so the exception throw. Why not ITK 
> automatically change the requestregion when the largestpossibleregion 
> change?
>  
>  
>  
> Regards,
>  
> Yixun Liu
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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