Re: rotating 3d array: help for the braindead! [message #3576] |
Mon, 20 February 1995 10:12  |
mark_cadwell
Messages: 10 Registered: February 1994
|
Junior Member |
|
|
> I have a stack of MRI images that make up a 3d array, and I want to turn
> all the constituent images over.
> At the moment, I've got a FOR loop that goes through using
>
> ROTATE(image(*,*,i),2)
>
> on each one, but I'm convinced there must be a better way to do it in a
> oner without the FOR loop to slow things down.
There is a method of animation called double buffering where you plot an
image to a virtual window, copy the virtual window to your main window,
and while that is going on, you're drawing the next image to the virtual
window again. The advantage of doing it this way is that plotting to
virtual windows is much faster (at least in my machine) that plotting to
visible windows, and copying from a virtual window to a visible window is
also much faster that plotting. The result is a nice, smooth, and
reasonably fast image rotation.
----------------------------------
|
|
|
Re: rotating 3d array: help for the braindead! [message #3615 is a reply to message #3576] |
Wed, 15 February 1995 04:03   |
Fergus Gallagher
Messages: 41 Registered: January 1995
|
Member |
|
|
Fergus Gallagher <f.Gallagher@nerc.ac.uk> wrote:
> Off the top of my head, the following might work :-0
>
> s = (size(image))(1:3)
> image = reform(image,s(0),s(1)*s(2),/overwrite)
> image = rotate(image,2)
> image = reform(image,s(0),s(1),s(2),/overwrite)
>
> *BUT* only for the case where you want to flip the images up-down.
>
> I haven't tried this, so take it with a PINCH of salt......
>
> Fergus Gallagher
> British National Space Centre
On second thoughts, it probably won't - it would if your "bands" were
in the the first index, i.e.,
image(i,*,*)
and then
s = (size(image))(1:3)
image = reform(image,s(0)*s(1),s(2),/overwrite)
image = rotate(image,7)
image = reform(image,s(0),s(1),s(2),/overwrite)
should work.
Fergus
P.S. Bill Thompson (NASA) recently posted his REARRANGE.PRO (with fast
CALL_EXTERNAL call) in this newsgroup: you might find this useful to
rearrange (!) your image into the above format.
See thread "Inner product of multi-dimensional arrays"
|
|
|
Re: rotating 3d array: help for the braindead! [message #3616 is a reply to message #3615] |
Wed, 15 February 1995 03:48   |
Fergus Gallagher
Messages: 41 Registered: January 1995
|
Member |
|
|
pjclinch@dux.dundee.ac.uk (Pete Clinch) wrote:
>
> I have a stack of MRI images that make up a 3d array, and I want to turn
> all the constituent images over.
> At the moment, I've got a FOR loop that goes through using
>
> ROTATE(image(*,*,i),2)
>
> on each one, but I'm convinced there must be a better way to do it in a
> oner without the FOR loop to slow things down.
Off the top of my head, the following might work :-0
s = (size(image))(1:3)
image = reform(image,s(0),s(1)*s(2),/overwrite)
image = rotate(image,2)
image = reform(image,s(0),s(1),s(2),/overwrite)
*BUT* only for the case where you want to flip the images up-down.
I haven't tried this, so take it with a PINCH of salt......
Fergus Gallagher
British National Space Centre
|
|
|
Re: rotating 3d array: help for the braindead! [message #3733 is a reply to message #3576] |
Tue, 28 February 1995 03:19  |
pjclinch
Messages: 27 Registered: May 1993
|
Junior Member |
|
|
MEC (mark_cadwell@qmail4.sp.trw.com) wrote:
: I previously wrote:
: > I have a stack of MRI images that make up a 3d array, and I want to turn
: > all the constituent images over.
: > At the moment, I've got a FOR loop that goes through using
: >
: > ROTATE(image(*,*,i),2)
: >
: > on each one, but I'm convinced there must be a better way to do it in a
: > oner without the FOR loop to slow things down.
: There is a method of animation called double buffering where you plot an
: image to a virtual window, copy the virtual window to your main window,
: and while that is going on, you're drawing the next image to the virtual
: window again. The advantage of doing it this way is that plotting to
: virtual windows is much faster (at least in my machine) that plotting to
: visible windows, and copying from a virtual window to a visible window is
: also much faster that plotting. The result is a nice, smooth, and
: reasonably fast image rotation.
I'm not actually after an animated rotation here... My image stack is
just plain upside down, and I want to flip each image in the stack over
*before* I actually start looking at them.
The image stacks are 128 images, 256 pixels square each: takes quite a
bit of time to flip them all :-(
Pete.
--
Peter Clinch Dundee Teaching Hospitals NHS Trust
voice: 44 1382 660111 x 3637 snail: Directorate of Medical Physics
fax: 44 1382 640177 Ninewells Hospital
email: p.j.clinch@dundee.ac.uk Dundee DD1 9SY Scotland UK
|
|
|