[vtkusers] Get pixel intensity

Torsten Schlumm torsten.schlumm at gmx.de
Sat Jul 22 05:20:52 EDT 2006


Andres,

dimensions[0] = size in x-direction (columns)
dimensions[1] = size in y-direction (rows)
dimensions[2] = size in z-direction (slices)

meaning the index of point(x,y,z) is x + (y * dimensions[0]) + (z *
dimensions[0] * dimensions[1])
or column + (row * numberOfColumns) + (slice * numberOfColumns *
numberOfRows)

hth

/torsten


Andres Munarriz wrote:

> Hi Chase,
>
> Thanks for your prompt reply.  I'm not quite sure I follow why the  
> 'z' coordinate should be multiplied by the y-dimension and the 'y'  
> coordinate added to the 'x' coordinate and then multiplied by the x- 
> dimension.
>
> Could you please elaborate?
>
>
> Regards,
> Andres E. Munarriz Soto
>
>
> On 21/07/2006, at 7:22PM, Chase Yarbrough wrote:
>
>> Hi Andres,
>>
>> Here is one way to do it:
>>
>> vtkImageData *foo;
>> int *dimensions = foo->GetDimensions();
>> pixelValue = foo->GetPointData()->GetScalars()->GetTuple1(x 
>> +y*dimensions[0]+z*dimensions[0]*dimensions[1]);
>>
>> Anyone have a better way?
>>
>> Chase Yarbrough
>>
>> Andres Munarriz wrote:
>>
>>> Hi everyone,
>>>
>>> I'm pretty sure someone has already posted a similar question if  
>>> not the same (for this I apologize), but I haven't been able to  
>>> find such post.  Is there a way to retrieve the pixel intensity at  
>>> a particular index from a vtkImageData object?  Under ITK one can  " 
>>> make" the index then get the pixelData from it.
>>>
>>>
>>> Thanks in advance,
>>>
>>> Andres E. Munarriz Soto
>>> _______________________________________________
>>> 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
>>>
>>
>
> _______________________________________________
> 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
>
>





More information about the vtkusers mailing list