[vtk-developers] Add GetPoint function to vtkStructuredGrid

David Gobbi david.gobbi at gmail.com
Fri Feb 5 17:15:23 EST 2010


The extents can become negative as a result of vtkImagePad, for
instance.  The only way to use it to pad on the bottom or the left is
by setting the OutputWholeExtent so that it starts at a negative
number.  Yikes!  Also any filters that do "extent translation" can
lead to negative extents.

The tests don't cover negative extents, so when they occur, it's
guaranteed that some downstream filter is gonna choke on them because
it "assumes" that extents are always positive.

   David


On Fri, Feb 5, 2010 at 2:55 PM, Berk Geveci <berk.geveci at kitware.com> wrote:
> Also, extents can be negative (don't ask me why).
>
> -berk
>
> On Fri, Feb 5, 2010 at 4:44 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> 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
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>
>



More information about the vtk-developers mailing list