[vtkusers] changes from 4.x to 5.x

davelist at mac.com davelist at mac.com
Tue Sep 9 12:06:34 EDT 2008


On Sep 9, 2008, at 9:31 AM, Dave Reed wrote:

>
> On Sep 9, 2008, at 3:52 AM, Mathieu Malaterre wrote:
>
>> Dave,
>>
>> On Tue, Sep 9, 2008 at 12:04 AM, Dave Reed <davelist at mac.com> wrote:
>>>
>>> I'm getting back to using VTK after being gone for a while so I'm  
>>> trying to
>>> adjust to some of the changes between 4.x and 5.x. At the moment,  
>>> I have
>>> 5.0.3 on my Mac because that was the easiest to get working via  
>>> MacPorts.
>>>
>>> At the bottom of this message is some old Python code that worked  
>>> on 4.x and
>>> printed the number of polygons that were rendered. I've also tried  
>>> updating
>>> the code to use the SetInputConnection and GetOutputPort methods,  
>>> but that
>>> has no effect.
>>>
>>> With 5.0.3 on my system, it says GetNumberOfPolys is not a valid  
>>> attribute.
>>>
>>> The output says it's a vtkPolyData, but the Python dir command  
>>> doesn't list
>>> many of the vtkPolyData methods. Here is the output:
>>>
>>> vtkPolyData
>>> ['AddObserver', 'BreakOnError', 'DebugOff', 'DebugOn', 'FastDelete',
>>> 'GetAddressAsString', 'GetClassName', 'GetDebug',  
>>> 'GetGlobalWarningDisplay',
>>> 'GetMTime', 'GetReferenceCount', 'GlobalWarningDisplayOff',
>>> 'GlobalWarningDisplayOn', 'HasObserver', 'InvokeEvent', 'IsA',  
>>> 'IsTypeOf',
>>> 'Modified', 'NewInstance', 'PrintRevisions', 'Register',  
>>> 'RemoveObserver',
>>> 'RemoveObservers', 'SafeDownCast', 'SetDebug',  
>>> 'SetGlobalWarningDisplay',
>>> 'SetReferenceCount', 'UnRegister']
>>
>>
>> You are missing all of the specific vtkPolyData member functions.
>>
>> With VTK 5.2 I am getting:
>>
>> ['AddCellReference', 'AddReferenceToCell', 'Allocate', 'BuildCells',
>> 'BuildLinks', 'ComputeBounds', 'CopyCells', 'CopyStructure',
>> 'DeepCopy', 'DeleteCell', 'DeleteCells', 'DeleteLinks',  
>> 'DeletePoint',
>> 'GetActualMemorySize', 'GetCell', 'GetCellBounds',
>> 'GetCellEdgeNeighbors', 'GetCellNeighbors', 'GetCellPoints',
>> 'GetCellType', 'GetClassName', 'GetDataObjectType', 'GetGhostLevel',
>> 'GetLines', 'GetMaxCellSize', 'GetNumberOfCells', 'GetNumberOfLines',
>> 'GetNumberOfPieces', 'GetNumberOfPolys', 'GetNumberOfStrips',
>> 'GetNumberOfVerts', 'GetPiece', 'GetPointCells', 'GetPolys',
>> 'GetStrips', 'GetUpdateExtent', 'GetVerts', 'Initialize',
>> 'InsertNextCell', 'InsertNextLinkedPoint', 'IsA', 'IsEdge',
>> 'IsPointUsedByCell', 'IsTriangle', 'NewInstance',
>> 'RemoveCellReference', 'RemoveDeletedCells', 'RemoveGhostCells',
>> 'RemoveReferenceToCell', 'ReplaceCellPoint', 'Reset',
>> 'ResizeCellList', 'ReverseCell', 'SafeDownCast', 'SetLines',
>> 'SetPolys', 'SetStrips', 'SetVerts', 'ShallowCopy', 'Squeeze']
>>
>> I would think this is an issue with your MacPort package. Either  
>> raise
>> the question in there forums or try to rebuild VTK from scratch on
>> your system (if you have cmake on your system it should be easy).
>
>
> Thanks for letting me know it should work. I had installed 5.0.2  
> about two years ago on a Linux system at work using cmake and it  
> seems to have the same issue also so either there's some issues with  
> the early 5.0.x builds or I'm having the same build problem on both  
> systems (perhaps related to the Python bindings). I'm currently  
> trying to build 5.2 on my Mac directly (not via macports) so we'll  
> see if it works on that.
>
> Thanks,
> Dave

It's still not working for me with vtk 5.2 compiled (on OS X 10.5.4)  
using cmake directly instead of macports. While running make, it only  
went to 50%, but there were no errors reported and then I did a "make  
install". Any ideas what's wrong? I double-checked that it was  
importing the 5.2 libraries with my script - see attached file. Any  
other suggestions?


$ python medical1-numpolys.py
/usr/local/VTK/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/ 
libvtkCommonPython.so
/usr/local/VTK/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/ 
libvtkGraphicsPython.so
/usr/local/VTK/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/ 
libvtkRenderingPython.so
/usr/local/VTK/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/ 
libvtkIOPython.so
vtkPolyData
['AddObserver', 'BreakOnError', 'DebugOff', 'DebugOn', 'FastDelete',  
'GetAddressAsString', 'GetClassName', 'GetDebug',  
'GetGlobalWarningDisplay', 'GetMTime', 'GetReferenceCount',  
'GlobalWarningDisplayOff', 'GlobalWarningDisplayOn', 'HasObserver',  
'InvokeEvent', 'IsA', 'IsTypeOf', 'Modified', 'NewInstance',  
'PrintRevisions', 'Register', 'RemoveAllObservers', 'RemoveObserver',  
'RemoveObservers', 'SafeDownCast', 'SetDebug',  
'SetGlobalWarningDisplay', 'SetReferenceCount', 'UnRegister']
Traceback (most recent call last):
  File "medical1-numpolys.py", line 86, in <module>
    main(sys.argv)
  File "medical1-numpolys.py", line 79, in main
    print skin_mapper.GetInput().GetNumberOfPolys()
AttributeError: GetNumberOfPolys

Thanks,
Dave

-------------- next part --------------
A non-text attachment was scrubbed...
Name: medical1-numpolys.py
Type: text/x-python-script
Size: 2364 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080909/c1e9312a/attachment.bin>
-------------- next part --------------




More information about the vtkusers mailing list