[Insight-users] Resampling images

Luis Ibanez luis.ibanez@kitware.com
Thu, 03 Oct 2002 11:14:31 -0400


Hi cspl,

If the IdentityTransform is producing the same effect of the 
AffineTransform
resulting from your registration, this may be a bug in the resample 
image filter.

No major changes have been done on the AffineTransform.  You can always
check on modification using the CVS web portal:

      http://www.itk.org/cgi-bin/cvsweb.cgi/Insight/?cvsroot=Insight

In particular, for the AffineTransform you can check the Common directory:

    
 http://www.itk.org/cgi-bin/cvsweb.cgi/Insight/Code/Common/?cvsroot=Insight

the AffineTransform.h file :

http://www.itk.org/cgi-bin/cvsweb.cgi/Insight/Code/Common/itkAffineTransform.h?cvsroot=Insight

and the AffineTransform.txx file:

http://www.itk.org/cgi-bin/cvsweb.cgi/Insight/Code/Common/itkAffineTransform.txx?cvsroot=Insight


The Intesity rescaling shouldn't make any difference in the geometrical
resampling of the images.


I'll  run a try with synthetic images having similar size and spacing to 
yours,
and see what happens,...


Thanks


       Luis

=======================================================================

cspl wrote:

>Hi Luis,
>
>First, have you made any changes to ResampleImageFilter or AffineTransform
>during last 45 days.
>2 days back i updated my ITK with the latest, and suddenly my old Transform
>code is not showing the  same result as i posted on our website.
>
>anyway,
>I experimented with IdentityTransform and the result is the same as the old
>AffineTransform output.Absolutely no change.
>
>This is the code i'm using.
>
>
>NOTE:  Before this i'm rescaling the volume to unsigned char data type. with
>min intensity 0 and max 254.
> Does this affect the result???
>
>****************************************************************************
>***********
> typedef BufferToImageConversion <unsigned char> ConverterType; // Volume -
>Image converetr
> typedef ConverterType::ImageType UCharImage;
>
>// typedef itk::AffineTransform<double, 3> TransformType;
> typedef itk::IdentityTransform<double, 3> TransformType;
> itk::SmartPointer< TransformType>  transform;
>
> typedef itk::ResampleImageFilter<UCharImage, UCharImage>  ResampleFilter;
> typedef UCharImage::SizeType  ImageSizeType;
>
>
>////////////////////////////////////////////////////////////////////////////
>///////////////
> //
> // initializations
> //
>
>////////////////////////////////////////////////////////////////////////////
>///////////////
>
>// this is the matrix i use to store the regitration result.Now commented
>// double result[12];
>// memcpy(result, mat->Mat, sizeof(double)*12);
>
> ConverterType converter ;
> ConverterType ::ImagePointer spectImage = converter.GetImage(pMoving);
> ConverterType ::ImagePointer mriImage = converter.GetImage(pFixed);
> ImageSizeType size;
> size[0]=pTemp->width, size[1]= pTemp->height, size[2] = pTemp->depth;
>
> ResampleFilter::Pointer resampleFilter = ResampleFilter::New();
>
> transform = TransformType::New();
> TransformType::ParametersType params(transform->GetNumberOfParameters()) ;
>
>// for (int pi=0;pi<12;pi++)
>//    params[pi] = result[pi];
>
>// transform->SetParameters( params); // no params set for IdentityTransform
>
> UCharImage::Pointer outImage  = NULL;
>
> resampleFilter ->SetTransform(transform.GetPointer());
>    resampleFilter->SetInput(spectImage );
>
>    resampleFilter->SetSize(
>mriImage->GetLargestPossibleRegion().GetSize());
>    resampleFilter->SetOutputOrigin( mriImage->GetOrigin() );
>    resampleFilter->SetOutputSpacing( mriImage->GetSpacing() );
>
> try
> {
>  resampleFilter->Update();
>
> }catch(itk::ExceptionObject &Eo){
>
>  AfxMessageBox(Eo.GetDescription());
> }
>
> outImage   = resampleFilter->GetOutput();
>
>
>*******************************************************
>
>Thanks, Looking forward for your help on this,
>
>cspl
>
>_______________________________________________
>Insight-users mailing list
>Insight-users@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-users
>