comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: help with transformations and scaling

Re: help with transformations and scaling
type: item
description: Richard Tyc wrote: I forgot to add the example code. Here it is. ;*********************************************************** ************ Function ComputeBounds, HeadTarr s = size(HeadTArr) ind = where (HeadTArr gt 0) indz = ind/(s[1]*s[2]) indy = (ind-(indz*s[1]*s[2])) / s[1] indx = (ind-(indz*s[1]*s[2])) - (indy * s[1]) maxTz = max(indz) minTz = min(indz) boundt=[min(indx),min(indy),minTz,max(indx),max(indy),maxTz] return, boundt END ;*********************************************************** ************ Function CubeData,xdim,ydim,zdim testC = dist(xdim,1) testc = (testc/max(testc)) * 150.0 cube = bytarr(xdim,ydim,zdim) for i=0,zdim-1 do begin for j=0,ydim-1 do cube[*,j,i] = byte(testc) endfor cube = cube+100 return,cube END ; Here's the test sample code, I run it as main ; It is definitley NOT optimized yet for memory leaks etc. !! ; Changed transformations to global ! ;Pro testcutplaneNETPOST, oWindow ; This version draws cannula and its coordinatre system. ; The cannula here is variable based on xc,yc,zc ;volume data dimension DataDim = [20,20,10] xfac = 0.5 yfac = 0.5 zfac = 0.4 ; define cannula tip position xc = xfac*DataDim[0] yc = yfac*DataDim[1] zc = zfac*DataDim[2] cube = CubeData(DataDim[0],DataDim[1],DataDim[2]) boundT = computebounds(cube) s=size(cube) xs=s[1]-1 ys=s[2]-1 zs=s[3]-1 ; I changed it to this although it doesn't seem to matter LenVox = sqrt((xc*xs/DataDim[0])^2 + (yc*ys/DataDim[1])^2 + $ (zc*zs/DataDim[2])^2) cutplnVox = [(xc*xs/DataDim[0])/LenVox, (yc*ys/DataDim[1])/LenVox, $ (zc*zs/DataDim[2])/LenVox, -LenVox ] cpNorm = cutplnVox[0:2] cpNormCtr = [xc/s[1],yc/s[2],zc/s[3]] Scale3, XRange=[0,xs], YRange=[0,ys], ZRange=[0,zs] rh = fltarr(4,4) oView = OBJ_NEW('IDLgrView', color=[0,0,0],viewplane_rect=[0,0,1,1], $ dimensions=[512,512]) oModel = OBJ_NEW('IDLgrModel') oView->add,oModel oModelC = OBJ_NEW('IDLgrModel') oView->add,oModelC if (not obj_valid(oWindow)) then $ oWindow = OBJ_NEW('IDLgrWindow',dimensions=[512,512]) rgb = bytarr(256,3…
creator: Richard Tyc
date: 1999-06-25T07:00:00-00:00