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

Home » Public Forums » archive » Re: Stretching of image
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: Stretching of image [message #33586] Wed, 15 January 2003 11:16
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
At what point do things go wrong?

Are you confident your polygon object is correct? Use XOBJVIEW to view
oModel1 right after you add oPolygon to it and again after you apply your
coord conversions (XOBJVIEW, oModel1, /BLOCK). Since you can view other
objects without distortion my guess is that your polygon object is
incorrect.

It would be helpful if you posted a simple working example that demonstrates
the problem using data available in the idl distribution.

-Rick


"New2IDL" wrote
> 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.
Re: Stretching of image [message #33588 is a reply to message #33586] Wed, 15 January 2003 08:59 Go to previous message
David Burridge is currently offline  David Burridge
Messages: 33
Registered: January 1998
Member
Hi,

Am I getting deja-vu here or what? Wasn't there something *very* similar to
this posted recently? Anyhow...

"New2IDL" <biomedthesis2002@yahoo.com> wrote in message
news:162586e3.0301150823.4d98ab7@posting.google.com...
> 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)

I think this is as far as we need to go. If you Congrid the data like this,
you've created 512 samples in the Z direction where there used to be 21.
This is why it stetches. You can either modify the offending Congrid, or
modify the ZCOORD_CONV later on to compress the 256 back into the space
taken up by the 21. I would probably attempt the former, as the size of the
data is less.

Hope this helps,

Dave

--
David Burridge
Burridge Computing, 18 The Green South
Warborough, Oxon, OX10 7DN
England
Tel: +44 (0) 1865 858279, Email: davidb@burridgecomputing.co.uk



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.404 / Virus Database: 228 - Release Date: 15/10/2002
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stretching of image
Next Topic: Looking for a data analysis package - need advise

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

Current Time: Wed Oct 08 13:44:14 PDT 2025

Total time taken to generate the page: 0.00488 seconds