Re: shade_volume [message #9143] |
Fri, 30 May 1997 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Istvan Horvath writes:
> I use
>
> shade_volume, float(z), 1.5, v,p, /low
> tv, polyshade(v, p, /t3d)
>
> This works fine. So I got a 3D figure. My question:
> How can I plot x, y and z axises?
Here is an example of a program that will render a 3D
isosurface with axes. I do it in the Z-buffer. Notice
that you don't have to use the command:
TV, PolyShade(v, p, /T3D)
in the Z-Buffer. PolyShade does the rendering directly.
In fact, what is returned from the PolyShade function when
it is used in the Z-buffer is an integer!
Regards,
David
----------------------------------------------------------
PRO Example, data
; Get demo data set if necessary.
IF N_Params() EQ 0 THEN BEGIN
filename = Filepath(Subdir=['examples','data'], 'head.dat')
OpenR, lun, filename, /Get_Lun
data = BytArr(80, 100, 57)
ReadU, lun, data
Free_Lun, lun
ENDIF
; Get data ranges. (Dimensions for simplicity.)
s = Size(data)
xmax = s(1)
ymax = s(2)
zmax = s(3)
; Open a window for displaying the data.
Window, /Free, Title='Volume Rendering with Axes', $
XSize=400, YSize=400
thisDevice = !D.Name
ncolors = !D.N_Colors
; Do rendering in the Z-Buffer.
Set_Plot, 'Z'
Erase
Device, Set_Resolution=[400,400], Set_Colors=ncolors
; Draw the axes with the SURFACE command. Save T3D.
Surface, Dist(30), /NoData, XRange=[0,xmax], YRange=[0,ymax], $
ZRange=[0,zmax], /NoErase, /Save
; Render the volume.
Shade_Volume, data, 25, v, p, /Low
image = PolyShade(v, p, /T3D, XSize=400, YSize=400)
; Take a "snapshot" of the display window.
snapshot = TVRD()
Set_Plot, thisDevice
; Display the snapshop in the display window.
TV, snapshot
END
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
|
|
|