[vtkusers] Pick a pixel in DICOM series
Dean Inglis
inglis.dl at gmail.com
Mon Jun 24 14:04:07 EDT 2013
Hi Manuel,
the example code in
Wiki/VTK/Examples/Cxx/Images/PickingAPixel
provides the world coordinates of the picked location. If you want image
i,j,k
indices, you have to convert those coordinates yourself using the image
data's
origin and spacing information.
double* o = image->GetOrigin();
double* s = image->GetSpacing();
int x = static_cast<int>( ( x_world_pos - o[0] ) / s[0] + 0.5 );
do similar calcs for y and z.
regards,
Dean
On Thu, Jun 20, 2013 at 6:39 PM, Manuel Corrales
<manuelcorrales at gmail.com>wrote:
> Hello,
>
> I am displaying a DICOM series using vtk and "navigating" through the
> slices using mouse interaction. I need to pick a pixel from the displayed
> image, and I expected to get something like an array of coordinates e.g:
> (142, 342, 13) assuming I can use this to actually fetch the data from the
> vtkImageData structure.
>
> I tried to use the PickPixel and PickPixel examples from the wiki, but I
> get coordinates with negative numbers
>
> (Location: ( -49.3894, 37.2297, -97.2094 ))
>
> and don't know what to do with that. My goal is to be able to pick a
> pixel, get a coordinate and being able to use that coordinate to fetch the
> pixel color from the vtkImageData.
>
> Any hints?
>
> Regards,
> Manuel.
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130624/7c3fde87/attachment.htm>
More information about the vtkusers
mailing list