<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Sergi,<br><br>I'll assume some points before put these solution:<br>1 - You have the coordinates;<br>2 - You was rescaled/shifted the image to view ( I think the solution can works if not shifted/rescaled too );<br>3 - You are using C++.<br><br>This piece of code will do it for you, and are based on another piece of code of vtkImagePlaneWidget class:<br><br><br>double YourClass::computeScalarValue( double *coords)<br>{<br> if(!ImageData || !coords ) return 0.0;<br><br><br> double tol2;<br> vtkCell *cell;<br> vtkPointData *pd;<br> int subId;<br> double pcoords[3], weights[8];<br><br><br> pd = ImageData->GetPointData();<br><br> vtkPointData* outPD = vtkPointData::New();<br>
outPD->InterpolateAllocate(pd, 1, 1);<br><br> tol2 = ImageData->GetLength();<br> tol2 = tol2 ? tol2*tol2 / 1000.0 : 0.001;<br><br> cell = ImageData->FindAndGetCell(coords,NULL,-1,tol2,subId,pcoords,weights);<br> if (cell)<br> {<br> outPD->InterpolatePoint(pd,0,cell->PointIds,weights);<br> return outPD->GetScalars()->GetTuple1(0);<br> } else {<br> return -1;<br> }<br><br> outPD->Delete();<br>}<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Mensagem original ----<br>De: Sergi Dote <sergidt@gmail.com><br>Para: vtkusers@vtk.org<br>Enviadas: Quinta-feira, 26 de Abril de 2007 9:08:02<br>Assunto: [vtkusers] gray value of image<br><br>Hello vtkUsers, I need your
knowledge:<br><br>I work with a volume (gray CT) and I want to get the gray value of a point of this volume specified by world coordinates; this is, for example I ask what is gray value of a point Xmin=
33.2 Xmax =123.2 Ymin=14.1 Ymax=15.6 Zmin=11 Zmax=11 and I need to have this value.<br><br>Somebody knows how can I do this?<br><br>thank you very much!!<br clear="all"><br>-- <br>.: Sergi Dote Teixidor :.
<div>_______________________________________________<br>This is the private VTK discussion list. <br>Please keep messages on-topic. Check the FAQ at: <a target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a target="_blank" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></div></div><br></div></div><br>__________________________________________________<br>Fale com seus amigos de graça com o novo Yahoo! Messenger <br>http://br.messenger.yahoo.com/ </body></html>