<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Emmanouil,<br>
<br>
Here is some sample code for you. The GetScalarPointer() method is the
correct one to use for accessing voxel (pixel) scalars:<br>
<br>
------------------<br>
unsigned char *writePointer = (unsigned char *) <br>
imageData->GetScalarPointer(<br>
xvalue,<br>
yvalue,<br>
zvalue);<br>
-------------------<br>
<br>
Now, the scalar value at (xvalue, yvalue, zvalue) is accessible via
*writePointer. For example:<br>
<br>
std::cout << "The scalar value is: " << *writePointer
<< std::endl;<br>
<br>
You may want to use templates to cast the scalar to the correct type,
or at least make sure you cast it manually to the correct type for each
vtkImageData instance.<br>
<br>
hth<br>
<br>
Marc<br>
<br>
<div class="moz-signature">-- <br>
<strong>Marc Cotran, MD</strong><br>
President<br>
<i>Identity Vision Systems Inc.</i><br>
<a class="moz-txt-link-abbreviated" href="http://www.ivsinfo.com">www.ivsinfo.com</a><br>
514.576.1976 direct<br>
450.441.1300 ext. 1143</div>
<br>
<br>
Emmanouil Moschidis wrote:
<blockquote cite="mid:316020.93420.qm@web36703.mail.mud.yahoo.com"
type="cite">Hi <br>
i am tryign to get the pixels from a vtkImageData but it seems that the
line <br>
<br>
myImage->GetPointData()->GetScalars()->GetTuple1(number); <br>
<br>
causes a run time error. number is an integer and myImage a pointer to
vtkImageData. Is there any problem with this method? <br>
<br>
Otherwise is there a better way of accessing the pixels of a
vtkImageData? I 've seen the GetScalarPointer() method but i am not
sure how to use it.<br>
<br>
Thanks <br>
<p> </p>
<hr size="1">Fussy? Opinionated? Impossible to please? Perfect. <a
moz-do-not-send="true"
href="http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7%20">Join
Yahoo!'s user panel</a> and lay it on us.
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
</body>
</html>