[Insight-users] VersorRigid3DTransform Scaling Problem
Tahir Mansoori
tahir.mansoori at gmail.com
Mon Aug 21 10:58:55 EDT 2006
Thanks Luis.
You are right. It was because of inappropriate viewer.
Tahir
On 8/21/06, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
>
> Hi Tahir,
>
> It seems that there is a confusion in your use of the output spacing.
>
> You are allowed to use *any* spacing for resampling the moving image,
> the spacing that is usually more appropriate is the spacing of the
> fixed image because it is common to overlap the resampled moving
> image into the fixed image.
>
> The problem that you are observing seems to be the consequence
> of using an inappropriate viewer or a poor file format for storing
> your images.
>
> You *DO NOT* need the spacing to the isotropic, and you *DO NOT*
> need rotations to be limited to 90 degrees in order to have the
> resampling working properly.
>
> In practice, what you should probably do is to simply use the
> spacing of the Fixed image, and to make sure that you use a viewer
> that supports pixel spacing. (e.g. VTK).
>
> That being said. From the description at the top of your email,
> it seems that what you want to do is to simply rotate your image
> by 90 degrees. This is more a case of Axis Permutation than a
> case for a full image resampling.
>
>
> You probably want to consider the PermuteAxesImageFilter:
>
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1PermuteAxesImageFilter.html
>
>
>
>
> Regards,
>
>
> Luis
>
>
>
>
> ----------------------
> Tahir Mansoori wrote:
> > Hi,
> >
> > I am using VersorRigid3DTransform to rotate 3D volume. The physical
> > spacing is 212 X 212 X 392 um. I am rotating volume around Y-Axis by
> > 90 degrees.
> >
> > This is a very simple case because input spacing 212 X 212 X 392 um
> > will be changed to output spacing of 392X212X212.
> >
> > But if I rotate volume first around Z axis 45 degrees and then around
> > X axis 65 degrees, then output spacing need to be calculated by
> > applying this transform to a cube having dimensions 212 X 212 X 392
> > um.
> >
> > TransformType::Pointer transform = TransformType::New();
> > typedef TransformType::VersorType VersorType;
> > typedef VersorType::VectorType VectorType;
> >
> > VersorType rotation;
> > VectorType axis;
> >
> > axis[0] = 0;
> > axis[1] = 1;
> > axis[2] = 0;
> >
> > const double angle = 1.571; // 90 degrees
> >
> > rotation.Set( axis, angle );
> >
> > transform->SetRotation( rotation );
> >
> > ResampleFilterType::Pointer resampler = ResampleFilterType::New();
> >
> > resampler->SetTransform( transform );
> > resampler->SetInput( fixedImageReader->GetOutput() );
> >
> > FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput();
> >
> > resampler->SetSize( fixedImage->GetLargestPossibleRegion().GetSize() );
> > resampler->SetOutputOrigin( fixedImage->GetOrigin() );
> > ** resampler->SetOutputSpacing( fixedImage->GetSpacing() );
> > resampler->SetDefaultPixelValue( 255 );
> >
> > The line marked with ** does not work if spacing along all dimensions
> > is not equal or rotation angles are not multiple of pi/2.
> >
> > If there any function or transform in itk to calculate output scaling.
> >
> > Tahir Mansoori
> > _______________________________________________
> > 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