[Insight-users] Re: Insight-users digest, Vol 1 #279 - 1 msg

cspl affable@hd2.dot.net.in
Thu, 3 Oct 2002 19:08:13 +0530


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