[vtkusers] vtkImageData positioning..

Louis Desjardins lost_bits1110 at hotmail.com
Tue Aug 29 02:52:07 EDT 2006


Hi Jiantao,

To access the world coordinate location of each voxel in the image data, I 
just use the GetCell function.
So its something like the following:

int subID, cellNum;
double *paraCoords = new double[3];
double *xyzCoords  = new double[3];
double *vtkcellweights = new double[4];

for (cellNum = 0; cellNum < NumberOfImageDataVoxels; cellNum++ )
{
subId = ImageData->GetCell( cellNum )->GetParametricCenter(paraCoords);
int &subIDadd = subID;
ImageData->GetCell(cellNum)->EvaluateLocation(subIDadd, paraCoords, 
xyzCoords, vtkcellweights);

// now the world coordinate is located in xyzCoords

  // .. or if you wanted to set the scalar value in a cell, you can do:
  ImageData->GetCellData()->GetScalars()->SetValue(cellNum, somevalue);
}

Hope this is what you were looking for,

LD


>From: "Jiantao Pu" <medicalimagesrc at gmail.com>
>To: "Louis Desjardins" <lost_bits1110 at hotmail.com>
>Subject: Re: [vtkusers] vtkImageData positioning..
>Date: Fri, 18 Aug 2006 18:13:10 -0700
>
>Hi, LD,
>
>Can you tell me how to access the voxel value?
>
>thanks,
>-Patric
>
>
>
>On 7/31/06, Louis Desjardins <lost_bits1110 at hotmail.com> wrote:
>>
>>Hi experts!
>>
>>I'd like to know if its possilbe to have more flexible positioning of the
>>vtkImageData dataset...
>>
>>Basically I need some type of plane whose position I can manipulate so
>>that
>>it can constantly move about relative to my camera position (this way the
>>plane looks like its perfectly still on the screen). I was originally
>>using
>>vtkPlaneSource whose position was easy to move by setting the Point1,
>>Point2
>>and Origin values.  My PlaneSource consisted of a large number of quad
>>cells
>>(which I would then probe and set to a particular colour via a
>>lookuptable).
>>This however was causing real performance issues with my application.
>>
>>Sp I'd like to use ImageData, so I can probe each of its voxels, but I
>>just
>>don't know how to set its position in space..
>>
>>Thank you in advance for your assistance!!
>>LD
>>
>>_________________________________________________________________
>>Don't just search. Find. Check out the new MSN Search!
>>http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>>
>>_______________________________________________
>>This is the private VTK discussion list.
>>Please keep messages on-topic. Check the FAQ at:
>>http://www.vtk.org/Wiki/VTK_FAQ
>>Follow this link to subscribe/unsubscribe:
>>http://www.vtk.org/mailman/listinfo/vtkusers
>>

_________________________________________________________________
Get the new Windows Live Messenger!   
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline




More information about the vtkusers mailing list