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

Home » Public Forums » archive » Re: How to export programmatically a volume with IVOLUME to images
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: How to export programmatically a volume with IVOLUME to images [message #60321] Tue, 20 May 2008 05:38 Go to next message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<d088ae51-68be-4983-b361-666923cef317@8g2000hse.googlegroups.com>,
"yingjie, Peng" <yingjiepeng@yahoo.com> wrote:

> Dear all,
>
> I would like to make a short animation of my rotating volume data. I
> think this could be done by rotating the volume a small angle each
> time and export corresponding image and then put the images sequence
> together. One can use XVOLUME, XVOLUME_ROTATE and XVOLUME_WRITE_IMAGE
> to get this job done easily, however iVOLUME offers more possible
> choices of configurations, which I prefer to.
>
> I already figured out how to rotate the ivolume object
> programmatically by:
> idTool = itgetcurrent(TOOL=oTool)
> temp = oTool->FindIdentifiers('*DATA SPACE',/VISUALIZATIONS)
> idDataSpace = temp[0]
> oDataSpace = oTool->GetByIdentifier(idDataSpace)
> oDataSpace->GetProperty, PARENT=oDataSpaceRoot
> oDataSpaceRoot->Rotate, [0,0,1], 20
> oTool->RefreshCurrentWindow
>
> But after hours� attempt, I still do not know how to export the image
> from the ivolume. Of course I can choose �export� to file from the
> ivolume menu and then I have to do this hundreds of times to make a
> animation :(
> I found David had some similar explanations here:
> http://www.dfanning.com/itool_tips/newdata.html
> but it seems to me this will only work with iImage�
>
> I am not experienced at all with iTools Object Classes and any
> suggestions or clues would be greatly appreciated.
>
> with best regards,
> Yingjie

You can download my IDL library (bowman_lib.zip) from here

http://idl.tamu.edu/Downloads.html

It contains routines to do what you want.

Ken Bowman
Re: How to export programmatically a volume with IVOLUME to images [message #60330 is a reply to message #60321] Mon, 19 May 2008 20:12 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
yingjie, Peng wrote:
> Dear all,
>
> I would like to make a short animation of my rotating volume data. I
> think this could be done by rotating the volume a small angle each
> time and export corresponding image and then put the images sequence
> together. One can use XVOLUME, XVOLUME_ROTATE and XVOLUME_WRITE_IMAGE
> to get this job done easily, however iVOLUME offers more possible
> choices of configurations, which I prefer to.
>
> I already figured out how to rotate the ivolume object
> programmatically by:
> idTool = itgetcurrent(TOOL=oTool)
> temp = oTool->FindIdentifiers('*DATA SPACE',/VISUALIZATIONS)
> idDataSpace = temp[0]
> oDataSpace = oTool->GetByIdentifier(idDataSpace)
> oDataSpace->GetProperty, PARENT=oDataSpaceRoot
> oDataSpaceRoot->Rotate, [0,0,1], 20
> oTool->RefreshCurrentWindow
>
> But after hours� attempt, I still do not know how to export the image
> from the ivolume. Of course I can choose �export� to file from the
> ivolume menu and then I have to do this hundreds of times to make a
> animation :(
> I found David had some similar explanations here:
> http://www.dfanning.com/itool_tips/newdata.html
> but it seems to me this will only work with iImage�
>
> I am not experienced at all with iTools Object Classes and any
> suggestions or clues would be greatly appreciated.
>
> with best regards,
> Yingjie

Just get the iTools window object and ask for its data:

IDL> f = filepath('head.dat', subdir=['examples', 'data'])
IDL> head = bytarr(80, 100, 57)
IDL> openr, lun, f, /get_lun
IDL> readu, lun, head
IDL> free_lun, lun
IDL> ivolume, head ; hit the "Render" button after it comes up
IDL> toolId = itgetcurrent(tool=tool)
IDL> win = tool->getByIdentifier('/tools/volume tool/window')
IDL> help, win
WIN OBJREF = <ObjHeapVar16322(IDLITGRWINSCENE)>
IDL> win->getProperty, image_data=im
IDL> help, im
IM BYTE = Array[3, 824, 589]
IDL> window, xsize=824, ysize=589
IDL> tv, im, true=1

This could be made more robust by using findIdentifiers (like in you
example) to get the ID since it won't always be '/tools/volume
tool/window' (like if you have multiple iVolume tools open).

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
Re: How to export programmatically a volume with IVOLUME to images [message #60334 is a reply to message #60330] Mon, 19 May 2008 19:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
yingjie, Peng writes:

> I would like to make a short animation of my rotating volume data. I
> think this could be done by rotating the volume a small angle each
> time and export corresponding image and then put the images sequence
> together. One can use XVOLUME, XVOLUME_ROTATE and XVOLUME_WRITE_IMAGE
> to get this job done easily, however iVOLUME offers more possible
> choices of configurations, which I prefer to.
>
> I already figured out how to rotate the ivolume object
> programmatically by:
> idTool =3D itgetcurrent(TOOL=3DoTool)
> temp =3D oTool->FindIdentifiers('*DATA SPACE',/VISUALIZATIONS)
> idDataSpace =3D temp[0]
> oDataSpace =3D oTool->GetByIdentifier(idDataSpace)
> oDataSpace->GetProperty, PARENT=3DoDataSpaceRoot
> oDataSpaceRoot->Rotate, [0,0,1], 20
> oTool->RefreshCurrentWindow
>
> But after hours=92 attempt, I still do not know how to export the image
> from the ivolume. Of course I can choose =93export=94 to file from the
> ivolume menu and then I have to do this hundreds of times to make a
> animation :(
> I found David had some similar explanations here:
> http://www.dfanning.com/itool_tips/newdata.html
> but it seems to me this will only work with iImage=85
>
> I am not experienced at all with iTools Object Classes and any
> suggestions or clues would be greatly appreciated.

Somehow (I don't have the foggiest idea about how) you have
to get the ID of the draw widget the volume is displayed in.
From there you can get the window object:

Widget_Control, drawWidgetID, Get_Value=windowObject

Then, you can take a snapshot of the window as an image:

windowObject -> GetProperty, Image_Data=snapshot

From there, you can just write any kind of file you like:

Write_JPEG, 'frame_1.jpg', snapshot, TRUE=1

I guess the key would be figuring out how to get the draw
widget ID.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: How to export programmatically a volume with IVOLUME to images [message #60489 is a reply to message #60321] Tue, 20 May 2008 15:19 Go to previous message
yingjie, Peng is currently offline  yingjie, Peng
Messages: 11
Registered: March 2006
Junior Member
Dear all,

Thanks so much for all the kind suggestions and solutions.
Especially,
I found Ken Bowman’s library is really amazing. In the
iTools section, I see the procedure:


ITOOL_SPIN_MOVIE_KPB - spin an iTool view around an axis and save the
images to make a movie


exactly what I want to do! I would strongly recommend all IDL
developers to have a look at these wonderful sources:


Coyote's Guide to IDL Programming: http://www.dfanning.com/
Michael Galloy’s IDL Resources: http://michaelgalloy.com/
Ken Bowman’s IDL library: http://idl.tamu.edu/Downloads.html


Cheers,
Yingjie
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help with getting rid of a FOR loop
Next Topic: HDF_SD_ADDDATA with strings

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

Current Time: Wed Oct 08 13:49:49 PDT 2025

Total time taken to generate the page: 0.00711 seconds