[vtk-developers] Add GetPoint function to vtkStructuredGrid

David Gobbi david.gobbi at gmail.com
Fri Feb 5 16:44:35 EST 2010


On Fri, Feb 5, 2010 at 2:10 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Fri, Feb 5, 2010 at 1:47 PM, Francois Bertel
> <francois.bertel at kitware.com> wrote:
>>
>> Use vtkStructuredData::ComputePointIdForExtent() to get the point id,
>> then get the coordinates on the vtkPoints object.
>>
>> and your code is wrong:
>> 1.you passes arguments x,y,z per value
>> 2.you check and compute against dimensions instead of extent.
>
> I didn't say we had to cut and paste this... this is the idea of bouncing
> things off the mailing list rather than just committing the, right?
> What is wrong with passing 3 int's by value? I thought you didn't have to
> pass by reference unless the object was large (so you don't make a local
> copy).
> You recommend changing GetDimensions to GetExtent, but isn't it the
> dimensions of the grid that we are interested in a case like this? The
> function seems to behave properly.
> I still think this would be useful, as clearly no one would know to call
> ComputePointIdForExtent and then get the coordinates of the resulting
> object. Even if they knew to do that, it is very awkward.
> Thanks,
>
> David

David, you should always use GetExtent, particularly when doing bounds
checks.  The first point in the dataset is at
IJK=(extent[0],extent[2],extent[3]), which is not guaranteed to be
IJK=(0,0,0).

The worst thing is that _most_ vtkImageData are base zero, meaning
that they start at (0,0,0) as long the whole image is updated at each
stage of the pipeline.  But as soon as one filter updates just one or
two slices instead of updating the whole imagedata, code that was
written to use "Dimension" instead of "Extent" no longer works.

So, I beg you, please study the meaning of "extents" how streaming
works in the VTK pipeline.

   David



More information about the vtk-developers mailing list