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

Home » Public Forums » archive » Re: Rotate volumes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Rotate volumes [message #26695 is a reply to message #26693] Tue, 18 September 2001 01:04 Go to previous messageGo to previous message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
"B.C. Hamans" wrote:
>
> Hi,
>
> I'm still working on my volumes (see previous posting) and trying to rotate
> and translate them to match each other. It would be very nice if I could use
> something like XVOLUME_ROTATE, /T3D or /MATRIX=!P.T. (Of course this isn't
> possible). I also thought about using CONVERT_COORD but this is no solution
> either (i think). The 2 volumes are described by a matrix of dimension
> 256x256x256 containing gray values between 0 and 255. I obtain a translation
> matrix to fit the 2 images from an external program. In the future i hope to
> do this by using MIM or MIM2 (http://www.nuclear.uhrad.com/mim2.htm). The
> translation matrix is of the form !P.T (4x4).
>
> I already made some nice projections of the volumes using PROJECT_VOL in 3
> directions and would like to add some sliders to define rotation,
> translation and skew factors. To align the volumes before further processing
> them.
>
> Anybody?
>
> Bob

If Martin's function does what you want:

I had a similar problem some time ago,
this solutions seemed to be faster (even with loops), less
resource-hungry
and you get an intepolated result.

hope it helps,
:-) marc



MRI2 it the bytarr(256,256,256)
phi fltarr(3) the three angles to rotate (+/- is convention)
trans intarr(3) the translation (in voxels)

print,'X...'
if phi[0] ne 0.0 then begin
for x=0,255 do begin

MRI2[x,*,*]=rot(/INTERP,reform(MRI2[x,*,*],256,256),-phi[0], MISSING=0)
endfor
endif
print,'Y...'
if phi[1] ne 0.0 then begin
for y=0,255 do begin

MRI2[*,y,*]=rot(/INTERP,reform(MRI2[*,y,*],256,256),phi[1],M ISSING=0)
endfor
endif
print,'Z...'
if phi[2] ne 0.0 then begin
for z=0,255 do begin
MRI2[*,*,Z]=rot(/INTERP,MRI2[*,*,Z],-phi[2],MISSING=0)
endfor
endif

print,'shift...'
MRI2=shift(MRI2,trans[0],trans[1],trans[2])
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Variable undefined after while-cycle?
Next Topic: significance probability when using CORRELATE?

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

Current Time: Fri Oct 10 13:45:40 PDT 2025

Total time taken to generate the page: 0.00669 seconds