[Paraview] python/VTK errors in Paraview

pat marion pat.marion at kitware.com
Fri Aug 21 11:54:16 EDT 2009


Karl,

I think you'll find that you still don't get the same results as in
the GUI.  The GUI also handles the creation of a default color lookup
table and opacity function when you switch to volume rendering.  Here
is some code to do the same in python.  It's a mix of paraview.simple
API and paraview.servermanager API... so the code isn't too pretty at
the moment...

In the following example, the scalar value 37 is set to an opacity
value of 0 and scalar value 270 is set to opacity value 0.8:

Wavelet()
rep = Show()
rep.ColorArrayName = "RTData"
rep.Representation = "Volume"

lut = CreateLookupTable()
lut.RGBPoints = [37, 1, 0, 0, 270, 0, 0, 1]
rep.LookupTable = lut

func = servermanager.ProxyManager().NewProxy("piecewise_functions",
"PiecewiseFunction")
func.GetProperty("Points").SetElements4(37, 0, 270, 0.8)
func.UpdateVTKObjects()
rep.ScalarOpacityFunction = func

Render()



On Fri, Aug 21, 2009 at 11:48 AM, pat marion<pat.marion at kitware.com> wrote:
> Hi Karl,
>
> The volume representation needs a set of valid scalars.  In the GUI,
> the color-by scalars are automatically switched for you when you
> change the representation combobox to Volume.  In python you'll need
> to do something like this:
>
> SetDisplayProperties(reader, ColorArrayName='SomeVariableName')
>
> Where SomeVariableName is the scalar array you want to use for volume
> rendering.  Try doing this before setting Representation='Volume'.
>
> Pat
>
> On Fri, Aug 21, 2009 at 11:41 AM, Karl Battams<karlbattams at gmail.com> wrote:
>> Thanks!  That did it!
>>
>> Next problem, along similar lines.  I want to simply volume render a vtk
>> file I have.  If I do everything from within the paraview app, it works
>> fine.  But if I try to do the following from the python shell (or pvpython)
>> it seg faults on me:
>>
>>>>> reader=LegacyVTKReader(FileNames="/home/battams/model.vtk")
>>>>> Show(reader)
>>>>> SetDisplayProperties(reader,Representation='Volume')
>>
>> Here's the error I get in my terminal:
>>
>> ERROR: In
>> /home/battams/Builds/Paraview3/ParaView3/VTK/VolumeRendering/vtkFixedPointVolumeRayCastMapper.cxx,
>> line 1467
>> vtkFixedPointVolumeRayCastMapper (0x7fc7b7368010): Cell Scalars not
>> supported
>> [3]    Segmentation fault            paraview
>>
>> It looks to me like the problem is my model because of the "Cell scalars not
>> supported" message.  But I can load/view it fine if I just use the ParaView
>> GUI.
>>
>> Apologies in advance if I'm making some sort of stupid beginner mistake...
>>
>> ~~Karl
>>
>> On Fri, Aug 21, 2009 at 11:08 AM, Utkarsh Ayachit
>> <utkarsh.ayachit at kitware.com> wrote:
>>>
>>> When you creating the readers using python shell from the GUI (not
>>> pvpython or pvbatch), it's recommended that you set the FileName in
>>> the constructor itself. So try:
>>>
>>> > reader = LegacyVTKReader(FileNames="foo.vtk")
>>>
>>> Utkarsh
>>>
>>> On Fri, Aug 21, 2009 at 10:04 AM, Karl Battams<karlbattams at gmail.com>
>>> wrote:
>>> > Hi,
>>> >
>>> > I'm using the latest CVS build of Paraview (on Ubuntu) and am getting
>>> > some
>>> > errors when I try to do python scripting from the Python shell.  I start
>>> > ParaView and bring up the python shell, and type the simple command:
>>> >
>>> >>>> reader=LegacyVTKReader()
>>> > As soon as I enter this command, the error console pops up saying:
>>> >
>>> > ERROR: In
>>> > /home/battams/Builds/Paraview3/ParaView3/VTK/Filtering/vtkExecutive.cxx,
>>> > line 757
>>> >
>>> > vtkCompositeDataPipeline (0x253f0b0): Algorithm
>>> > vtkFileSeriesReader(0x2560aa0) returned failure for request:
>>> > vtkInformation
>>> > (0xd1e190)
>>> >
>>> > Debug: Off
>>> >
>>> > Modified Time: 197255
>>> >
>>> > Reference Count: 1
>>> >
>>> > Registered Events: (none)
>>> >
>>> > Request: REQUEST_DATA_OBJECT
>>> >
>>> > ALGORITHM_AFTER_FORWARD: 1
>>> >
>>> > FORWARD_DIRECTION: 0
>>> >
>>> > It has a similar error for vtkPDataSetReader.  It then has the lines:
>>> >
>>> > ERROR: In
>>> >
>>> > /home/battams/Builds/Paraview3/ParaView3/Servers/Common/vtkSelfConnection.cxx,
>>> > line 147
>>> > vtkSelfConnection (0x14ef4f0): Failed to locate object with ID: 154
>>> >
>>> > ERROR: In
>>> >
>>> > /home/battams/Builds/Paraview3/ParaView3/Servers/ServerManager/vtkSMOutputPort.cxx,
>>> > line 293
>>> >
>>> > vtkSMOutputPort (0x152f200): Missing data information.
>>> >
>>> > And then some more output like the top part.
>>> >
>>> > Now what seems odd to me is that it is complaining about errors in my
>>> > build
>>> > directory, but I installed Paraview to /usr/local.  But the same error
>>> > persists, even if I actually remove the build directory before running
>>> > paraview.  But perhaps I'm misunderstanding something.  Regardless, I
>>> > get
>>> > the above errors when python scripting.  Any ideas?
>>> >
>>> > Also, in my CMakeOutput.log file I see the message:
>>> >
>>> > Determining if glXGetProcAddressARB exists in GL/glx.h FALSE
>>> >
>>> > ...leading to an error...
>>> >
>>> >
>>> > /home/battams/Builds/Paraview3/ParaView3/VTK/Rendering/CheckglXGetProcAddressARB.cxx:
>>> > In function 'int main(int, char**)':
>>> >
>>> > /home/battams/Builds/Paraview3/ParaView3/VTK/Rendering/CheckglXGetProcAddressARB.cxx:33:
>>> > error: 'glXGetProcAddressARB' was not declared in this scope
>>> > make[1]: ***
>>> > [CMakeFiles/cmTryCompileExec.dir/CheckglXGetProcAddressARB.cxx.o] Error
>>> > 1
>>> > make[1]: Leaving directory
>>> > `/home/battams/Builds/paraview-bin/CMakeFiles/CMakeTmp'
>>> > make: *** [cmTryCompileExec/fast] Error 2
>>> >
>>> > Is this related?  Or an entirely different problem?  (or not a problem
>>> > at
>>> > all?)
>>> >
>>> > Thanks!
>>> >
>>> > ~~Karl
>>> >
>>> > _______________________________________________
>>> > Powered by www.kitware.com
>>> >
>>> > Visit other Kitware open-source projects at
>>> > http://www.kitware.com/opensource/opensource.html
>>> >
>>> > Please keep messages on-topic and check the ParaView Wiki at:
>>> > http://paraview.org/Wiki/ParaView
>>> >
>>> > Follow this link to subscribe/unsubscribe:
>>> > 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
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>>
>


More information about the ParaView mailing list