[vtk-developers] GetOutput().GetWholeExtent()

David Gobbi david.gobbi at gmail.com
Wed Mar 28 17:46:51 EDT 2012


You mean a generic "pointer" object that can be used from Python.

In Python 3, there is a special object called "memoryview" that can be
used for this purpose, so that's the direction that I've considered
going.  I'd like to avoid generic pointer wrapping, because it makes
it too easy to crash the program from python.  I know that SWIG wraps
pointers, but I've made a conscious choice not to do the same for the
VTK wrappers.

 - David


On Wed, Mar 28, 2012 at 3:32 PM, Pat Marion <pat.marion at kitware.com> wrote:
> Hi David,
>
> What about making a generic way to access these kinds of arrays, given a
> length argument, using ctypes or numpy?
>
> Something like:
>
> length = info.Length(key)
> myarray = vtk.array_from_pointer(info.Get(key), length)
>
>
> Pat
>
>
> On Wed, Mar 28, 2012 at 4:08 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> Hmm, I just noticed something in my own code.  The following method
>> isn't wrapped, because it returns a bare pointer.  As a result the
>> WHOLE_EXTENT key can't be used with Get:
>>
>> int * vtkInformation::Get(vtkInformationIntegerVectorKey *);
>>
>> But I think that I can add a wrapper hint to get it working... the
>> wrappers can internally query the Length() method to figure out what
>> number of values to return.
>>
>>  - David
>>
>>
>> On Fri, Mar 23, 2012 at 10:44 AM, Philippe Pebay
>> <philippe.pebay at kitware.com> wrote:
>> > Thanks Bill.
>> >
>> > Philippe
>> >
>> >
>> > On Fri, Mar 23, 2012 at 4:49 PM, Bill Lorensen <bill.lorensen at gmail.com>
>> > wrote:
>> >>
>> >> This page has a suggested replacement.
>> >> http://vtk.org/Wiki/VTK/VTK6/Migration/WikiExamples#Improve
>> >>
>> >> On Fri, Mar 23, 2012 at 8:23 AM, Philippe Pebay
>> >> <philippe.pebay at kitware.com> wrote:
>> >> > Hello all
>> >> >
>> >> > GetOutput().GetWholeExtent() does not work any longer in VTK 6. I
>> >> > have q
>> >> > boatload of vtkpython scripts using this! Does anyone know what the
>> >> > quick
>> >> > fix is?
>> >> >
>> >> > Thanks
>> >> > Philippe
>> _______________________________________________
>> 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