[vtkusers] Picking DICOM pixel (scalar) value

David Doria daviddoria at gmail.com
Tue Aug 20 09:54:33 EDT 2013


On Sun, Aug 18, 2013 at 1:12 PM, Manuel Corrales
<manuelcorrales at gmail.com> wrote:
> Hello,
>
> I am trying to pick a "pixel" value from a series of DICOM image. I am able
> to pick a pixel using the mouse and the get the value using this:
>
> (short*)vtkImageData->GetScalarPointer(indices[0], indices[1], indices[2]);
>
>
> Now I have to iterate trought all data of the image and I am attempting to
> do that by getting the dataArray of the image like this:
>
> vtkDataArray* array = imageData->GetPointData()->GetScalars()
>
>
> But the, when I try to fetch the information from the array, the
> getTuple(index) method is returning a double* instead of short*. I have
> probably a missunderstanding of some concept here, can you help me?
>
> Regards,
> Manuel.

I think you can just do:

  vtkShortArray* array = vtkShortArray::SafeDownCast (
imageData->GetPointData()->GetScalars() );

David



More information about the vtkusers mailing list