comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: 3d matrix rotation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: 3d matrix rotation [message #33437] Sun, 05 January 2003 11:01
jacobian is currently offline  jacobian
Messages: 4
Registered: August 2002
Junior Member
probably your volume is not isotropic (i.e. each voxel has the same
voxel size in every dimension, for example 1mm x 1mm x 1mm). So, when
you rotate it with the transformation matrix it assumes the volume is
isotropic and 'stretches' the z dimension.

There are various ways to solve for that:

1. Use congrid to resample your volume to isotropic dimensions.
2. Incorporate the changes in the transformation matrix itself and
then apply the Tx matrix (just multiply them actually, the
matrices).

Make sure that you write down on paper what dimension becomes what and
what the initial and final voxel sizes are. Otherwise your result
might
appear OK, but there will be errors. In short: DimX_1*voxmm_1 =
DimX_2*voxmm_2
(dimension times mm should be the same and equal to the total distance
in
one direction).

hope this helps a bit,

G.

"Rick Towler" <rtowler@u.washington.edu> wrote in message news:<av2jqc$ugi$1@nntp6.u.washington.edu>...
> "David Fanning" <david@dfanning.com> wrote...
>> New2IDL (biomedthesis2002@yahoo.com) writes:
>>
>>> I'm trying to rotate a 3D matrix using trackball. I have a 3D matrix
>>> of size 512x512x25. Hwn i try to rotate it, the matrix stretches along
>>> Z-axis. Hwn displayed the image is perfectly fine. Can anybody explain
>>> why that happens and what can be done to fix it. When i tried a
>>> dataset from the example (head.dat) for the same code, the rotation
>>> takes place without any stretch.
>>
>> Sounds to me like you are applying the transformation matrix
>> to the data itself, rather than to the model that holds
>> the data. Apply the transformation to the model.
>
> If all you wish to do is to visualize your data then as David is hinting you
> may want to create an IDLgrVolume object with your data, place that into a
> IDLgrModel object and then apply the transform from your trackball to the
> IDLgrModel transform.
>
> If you have a reason to apply the transform directly to your data then look
> for differences between your data set and head.dat (which you said
> transforms correctly). It is hard to say much more since your posting is a
> bit vague. You say the matrix stretches along the Z-axis but then you say
> the image is "perfectly fine". What image?
>
> -Rick
Re: 3d matrix rotation [message #33447 is a reply to message #33437] Thu, 02 January 2003 15:56 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"David Fanning" <david@dfanning.com> wrote...
> New2IDL (biomedthesis2002@yahoo.com) writes:
>
>> I'm trying to rotate a 3D matrix using trackball. I have a 3D matrix
>> of size 512x512x25. Hwn i try to rotate it, the matrix stretches along
>> Z-axis. Hwn displayed the image is perfectly fine. Can anybody explain
>> why that happens and what can be done to fix it. When i tried a
>> dataset from the example (head.dat) for the same code, the rotation
>> takes place without any stretch.
>
> Sounds to me like you are applying the transformation matrix
> to the data itself, rather than to the model that holds
> the data. Apply the transformation to the model.

If all you wish to do is to visualize your data then as David is hinting you
may want to create an IDLgrVolume object with your data, place that into a
IDLgrModel object and then apply the transform from your trackball to the
IDLgrModel transform.

If you have a reason to apply the transform directly to your data then look
for differences between your data set and head.dat (which you said
transforms correctly). It is hard to say much more since your posting is a
bit vague. You say the matrix stretches along the Z-axis but then you say
the image is "perfectly fine". What image?

-Rick
Re: 3d matrix rotation [message #33448 is a reply to message #33447] Thu, 02 January 2003 13:20 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
New2IDL (biomedthesis2002@yahoo.com) writes:

> I'm trying to rotate a 3D matrix using trackball. I have a 3D matrix
> of size 512x512x25. Hwn i try to rotate it, the matrix stretches along
> Z-axis. Hwn displayed the image is perfectly fine. Can anybody explain
> why that happens and what can be done to fix it. When i tried a
> dataset from the example (head.dat) for the same code, the rotation
> takes place without any stretch.

Sounds to me like you are applying the transformation matrix
to the data itself, rather than to the model that holds
the data. Apply the transformation to the model.

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: About Mars, the "Greenish" Planet.
Next Topic: How can I plot in color?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 16:53:57 PDT 2025

Total time taken to generate the page: 0.48129 seconds