3D VOLUME VISUALIZATION [message #34070] |
Wed, 19 February 2003 20:51  |
MC
Messages: 50 Registered: September 1996
|
Member |
|
|
A=array[100,80,160]
containing 0,1,2,3,10.
The numbers represent different materials within a solid.
Will like to visualize it in 3D.
Any suggestion on either program/code fragment which will produce nice
visualization? Also to do various cutting and slicing?
Tried XVOLUME but doesn't work (?) - got black screen.
Thanks,
Mark
|
|
|
Re: 3D VOLUME VISUALIZATION [message #34210 is a reply to message #34070] |
Thu, 20 February 2003 08:34   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
"MC" <markchan@shaw.ca> wrote in message
news:N9Z4a.285092$Yo4.11083327@news1.calgary.shaw.ca...
> A=array[100,80,160]
> containing 0,1,2,3,10.
> The numbers represent different materials within a solid.
>
> Will like to visualize it in 3D.
>
> Any suggestion on either program/code fragment which will produce nice
> visualization? Also to do various cutting and slicing?
>
> Tried XVOLUME but doesn't work (?) - got black screen.
>
> Thanks,
> Mark
Hi Mark,
XVolume works pretty well if the data values use more of the 0-255
range.
This is a random mix of the 0,1,2,3,10 values:
a = ([0B,1B,2B,3B,10B])[byte(randomu(seed,100,80,160)*5)]
XVolume, a ; Doesn't look like much
XVolume, a*25 ; Is much easier to work with
You have to work with Color and Opacity to really show it off, but does
this show up for you with what looks like a block of granite?
Cheers,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
|
|
|
Re: 3D VOLUME VISUALIZATION [message #34211 is a reply to message #34070] |
Thu, 20 February 2003 08:25   |
s[1]
Messages: 21 Registered: December 2002
|
Junior Member |
|
|
Hi,
I suppose XVOLUME renders a black screen because the highest value in your
data set is 10, rescale it to 0..255 and you should see something with
XVOLUME.
Hope this helps,
Sebastian
On Thu, 20 Feb 2003, MC wrote:
> A=array[100,80,160]
> containing 0,1,2,3,10.
> The numbers represent different materials within a solid.
>
> Will like to visualize it in 3D.
>
> Any suggestion on either program/code fragment which will produce nice
> visualization? Also to do various cutting and slicing?
>
> Tried XVOLUME but doesn't work (?) - got black screen.
>
> Thanks,
> Mark
>
>
>
|
|
|
Re: 3D VOLUME VISUALIZATION [message #42099 is a reply to message #34070] |
Mon, 03 January 2005 13:55   |
idle
Messages: 4 Registered: January 2005
|
Junior Member |
|
|
Antonio Santiago wrote:
> idle wrote:
>> Is there any way to make the volume transparent so one can see
through
>> the volume instead only the front plane? Thanks!
>>
>
>
> I supossing you are talking about IDLgrVolume. The RGB_TABLE0 is the
> color table (256x3 array) for your DATA0 data and OPACITY_TABLE0 is
the
> opacity (256 array) for every element of the RGB_TABLE0 color table.
> Then, for every color you can asign an opacity ("alpha channel").
>
> Bye.
Thanks. I met another problem as I first deal with 3D visulation. I can
show the data on the screen, but when I use OBJ_NEW('IDLgrClipboard')
to try to save it to a file as postscript, the eps file is just a dark
images. By the way, how to save the image as a jpeg file?
following is part of the code to draw and save the image.
;----------------------------
loadct,13
tvlct, r, g, b,/get
rgb=bytarr(256,3)
rgb(*,0)=r & rgb(*,1)=g & rgb(*,2)=b
myvolume = OBJ_NEW('IDLgrVolume', da)
cc=[-0.5,1.0/64.0]
myvolume->SetProperty,XCOORD_CONV=cc,YCOORD_CONV=cc,ZCOORD_CONV=cc
mywindow = OBJ_NEW('IDLgrWindow',DIMENSIONS=[400,400])
;mywindow = OBJ_NEW('IDLgrClipboard')
myview = OBJ_NEW('IDLgrView',VIEWPLANE_RECT=[-1,-1,2,2], $
ZCLIP=[2.0,-2.0],color=[50,50,50])
mymodel = OBJ_NEW('IDLgrModel')
myview->Add,mymodel
mymodel->Add,myvolume
mymodel->rotate,[1,1,1],20
opac = BYTARR(256)
opac[0:127] = BINDGEN(128)/8
myvolume->SetProperty,OPACITY_TABLE0=opac
myvolume->SetProperty,RGB_TABLE0=rgb
mywindow->Draw,myview
;mywindow->Draw,myview,VECTOR=1,POSTS=1,FILE='rgb.eps'
;mywindow->Draw,myview,VECTOR=0,POSTS=0,FILE='a.bmp'
|
|
|
|
|
Re: 3D VOLUME VISUALIZATION [message #42198 is a reply to message #42099] |
Mon, 03 January 2005 14:38   |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"idle" <tangsk@astro.umass.edu> wrote in message
news:1104789321.046793.159050@f14g2000cwb.googlegroups.com.. .
>
> Antonio Santiago wrote:
>> idle wrote:
>>> Is there any way to make the volume transparent so one can see
> through
>>> the volume instead only the front plane? Thanks!
>>>
>>
>>
>> I supossing you are talking about IDLgrVolume. The RGB_TABLE0 is the
>> color table (256x3 array) for your DATA0 data and OPACITY_TABLE0 is
> the
>> opacity (256 array) for every element of the RGB_TABLE0 color table.
>> Then, for every color you can asign an opacity ("alpha channel").
>>
>> Bye.
>
> Thanks. I met another problem as I first deal with 3D visulation. I can
> show the data on the screen, but when I use OBJ_NEW('IDLgrClipboard')
> to try to save it to a file as postscript, the eps file is just a dark
> images.
It is documented that volume object won't render when using vector output.
While a volume object ultimately is rendered as a 2D image, and 2D images
can be rendered with vector output, IDL still does not render volumes in
vector output. This is because per-pixel depth information is maintained in
a volume object so that surfaces and other geometric primitives can be
rendered correctly with volume data on devices that have depth buffers.
Vector output cannot use depth buffering.
> By the way, how to save the image as a jpeg file?
You could render your scene into an IDLgrBuffer object, read the pixel data,
and then use WRITE_JPEG to create a jpeg file.
>
> following is part of the code to draw and save the image.
> ;----------------------------
>
> loadct,13
> tvlct, r, g, b,/get
> rgb=bytarr(256,3)
> rgb(*,0)=r & rgb(*,1)=g & rgb(*,2)=b
>
> myvolume = OBJ_NEW('IDLgrVolume', da)
> cc=[-0.5,1.0/64.0]
> myvolume->SetProperty,XCOORD_CONV=cc,YCOORD_CONV=cc,ZCOORD_CONV=cc
> mywindow = OBJ_NEW('IDLgrWindow',DIMENSIONS=[400,400])
> ;mywindow = OBJ_NEW('IDLgrClipboard')
>
> myview = OBJ_NEW('IDLgrView',VIEWPLANE_RECT=[-1,-1,2,2], $
> ZCLIP=[2.0,-2.0],color=[50,50,50])
> mymodel = OBJ_NEW('IDLgrModel')
> myview->Add,mymodel
> mymodel->Add,myvolume
> mymodel->rotate,[1,1,1],20
> opac = BYTARR(256)
> opac[0:127] = BINDGEN(128)/8
> myvolume->SetProperty,OPACITY_TABLE0=opac
> myvolume->SetProperty,RGB_TABLE0=rgb
> mywindow->Draw,myview
> ;mywindow->Draw,myview,VECTOR=1,POSTS=1,FILE='rgb.eps'
> ;mywindow->Draw,myview,VECTOR=0,POSTS=0,FILE='a.bmp'
>
|
|
|
Re: 3D volume Visualization [message #86619 is a reply to message #34070] |
Sat, 23 November 2013 05:46   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Amin Farhang writes:
> I have some gas density in a room where at any point in space I know it's density (x,y,z,rho), so my input data are as like as:
>
> x1 y1 z1 rho1
> x2 y2 z2 rho2
> x3 y3 z3 rho3
> .
> .
> .
>
>
> How can I have 3D volume plot of this gas density?
> is it possible I have interactively control rotation?
> and is it possible I paint the clouds according to its density?
>
> I use IDL7
If you are going to use IDL 7, then you probably have no real choice
except to use the IDLgrVolume object. Pass it to XObView to gain
interactive rotational ability. To create your 3D grid, you could use
Interpolate or maybe even JD Smith's Hist_ND.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
Re: 3D volume Visualization [message #86811 is a reply to message #34070] |
Wed, 04 December 2013 16:17   |
amin farhang
Messages: 39 Registered: November 2010
|
Member |
|
|
Hi,
Thanks for your answer. but now the question is how we could paint a 3d isocontour to a desired color? for instance in below example is it possible to color the cloud to red? and how I could add axies to plot?
IDL> RESTORE, FILEPATH('clouds3d.dat', SUBDIR=['examples','data'])
IDL> SHADE_VOLUME, clouds, 0.1, v, p, /LOW
IDL> s = SIZE(clouds)
IDL> SCALE3, XRANGE=[0,S[1]], YRANGE=[0,S[2]], $
IDL> ZRANGE=[0,S[3]], AX=0, AZ=45
IDL> TV, POLYSHADE(v, p, /T3D)
Cheers,
|
|
|
Re: 3D volume Visualization [message #86812 is a reply to message #86811] |
Wed, 04 December 2013 16:39  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Amin Farhang writes:
> Thanks for your answer. but now the question is how we could paint a 3d isocontour to a desired color? for instance in below example is it possible to color the cloud to red? and how I could add axies to plot?
>
> IDL> RESTORE, FILEPATH('clouds3d.dat', SUBDIR=['examples','data'])
> IDL> SHADE_VOLUME, clouds, 0.1, v, p, /LOW
> IDL> s = SIZE(clouds)
> IDL> SCALE3, XRANGE=[0,S[1]], YRANGE=[0,S[2]], $
> IDL> ZRANGE=[0,S[3]], AX=0, AZ=45
> IDL> TV, POLYSHADE(v, p, /T3D)
This is *really* hard to do in direct graphics. Wouldn't you rather do
this in the true 3d coordinate system of object graphics? It would be so
much easier. Plus, you could rotate it to your heart's content.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|