Hi.
i'm trying to generate 3D volume. I use the functions SHADE_VOLUME,
POLYSHADE etc to display 3D image. I tried the trackball object to
rotate the 3D object. When i used a cube, sphere or any 3D given
example from IDL and use trackball on that image, the object rotates
perfectly. When i try to use my 3D object that was created after
processing of the data, the image stretches everytime i rotate it in
different directions. the image i'm using is a 512x512x21. it
stretches along the z-axis and i have no idea why it streches. Can
anybody help me with this. Please...
The code i wrote is like this:
#### MAIN CODE ####
restore, filename = 'headimage1'
image = bytscl(C1)
images = image[*,*,*]
images = images GE 30
imsize = size(images)
images = congrid(bytscl(images),512,512,512)
SHADE_VOLUME, images, 30, v, p, /LOW, /VERBOSE
xdim = 512
ydim = 512
wBase = Widget_Base(/Column)
wDraw = Widget_Draw(wBase, XSIZE = xdim, YSIZE = ydim, GRAPHICS_LEVEL
= 2, /BUTTON_EVENTS, /MOTION_EVENTS, /EXPOSE_EVENTS, RETAIN = 0)
Widget_Control, wBase, /Realize
Widget_Control, wDraw, Get_Value = oWindow
oPolygon = Obj_New('IDLgrPolygon',DATA = v, POLY = p, STYLE = 2, COLOR
= [255,255,255])
oTrackball = Obj_New('Trackball', [xdim/2, ydim/2], xdim/2)
oView = Obj_New('IDLgrView', VIEWPLANE_RECT = [-1,-1,2,2], ZCLIP =
[4,-4], COLOR = [0,0,0])
oModel = Obj_New('IDLgrModel')
oLight = Obj_New('IDLgrLight', LOCATION = [2,2,1], TYPE = 1)
oModel -> Add, oLight
oLight = Obj_New('IDLgrLight', TYPE = 0, INTENSITY = 0.5, COLOR =
[255,255,255])
oModel -> Add, oLight
oModel1 = Obj_New('IDLgrModel')
oModel1 -> Add, oPolygon
Xmin = min(v[0,*])
Xmax = max(v[0,*])
Ymin = min(v[1,*])
Ymax = max(v[1,*])
Zmin = min(v[2,*])
Zmax = max(v[2,*])
xs = [(-Xmin)/(Xmax-Xmin), 1/(Xmax - Xmin)]
ys = [(-Ymin)/(Ymax-Ymin), 1/(Ymax - Ymin)]
zs = [(-Zmin)/(Zmax-Zmin), 1/(Zmax - Zmin)]
;print,Zmin, Zmax, 0.33/(Zmax-Zmin)
;zs = [0, 0.33/(Zmax - Zmin)]
oPolygon -> SetProperty, XCOORD_CONV = xs, YCOORD_CONV = ys,
ZCOORD_CONV = zs
oModel -> Add, oModel1
oView -> Add, oModel
oWindow -> Draw, oView
END
########
-thanx.
|