[Paraview] VTK access from python

Pat Marion pat.marion at kitware.com
Tue Jan 29 20:19:20 EST 2013


That's true.  And I think it makes sense for ParaView to selectively import
only the parts of VTK that it needs to implement paraview.simple and
paraview.servermanager.

I find it annoying that paraview.vtk is not equivalent to the standard vtk
python.  If you run a script with pvpython or pvbatch, what yo you get when
you "import paraview.vtk" is not the same as if you ran the script with
vtkpython and did "import vtk".  I'd like to see that changed, so that you
can import the real vtk from pvbatch/pvpython.  Another issue is that if
you access a vtk object without importing the python module where the
object is defined, the object comes back as a "vtkObject", there is no
information about the derived class.  If you import the module afterward,
the object is still stuck as a vtkObject, I'm not sure if there is a remedy
for that.

Pat


On Wed, Jan 30, 2013 at 3:57 AM, Sean Ziegeler <
sean.ziegeler at nrlssc.navy.mil> wrote:

> FWIW, I've also found that only importing the VTK modules that one needs
> in a given script shaves off some time during the initialization of the
> script.
>
>
> On 01/29/13 06:50, Pat Marion wrote:
>
>> There's a lot of VTK python modules, and unfortunately they are not all
>> imported with you import paraview.vtk from ParaView's python console.
>>   But, all the python modules are shipped with ParaView, as far as I
>> know, they just aren't imported.  I wish there was an easy way to import
>> the full set of vtk python modules in ParaView, maybe someone else knows
>> a way?  The only way I know how to do it is to import the modules
>> manually.  For example, to get the IOXML module:
>>
>>  >>> from vtkIOXMLPython import *
>>
>> Or, you can create a new .py file (or edit the vtk/__init__.py file) to
>> import all the modules.  To find the __init__.py file:
>>
>>  >>> import paraview.vtk
>>  >>> print paraview.vtk.__file__ # this the path to a .pyc file, edit
>> the .py file in the same directory
>>
>>
>> Either edit the __init__.py file, or create a new file named like
>> vtkFull.py and add import statements like:  from <modulename> import *.
>> Here's a long list of all the modules I found, depending on which
>> version you have, you might have a different list:
>>
>>
>> from vtkCPTestDriverPython import *
>> from vtkChartsCorePython import *
>> from vtkCoProcessorPython import *
>> from vtkCommonColorPython import *
>> from vtkCommonComputationalGeometry**Python import *
>> from vtkCommonCorePython import *
>> from vtkCommonDataModelPython import *
>> from vtkCommonExecutionModelPython import *
>> from vtkCommonMathPython import *
>> from vtkCommonMiscPython import *
>> from vtkCommonSystemPython import *
>> from vtkCommonTransformsPython import *
>> from vtkDomainsChemistryPython import *
>> from vtkFiltersAMRPython import *
>> from vtkFiltersCorePython import *
>> from vtkFiltersCosmoPython import *
>> from vtkFiltersExtractionPython import *
>> from vtkFiltersFlowPathsPython import *
>> from vtkFiltersGeneralPython import *
>> from vtkFiltersGenericPython import *
>> from vtkFiltersGeometryPython import *
>> from vtkFiltersHybridPython import *
>> from vtkFiltersHyperTreePython import *
>> from vtkFiltersImagingPython import *
>> from vtkFiltersModelingPython import *
>> from vtkFiltersParallelPython import *
>> from vtkFiltersParallelStatisticsPy**thon import *
>> from vtkFiltersProgrammablePython import *
>> from vtkFiltersSourcesPython import *
>> from vtkFiltersStatisticsPython import *
>> from vtkFiltersTexturePython import *
>> from vtkFiltersVerdictPython import *
>> from vtkIOAMRPython import *
>> from vtkIOCorePython import *
>> from vtkIOEnSightPython import *
>> from vtkIOExodusPython import *
>> from vtkIOExportPython import *
>> from vtkIOGeometryPython import *
>> from vtkIOImagePython import *
>> from vtkIOImportPython import *
>> from vtkIOInfovisPython import *
>> from vtkIOLSDynaPython import *
>> from vtkIOLegacyPython import *
>> from vtkIOMoviePython import *
>> from vtkIONetCDFPython import *
>> from vtkIOPLYPython import *
>> from vtkIOParallelExodusPython import *
>> from vtkIOParallelLSDynaPython import *
>> from vtkIOParallelPython import *
>> from vtkIOVPICPython import *
>> from vtkIOXMLParserPython import *
>> from vtkIOXMLPython import *
>> from vtkIOXdmf2Python import *
>> from vtkImagingColorPython import *
>> from vtkImagingCorePython import *
>> from vtkImagingFourierPython import *
>> from vtkImagingGeneralPython import *
>> from vtkImagingHybridPython import *
>> from vtkImagingMorphologicalPython import *
>> from vtkImagingSourcesPython import *
>> from vtkInfovisCorePython import *
>> from vtkInfovisLayoutPython import *
>> from vtkInteractionImagePython import *
>> from vtkInteractionStylePython import *
>> from vtkInteractionWidgetsPython import *
>> from vtkPVClientServerCoreCorePytho**n import *
>> from vtkPVClientServerCoreDefaultPy**thon import *
>> from vtkPVClientServerCoreRendering**Python import *
>> from vtkPVCommonPython import *
>> from vtkPVServerImplementationCoreP**ython import *
>> from vtkPVServerImplementationDefau**ltPython import *
>> from vtkPVServerImplementationRende**ringPython import *
>> from vtkPVServerManagerApplicationP**ython import *
>> from vtkPVServerManagerCorePython import *
>> from vtkPVServerManagerDefaultPytho**n import *
>> from vtkPVServerManagerRenderingPyt**hon import *
>> from vtkPVVTKExtensionsCorePython import *
>> from vtkPVVTKExtensionsDefaultPytho**n import *
>> from vtkPVVTKExtensionsRenderingPyt**hon import *
>> from vtkPVVTKExtensionsWebGLExporte**rPython import *
>> from vtkParallelCorePython import *
>> from vtkRenderingAnnotationPython import *
>> from vtkRenderingContext2DPython import *
>> from vtkRenderingCorePython import *
>> from vtkRenderingFreeTypeOpenGLPyth**on import *
>> from vtkRenderingFreeTypePython import *
>> from vtkRenderingGL2PSPython import *
>> from vtkRenderingHybridOpenGLPython import *
>> from vtkRenderingLODPython import *
>> from vtkRenderingLabelPython import *
>> from vtkRenderingMatplotlibPython import *
>> from vtkRenderingOpenGLPython import *
>> from vtkRenderingParallelPython import *
>> from vtkRenderingVolumeAMRPython import *
>> from vtkRenderingVolumeOpenGLPython import *
>> from vtkRenderingVolumePython import *
>> from vtkTestingRenderingPython import *
>> from vtkViewsContext2DPython import *
>> from vtkViewsCorePython import *
>> from vtkViewsInfovisPython import *
>>
>>
>> Pat
>>
>> On Sun, Jan 27, 2013 at 4:02 AM, Demian Wassermann
>> <demian at bwh.harvard.edu <mailto:demian at bwh.harvard.edu**>> wrote:
>>
>>     Dear Paraview Users / Developers,
>>
>>     I have just started using version 3.98 and I must say I like it a lot.
>>
>>     However, on the binary distribution the number of vtk classes
>>     accessible through python scripting was greatly reduced with respect
>>     to the previous version.
>>
>>     I suspect that because it is now using the modularized VTK
>>     architecture as it says in the release notes:
>>
>>     “VTK was restructured to use a modularized approach for building
>>     various components, and ParaView's build infrastructure was revamped
>>     to make use of this. Users may now build variants of the ParaView
>>     library while choosing only modules of interest from VTK. This
>>     enables developers to build small, lightweight VTK and ParaView
>>     packages ideal for co-processing.”
>>
>>     Is there a way to re-eanable the full python library?
>>
>>
>>     Thanks in advance!
>>     --
>>     Demian Wassermann, PhD
>>     demian at bwh.harvard.edu <mailto:demian at bwh.harvard.edu**>
>>
>>     LMI / PNL / SPL Labs
>>     Harvard Medical School
>>     Brigham and Women's Hospital
>>     1249 Boylston, Boston, MA, USA
>>     http://lmi.bwh.harvard.edu/~**wassermann/<http://lmi.bwh.harvard.edu/~wassermann/>
>>
>>     ______________________________**_________________
>>     Powered by www.kitware.com <http://www.kitware.com>
>>
>>
>>     Visit other Kitware open-source projects at
>>     http://www.kitware.com/**opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>
>>     Please keep messages on-topic and check the ParaView Wiki at:
>>     http://paraview.org/Wiki/**ParaView<http://paraview.org/Wiki/ParaView>
>>
>>     Follow this link to subscribe/unsubscribe:
>>     http://www.paraview.org/**mailman/listinfo/paraview<http://www.paraview.org/mailman/listinfo/paraview>
>>
>>
>>
>>
>> ______________________________**_________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/**
>> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/**ParaView <http://paraview.org/Wiki/ParaView>
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/**mailman/listinfo/paraview<http://www.paraview.org/mailman/listinfo/paraview>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130130/c7ba4fa1/attachment-0001.htm>


More information about the ParaView mailing list