[Paraview] Python Programmable Filter Time Series Source

2017-12-02 Thread Bane Sullivan
Here is an example of a programmable filter vis XML that I want to simply
print off the various file names or give me and ability to read the file
series. I have this python programmable filter set up to work when I click
File->Open in ParaView. I have the ability to then chose file series from
the file prompt. How might I make a programmable filter via XML attributes
so that it can handle file series.


  

  
  
  

  
  

  

  
  
The value of this property determines the dataset
type
for the output of the programmable filter.
  



  


  

  

  

  

  

This property contains the text of a python program
that
the programmable source runs.


  

  

This property is a python script that is executed
during
the RequestInformation pipeline pass. Use this to provide
information
such as WHOLE_EXTENT to the pipeline downstream.
  


 

___
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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview


[Paraview] Python programmable filter to process results over time

2017-11-21 Thread Messner, Mark Christian
I'm trying to make a programmable filter to do some post-processing that 
involves accumulating data from multiple time steps.


This isn't really what I'm trying to do but as an example of something that 
would get me most of the way there say I want to sum up the values of a field 
over a range of time steps and then display that cumulative sum as a field 
itself.


My googling seems to indicate this is now possible with the programmable filter 
but hasn't turned up any simple example of how to do it.  Does someone have 
such an example or can someone point me in the right direction on how to do 
this (if it's indeed possible)?


Thanks,


Mark
___
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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview


[Paraview] Python Programmable Filter: Reading unsigned short TIFFs into vtkImageData

2014-11-17 Thread Allan Lyckegaard
Hi paraview list

Based on this blog post: http://www.kitware.com/blog/home/post/534, I am
trying to make a Python plugin (source) that reads a stack of unsigned
short TIFFs (uint16) and outputs 3D unsigned short imagedata in Paraview.

Assigning the geometry to the imagedata works fine (see def
RequestInformation). My problem is that the values of the voxels in the
imagedata is not assigned correct (see def RequestData). According to
Paraview information tab the data type is unsigned short, but when reading
in a known TIFF (8x8 with uint16 values 1..64) the values of the imagedata
are not correct.

I suspect the last line array.SetValue(offset+v, vals.GetValue(v)) is the
problem. Does the vals.GetValue(v) get casted into a Python type int before
stored in the array?

When I print vals.GetValue(v) to a textfile, I can see that I read the
correct values from the TIFF.

Can anybody see what the problem is?

Cheers,
Allan


def RequestData():
import os
from paraview import vtk
from vtk import vtkTIFFReader # this reader does not exist in paraview??

filepath = Filepath # path to file
filestr = Filename  # string containing filename and %d
first = First   # first image, e.g. 0 or 1
last = Last # last image
N = last-first+1# number of images

# Get a vtkImageData object for the output
pdo = self.GetOutput()

print 'read'
# set up reader
reader = vtkTIFFReader()
filename = filestr % first
reader.SetFileName(os.path.join(filepath, filename))
reader.Update()

# get tiff info
ext = reader.GetDataExtent()

# set up output volume
pdo.SetExtent(0, ext[1], 0, ext[3], 0, N-1)
#pdo.SetDimensions(ext[1]+1,ext[3]+1,N)
pdo.SetOrigin(0,0,0)
pdo.SetSpacing(1,1,1)
pdo.AllocateScalars(vtk.VTK_UNSIGNED_SHORT,1)

# temporary array for voxel values
array = vtk.vtkUnsignedShortArray()
array.SetName('Voxels')
array.SetNumberOfComponents(1)
#array.SetNumberOfTuples(pdo.GetNumberOfPoints())
array.SetNumberOfValues(pdo.GetNumberOfPoints())
pdo.GetPointData().AddArray(array)

# fill array with tiffs
for i in range(N):
filename = filestr % (first+i)
print filename
reader.SetFileName(os.path.join(filepath, filename))
reader.Update()
image = reader.GetOutput()
vals = image.GetPointData().GetArray('Tiff Scalars')
offset = i*N
for v in range((ext[0]+1)*(ext[1]+1)):
print vals.GetValue(v)
array.SetValue(offset+v, vals.GetValue(v))


def RequestInformation():
import os
from paraview import vtk, util
from vtk import vtkTIFFReader

filepath = Filepath # path to file
filestr = Filename  # string containing filename and %d
first = First   # first image, e.g. 0 or 1
last = Last # last image

# set up reader
reader = vtkTIFFReader()
filename = filestr % first
reader.SetFileName(os.path.join(filepath, filename))
reader.Update()

# get tiff info
ext = reader.GetDataExtent()

# update extent information
util.SetOutputWholeExtent(self, [0, ext[1], 0, ext[3], 0, last-first])
___
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://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] python programmable filter via xml with multiple input

2014-09-30 Thread Utkarsh Ayachit
Ah, sorry I missed that. Yea, if you want to simply use the
vtkPythonProgrammableFilter, I'm afraid you'll have to stick with 1
input port accepting multiple connections, rather than separate input
ports. Thus, you'll need to change your XML to just have 1
InputProperty, however you can set the multiple_input attribute to
make to accept multiple input connections on the same port.

  InputProperty clean_command=RemoveAllInputs
 command=AddInputConnection
 multiple_input=1
 name=Input
 ...
  /InputProperty

Hope that helps.

Utkarsh


On Mon, Sep 29, 2014 at 6:35 PM, Fraser Callaghan
fraser.callag...@sydney.edu.au wrote:
 Thanks for the clarification. I had tried this with the following error:
 vtkPythonProgrammableFilter (0x5458a60): Attempt to connect input port
 index 1 for an algorithm with 1 input ports.

 I gather that 'SetNumberOfInputPorts()' should be called in the
 constructor of the filter, which I gather is governed by the xml file?

 If so, how can I expose editing of the algorithm constructor via the xml
 file?

 Thanks,
 Fraser




 On Mon, 2014-09-29 at 08:48 -0400, Utkarsh Ayachit wrote:
 In your example, your XML is setup to provide the inputs on multiple
 ports, while you're code is expecting multiple connections on same
 port. Use the following script, instead.

 print self.GetInputDataObject(0, 0).GetNumberOfPoints()
 print self.GetInputDataObject(1, 0).GetNumberOfPoints()

 Utkarsh

 On Sat, Sep 27, 2014 at 8:10 AM, Fraser Callaghan
 fraser.callag...@sydney.edu.au wrote:
  Hi,
 
  I am able to run a python programmable filter accessing multiple inputs 
  selected from the pipe line e.g:
  #
  numInputs = self.GetNumberOfInputConnections(0)
  for i in range(numInputs):
   print self.GetInputDataObject(0,i).GetNumberOfPoints()
  ##
 
  I am able to use the xml format to define multiple inputs in a cleaner 
  way, but can not access the input data (example below).
  Changing command value does not help.
  How should I be accessing the inputs available from the xml setup?
 
  Thanks for the help,
  Fraser
 
  xml file:
 
  ServerManagerConfiguration
ProxyGroup name=filters
  !-- 
  == --
  SourceProxy name=MyFilter class=vtkPythonProgrammableFilter 
  label=MyFilter
Documentation
   long_help=long help.
   short_help=short help.
/Documentation
 
InputProperty
   name=Input0
 port_index=0
   command=SetInputConnection
  ProxyGroupDomain name=groups
Group name=sources/
Group name=filters/
  /ProxyGroupDomain
  DataTypeDomain name=input_type
DataType value=vtkPolyData/
  /DataTypeDomain
  Documentation
Input data 0.
  /Documentation
/InputProperty
 
InputProperty
   name=Input1
 port_index=1
   command=SetInputConnection
  ProxyGroupDomain name=groups
Group name=sources/
Group name=filters/
  /ProxyGroupDomain
  DataTypeDomain name=input_type
DataType value=vtkPolyData/
  /DataTypeDomain
  Documentation
Input data 1
  /Documentation
/InputProperty
 
!-- Output data type: vtkPolyData --
StringVectorProperty
  name=Script
  command=SetScript
  number_of_elements=1
  default_values=print 'Filter Working'#xA;print 
  self.GetInputDataObject(0,0)#xA;#prints polydata#xA;print 
  self.GetInputDataObject(0,1)#xA;#prints None#xA;#xA;
  panel_visibility=advanced
  Hints
   Widget type=multi_line/
 /Hints
DocumentationThis property contains the text of a python program 
  that
the programmable source runs./Documentation
/StringVectorProperty
 
  /SourceProxy
  !-- End LandmarkTransformFilter --
/ProxyGroup
!-- End Filters Group --
  /ServerManagerConfiguration
 
 
 
  Error on loading:
 
  ERROR: In 
  /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/ExecutionModel/vtkAlgorithm.cxx,
   line 893
  vtkPythonProgrammableFilter (0x56aff30): Attempt to connect input port 
  index 1 for an algorithm with 1 input ports.
  ___
  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://public.kitware.com/mailman/listinfo/paraview

 --
 Dr Fraser Callaghan
 Research Fellow
 Sydney Translational Imaging Laboratory
 Charles Perkins Centre
 The University of Sydney
 NSW 2006 Australia
 p: 02 8627 1700
 e: 

Re: [Paraview] python programmable filter via xml with multiple input

2014-09-29 Thread Utkarsh Ayachit
In your example, your XML is setup to provide the inputs on multiple
ports, while you're code is expecting multiple connections on same
port. Use the following script, instead.

print self.GetInputDataObject(0, 0).GetNumberOfPoints()
print self.GetInputDataObject(1, 0).GetNumberOfPoints()

Utkarsh

On Sat, Sep 27, 2014 at 8:10 AM, Fraser Callaghan
fraser.callag...@sydney.edu.au wrote:
 Hi,

 I am able to run a python programmable filter accessing multiple inputs 
 selected from the pipe line e.g:
 #
 numInputs = self.GetNumberOfInputConnections(0)
 for i in range(numInputs):
  print self.GetInputDataObject(0,i).GetNumberOfPoints()
 ##

 I am able to use the xml format to define multiple inputs in a cleaner way, 
 but can not access the input data (example below).
 Changing command value does not help.
 How should I be accessing the inputs available from the xml setup?

 Thanks for the help,
 Fraser

 xml file:

 ServerManagerConfiguration
   ProxyGroup name=filters
 !-- == 
 --
 SourceProxy name=MyFilter class=vtkPythonProgrammableFilter 
 label=MyFilter
   Documentation
  long_help=long help.
  short_help=short help.
   /Documentation

   InputProperty
  name=Input0
port_index=0
  command=SetInputConnection
 ProxyGroupDomain name=groups
   Group name=sources/
   Group name=filters/
 /ProxyGroupDomain
 DataTypeDomain name=input_type
   DataType value=vtkPolyData/
 /DataTypeDomain
 Documentation
   Input data 0.
 /Documentation
   /InputProperty

   InputProperty
  name=Input1
port_index=1
  command=SetInputConnection
 ProxyGroupDomain name=groups
   Group name=sources/
   Group name=filters/
 /ProxyGroupDomain
 DataTypeDomain name=input_type
   DataType value=vtkPolyData/
 /DataTypeDomain
 Documentation
   Input data 1
 /Documentation
   /InputProperty

   !-- Output data type: vtkPolyData --
   StringVectorProperty
 name=Script
 command=SetScript
 number_of_elements=1
 default_values=print 'Filter Working'#xA;print 
 self.GetInputDataObject(0,0)#xA;#prints polydata#xA;print 
 self.GetInputDataObject(0,1)#xA;#prints None#xA;#xA;
 panel_visibility=advanced
 Hints
  Widget type=multi_line/
/Hints
   DocumentationThis property contains the text of a python program that
   the programmable source runs./Documentation
   /StringVectorProperty

 /SourceProxy
 !-- End LandmarkTransformFilter --
   /ProxyGroup
   !-- End Filters Group --
 /ServerManagerConfiguration



 Error on loading:

 ERROR: In 
 /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/ExecutionModel/vtkAlgorithm.cxx,
  line 893
 vtkPythonProgrammableFilter (0x56aff30): Attempt to connect input port index 
 1 for an algorithm with 1 input ports.
 ___
 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://public.kitware.com/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://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] python programmable filter via xml with multiple input

2014-09-29 Thread Fraser Callaghan
Thanks for the clarification. I had tried this with the following error:
vtkPythonProgrammableFilter (0x5458a60): Attempt to connect input port
index 1 for an algorithm with 1 input ports.

I gather that 'SetNumberOfInputPorts()' should be called in the
constructor of the filter, which I gather is governed by the xml file?

If so, how can I expose editing of the algorithm constructor via the xml
file? 

Thanks,
Fraser




On Mon, 2014-09-29 at 08:48 -0400, Utkarsh Ayachit wrote:
 In your example, your XML is setup to provide the inputs on multiple
 ports, while you're code is expecting multiple connections on same
 port. Use the following script, instead.
 
 print self.GetInputDataObject(0, 0).GetNumberOfPoints()
 print self.GetInputDataObject(1, 0).GetNumberOfPoints()
 
 Utkarsh
 
 On Sat, Sep 27, 2014 at 8:10 AM, Fraser Callaghan
 fraser.callag...@sydney.edu.au wrote:
  Hi,
 
  I am able to run a python programmable filter accessing multiple inputs 
  selected from the pipe line e.g:
  #
  numInputs = self.GetNumberOfInputConnections(0)
  for i in range(numInputs):
   print self.GetInputDataObject(0,i).GetNumberOfPoints()
  ##
 
  I am able to use the xml format to define multiple inputs in a cleaner way, 
  but can not access the input data (example below).
  Changing command value does not help.
  How should I be accessing the inputs available from the xml setup?
 
  Thanks for the help,
  Fraser
 
  xml file:
 
  ServerManagerConfiguration
ProxyGroup name=filters
  !-- == 
  --
  SourceProxy name=MyFilter class=vtkPythonProgrammableFilter 
  label=MyFilter
Documentation
   long_help=long help.
   short_help=short help.
/Documentation
 
InputProperty
   name=Input0
 port_index=0
   command=SetInputConnection
  ProxyGroupDomain name=groups
Group name=sources/
Group name=filters/
  /ProxyGroupDomain
  DataTypeDomain name=input_type
DataType value=vtkPolyData/
  /DataTypeDomain
  Documentation
Input data 0.
  /Documentation
/InputProperty
 
InputProperty
   name=Input1
 port_index=1
   command=SetInputConnection
  ProxyGroupDomain name=groups
Group name=sources/
Group name=filters/
  /ProxyGroupDomain
  DataTypeDomain name=input_type
DataType value=vtkPolyData/
  /DataTypeDomain
  Documentation
Input data 1
  /Documentation
/InputProperty
 
!-- Output data type: vtkPolyData --
StringVectorProperty
  name=Script
  command=SetScript
  number_of_elements=1
  default_values=print 'Filter Working'#xA;print 
  self.GetInputDataObject(0,0)#xA;#prints polydata#xA;print 
  self.GetInputDataObject(0,1)#xA;#prints None#xA;#xA;
  panel_visibility=advanced
  Hints
   Widget type=multi_line/
 /Hints
DocumentationThis property contains the text of a python program 
  that
the programmable source runs./Documentation
/StringVectorProperty
 
  /SourceProxy
  !-- End LandmarkTransformFilter --
/ProxyGroup
!-- End Filters Group --
  /ServerManagerConfiguration
 
 
 
  Error on loading:
 
  ERROR: In 
  /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/ExecutionModel/vtkAlgorithm.cxx,
   line 893
  vtkPythonProgrammableFilter (0x56aff30): Attempt to connect input port 
  index 1 for an algorithm with 1 input ports.
  ___
  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://public.kitware.com/mailman/listinfo/paraview

-- 
Dr Fraser Callaghan
Research Fellow
Sydney Translational Imaging Laboratory
Charles Perkins Centre
The University of Sydney
NSW 2006 Australia
p: 02 8627 1700
e: fraser.callag...@sydney.edu.au
___
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://public.kitware.com/mailman/listinfo/paraview


[Paraview] python programmable filter via xml with multiple input

2014-09-27 Thread Fraser Callaghan
Hi, 

I am able to run a python programmable filter accessing multiple inputs 
selected from the pipe line e.g:
#
numInputs = self.GetNumberOfInputConnections(0)
for i in range(numInputs):
 print self.GetInputDataObject(0,i).GetNumberOfPoints()
##

I am able to use the xml format to define multiple inputs in a cleaner way, but 
can not access the input data (example below). 
Changing command value does not help. 
How should I be accessing the inputs available from the xml setup? 

Thanks for the help,
Fraser

xml file:

ServerManagerConfiguration
  ProxyGroup name=filters
!-- == --
SourceProxy name=MyFilter class=vtkPythonProgrammableFilter 
label=MyFilter
  Documentation
 long_help=long help.
 short_help=short help.
  /Documentation
 
  InputProperty
 name=Input0
   port_index=0
 command=SetInputConnection
ProxyGroupDomain name=groups
  Group name=sources/
  Group name=filters/
/ProxyGroupDomain
DataTypeDomain name=input_type
  DataType value=vtkPolyData/
/DataTypeDomain
Documentation
  Input data 0.
/Documentation
  /InputProperty
 
  InputProperty
 name=Input1
   port_index=1
 command=SetInputConnection
ProxyGroupDomain name=groups
  Group name=sources/
  Group name=filters/
/ProxyGroupDomain
DataTypeDomain name=input_type
  DataType value=vtkPolyData/
/DataTypeDomain
Documentation
  Input data 1
/Documentation
  /InputProperty

  !-- Output data type: vtkPolyData --
  StringVectorProperty
name=Script
command=SetScript
number_of_elements=1
default_values=print 'Filter Working'#xA;print 
self.GetInputDataObject(0,0)#xA;#prints polydata#xA;print 
self.GetInputDataObject(0,1)#xA;#prints None#xA;#xA;
panel_visibility=advanced
Hints
 Widget type=multi_line/
   /Hints
  DocumentationThis property contains the text of a python program that
  the programmable source runs./Documentation
  /StringVectorProperty

/SourceProxy
!-- End LandmarkTransformFilter --
  /ProxyGroup
  !-- End Filters Group --
/ServerManagerConfiguration



Error on loading:

ERROR: In 
/home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/ExecutionModel/vtkAlgorithm.cxx,
 line 893
vtkPythonProgrammableFilter (0x56aff30): Attempt to connect input port index 1 
for an algorithm with 1 input ports.
___
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://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] Python Programmable Filter: Get Filename of Import filter

2011-11-28 Thread Markus Fuger

Hi Pat,

Thank you for your hint! Unfortunately I would need one more step:
The reason is that the last filter after the while loop will return a
vtkFileSeriesReader where I can't find or access the file information
property.
Looking at the doxygen documentation it in principle should have, but
perhaps not everything is wrapped into the ParaView VTK module.

Markus

 From: pat.mar...@kitware.com
 Date: Wed, 23 Nov 2011 16:28:15 -0500
 Subject: Re: [Paraview] Python Programmable Filter: Get Filename of Import 
 filter
 To: m_fu...@hotmail.com
 CC: paraview@paraview.org
 
 Hi Markus,
 
 You can walk up the filter pipeline from the python programmable
 filter like this:
 
 
 filter = self
 
 while filter.GetInput():
   filter = filter.GetInput().GetProducerPort().GetProducer()
 
 print filter.GetClassName()
 
 
 
 This is technique is also discouraged :)  Filters should be self
 contained algorithms and that do not make assumptions about their
 upstream connections.  But, if it works, it works!
 
 Pat
 
 On Wed, Nov 23, 2011 at 2:47 PM, Markus Fuger m_fu...@hotmail.com wrote:
  Hello,
 
  it seems if my question formulated in a previous thread
  (http://www.paraview.org/pipermail/paraview/2011-November/023318.html) did
  not really decribe what I needed.
 
  I do like to get the information of the
  ImportFilter.GetPropertyValue('FileNameInfo') in a Programmable Filter,
  namely the filename (and directory) of the recent file in a file series.
  (I believe that I can get to the most upper filter by a while loop. But to
  apply that scheme I would first of all need the filter object of the
  programmable filer)
 
  On the previous thread I was blamed to not follow the seperation of the
  client - server. Due to the fact, that both (at least for the moment) run on
  the same maschine, this should not be the largest problem.
 
  Thank you in advance,
  Markus
 
  ___
  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


Re: [Paraview] Python Programmable Filter: Get Filename of Import filter

2011-11-28 Thread pat marion
That's right, you're missing the python bindings for
vtkFileSeriesReader.  You can get them by importing the proper python
bindings library.  Depending on your version of paraview, it will be:

import libvtkPVVTKExtensionsPython

or for paraview 3.10 and earlier:

import libvtkPVFiltersPython

Pat

On Mon, Nov 28, 2011 at 5:36 AM, Markus Fuger m_fu...@hotmail.com wrote:
 Hi Pat,

 Thank you for your hint! Unfortunately I would need one more step:
 The reason is that the last filter after the while loop will return a
 vtkFileSeriesReader where I can't find or access the file information
 property.
 Looking at the doxygen documentation it in principle should have, but
 perhaps not everything is wrapped into the ParaView VTK module.

 Markus

 From: pat.mar...@kitware.com
 Date: Wed, 23 Nov 2011 16:28:15 -0500
 Subject: Re: [Paraview] Python Programmable Filter: Get Filename of Import
 filter
 To: m_fu...@hotmail.com
 CC: paraview@paraview.org

 Hi Markus,

 You can walk up the filter pipeline from the python programmable
 filter like this:


 filter = self

 while filter.GetInput():
 filter = filter.GetInput().GetProducerPort().GetProducer()

 print filter.GetClassName()



 This is technique is also discouraged :) Filters should be self
 contained algorithms and that do not make assumptions about their
 upstream connections. But, if it works, it works!

 Pat

 On Wed, Nov 23, 2011 at 2:47 PM, Markus Fuger m_fu...@hotmail.com wrote:
  Hello,
 
  it seems if my question formulated in a previous thread
  (http://www.paraview.org/pipermail/paraview/2011-November/023318.html)
  did
  not really decribe what I needed.
 
  I do like to get the information of the
  ImportFilter.GetPropertyValue('FileNameInfo') in a Programmable Filter,
  namely the filename (and directory) of the recent file in a file series.
  (I believe that I can get to the most upper filter by a while loop. But
  to
  apply that scheme I would first of all need the filter object of the
  programmable filer)
 
  On the previous thread I was blamed to not follow the seperation of the
  client - server. Due to the fact, that both (at least for the moment)
  run on
  the same maschine, this should not be the largest problem.
 
  Thank you in advance,
  Markus
 
  ___
  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


___
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


[Paraview] Python Programmable Filter: Get Filename of Import filter

2011-11-23 Thread Markus Fuger

Hello,

it seems if my question formulated in a previous thread 
(http://www.paraview.org/pipermail/paraview/2011-November/023318.html) did not 
really decribe what I needed.

I do like to get the information of the 
ImportFilter.GetPropertyValue('FileNameInfo') in a Programmable Filter, namely 
the filename (and directory) of the recent file in a file series.
(I believe that I can get to the most upper filter by a while loop. But to 
apply that scheme I would first of all need the filter object of the 
programmable filer)

On the previous thread I was blamed to not follow the seperation of the client 
- server. Due to the fact, that both (at least for the moment) run on the same 
maschine, this should not be the largest problem.

Thank you in advance,
Markus
  ___
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


[Paraview] Python Programmable Filter

2010-04-19 Thread Favre Jean
Hello

Can one write a Python Programmable Filter with multiple outputs?

I tried the obvious self.SetNumberOfOutputPorts(2), which complained, and in 
any case, I wonder how it would interact with the GUI option which defines the 
output Data Set Type. Since there is a single option, I guess I wouldn't be 
able to define two different ports with different types.

Another output option would be a CompositeDataSet with 2 datasets, but it seems 
the GUI does not let me define the output type to be vtkCompositeDataSet?

Am I forced to go back to a C++ filter? 

-
Jean M. Favre
Swiss National Supercomputing Center
___
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


Re: [Paraview] Python Programmable Filter

2010-04-19 Thread Utkarsh Ayachit
No, it's not possible to write a python programmable filter with
multiple output ports. The number of output ports needs to be set in
the constructor of the class itself which is too early to be able to
set by the user from the panel for any filter. Workaround is producing
a multi-block.

Utkarsh



On Mon, Apr 19, 2010 at 10:05 AM, Favre  Jean jfa...@cscs.ch wrote:
 Hello

 Can one write a Python Programmable Filter with multiple outputs?

 I tried the obvious self.SetNumberOfOutputPorts(2), which complained, and in 
 any case, I wonder how it would interact with the GUI option which defines 
 the output Data Set Type. Since there is a single option, I guess I wouldn't 
 be able to define two different ports with different types.

 Another output option would be a CompositeDataSet with 2 datasets, but it 
 seems the GUI does not let me define the output type to be 
 vtkCompositeDataSet?

 Am I forced to go back to a C++ filter?

 -
 Jean M. Favre
 Swiss National Supercomputing Center
 ___
 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


Re: [Paraview] python programmable filter

2009-05-11 Thread John Biddiscombe


What does //BTX and //ETX means 

Begin TCL Exclude
End TCL Exclude.

VTK was originally wrapped for use with TCL -hence the name choice. The 
original parser code used BTX/ETX to mark pieces that couldn't be 
wrapped and should be skipped.



? how to know if a method is automaticlly or not ?


Look at the source code. You can usually guess which function are not 
likely to be wrapped. If they have pointers to structs etc they are 
usually not wrapped.


JB



Thanks,
Nehme
 
On Sun, 10 May 2009 08:10:09 +0200 (CEST)

 Jean Favre jfa...@cscs.ch wrote:


On 10, May 2009 03:38 AM, Nehme Bilal nbi...@mirarco.org wrote:


Hi,
I am using vtkKdTree in a python programmable filter. I
would like to use:
void vtkKdTree::FindPointsWithinRadius(double R,
const double x[3],
vtkIdList* result)



the method is not available. It is enclosed into a //BTX //ETX in the
source code of VTK/Filtering/vtkKdTree.h and does not get automatically
wrapped by Python.

Jean --
Swiss National Supercomputer Center



___
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



--
John Biddiscombe,email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland  | Fax:  +41 (91) 610.82.82


___
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


Re: [Paraview] python programmable filter

2009-05-10 Thread Jean Favre

On 10, May 2009 03:38 AM, Nehme Bilal nbi...@mirarco.org wrote:

Hi,
I am using vtkKdTree in a python programmable filter. I
would like to use:
void vtkKdTree::FindPointsWithinRadius(double R,
const double x[3],
vtkIdList* result)


the method is not available. It is enclosed into a //BTX //ETX in the
source code of VTK/Filtering/vtkKdTree.h and does not get automatically
wrapped by Python.

Jean --
Swiss National Supercomputer Center

___
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


Re: [Paraview] python programmable filter

2009-05-10 Thread Nehme Bilal

Thank you Jean.
What does //BTX and //ETX means ? how to know if a method 
is automaticlly or not ?


Thanks,
Nehme
 
On Sun, 10 May 2009 08:10:09 +0200 (CEST)

 Jean Favre jfa...@cscs.ch wrote:


On 10, May 2009 03:38 AM, Nehme Bilal 
nbi...@mirarco.org wrote:



Hi,
I am using vtkKdTree in a python programmable filter. I
would like to use:
void vtkKdTree::FindPointsWithinRadius(double R,
const double x[3],
vtkIdList* result)



the method is not available. It is enclosed into a //BTX 
//ETX in the
source code of VTK/Filtering/vtkKdTree.h and does not 
get automatically

wrapped by Python.

Jean --
Swiss National Supercomputer Center



___
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


[Paraview] python programmable filter

2009-05-09 Thread Nehme Bilal

Hi,
I am using vtkKdTree in a python programmable filter. I 
would like to use:

void vtkKdTree::FindPointsWithinRadius(double R,
  const double x[3],
  vtkIdList* result)

but I don't know how to write it in python. I tried the 
following :

coord = (687856,539156,269)
result = vtk.vtkIdList()
kdTree.FindPointsWithinRadius(100, coord, result)

but this doesn't work.

Thank you.
___
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


[Paraview] Python Programmable Filter

2008-11-13 Thread Jacques Papper
Hi Berk,

I am trying out your suggestion of merging arrays :

input0 = self.GetInputDataObject(0,0)
input1 = self.GetInputDataObject(0,1)
output = self.GetOutputDataObject(0)
output.GetPointData().AddArray(input0.GetPointData().GetArray(pressure1))
output.GetPointData().AddArray(input1.GetPointData().GetArray(pressure2))

but I get the following error message :

  File string, line 2, in module
  File string, line 4, in RequestData
AttributeError: GetPointData

I also tried just using the programmable filter on one source and with the
following code, and  I get the same error :

input0=self.GetInputDataObject(0,0)
input0.GetPointData()

I am using version 3.4.0
___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] Python Programmable Filter

2008-11-13 Thread Jacques Papper
Here is what I am doing at the moment.
-Load geometry 1
-Extract wing block

-Load geometry 2
-Extract wing block

Then use the resample filter with wing1 as input and wing2 as source
(this works)

The last bit is missing (that is merging the data from wing2 with the
resampled data)

Jacques

2008/11/13 Berk Geveci [EMAIL PROTECTED]

 Programmable filter can still be made to work. Do the datasets have
 multiple parts? I am not sure how resampling would work with multiple
 parts. It is impossible to guess which parts map to which parts...

 -berk

 On Thu, Nov 13, 2008 at 8:28 AM, Jacques Papper
 [EMAIL PROTECTED] wrote:
  They are multi-block datasets from Ensight Reader.
  Is there another way of dealing with this then ?
  Jacques
 
  2008/11/13 Berk Geveci [EMAIL PROTECTED]
 
  Are the inputs multi-block datasets by any chance?
 
 
  -berk
 
  On Thu, Nov 13, 2008 at 6:03 AM, Jacques Papper
  [EMAIL PROTECTED] wrote:
   Hi Berk,
  
   I am trying out your suggestion of merging arrays :
  
   input0 = self.GetInputDataObject(0,0)
   input1 = self.GetInputDataObject(0,1)
   output = self.GetOutputDataObject(0)
  
  
 output.GetPointData().AddArray(input0.GetPointData().GetArray(pressure1))
  
  
 output.GetPointData().AddArray(input1.GetPointData().GetArray(pressure2))
  
   but I get the following error message :
  
 File string, line 2, in module
 File string, line 4, in RequestData
   AttributeError: GetPointData
  
   I also tried just using the programmable filter on one source and with
   the
   following code, and  I get the same error :
  
   input0=self.GetInputDataObject(0,0)
   input0.GetPointData()
  
   I am using version 3.4.0
  
   ___
   ParaView mailing list
   ParaView@paraview.org
   http://www.paraview.org/mailman/listinfo/paraview
  
  
 
 

___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] Python Programmable Filter

2008-11-13 Thread Berk Geveci
Are the inputs multi-block datasets by any chance?


-berk

On Thu, Nov 13, 2008 at 6:03 AM, Jacques Papper
[EMAIL PROTECTED] wrote:
 Hi Berk,

 I am trying out your suggestion of merging arrays :

 input0 = self.GetInputDataObject(0,0)
 input1 = self.GetInputDataObject(0,1)
 output = self.GetOutputDataObject(0)
 output.GetPointData().AddArray(input0.GetPointData().GetArray(pressure1))
 output.GetPointData().AddArray(input1.GetPointData().GetArray(pressure2))

 but I get the following error message :

   File string, line 2, in module
   File string, line 4, in RequestData
 AttributeError: GetPointData

 I also tried just using the programmable filter on one source and with the
 following code, and  I get the same error :

 input0=self.GetInputDataObject(0,0)
 input0.GetPointData()

 I am using version 3.4.0

 ___
 ParaView mailing list
 ParaView@paraview.org
 http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] Python Programmable Filter

2008-11-13 Thread Utkarsh Ayachit

Jacques,

Couple of ways to solve your problem:

* Solution One:
If you don't want to deal with the fact that your data is a 
vtkMultiblockDataSet, apply the Merge Blocks filter after each of the 
Extract Block filters and then connect to the Programmable Filter to 
to the output from the Merge Blocks and then your current script 
should work just fine. The Merge Blocks will convert the 
vtkMultiBlockDataSet to a vtkUnstructuredGrid on which your script is 
applicable.


* Solution Two:
input0 = self.GetInputDataObject(0,0)
input1 = self.GetInputDataObject(0,1)
output = self.GetOutputDataObject(0)

input0Block0 = input0.GetBlock(0)
input1Block0 = input1.GetBlock(0)

output.CopyStructure(input0)
outputBlock0 = input0Block0.NewInstance()
outputBlock0.CopyStructure(input0Block0)
output.SetBlock(0, outputBlock0)

outputBlock0.GetPointData().AddArray(input0Block0.GetPointData().GetArray(pressure1))
outputBlock0.GetPointData().AddArray(input1Block0.GetPointData().GetArray(pressure2))

The above script will work if you are extracting a single block using 
the Extract Block filter. If you want to merge arrays for all the blocks 
in the input you'll have to iterate over the datasets in the 
vtkMultiblockDataset. Take a look at

http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets

Utkarsh


Jacques Papper wrote:

Here is what I am doing at the moment.
-Load geometry 1
-Extract wing block

-Load geometry 2
-Extract wing block

Then use the resample filter with wing1 as input and wing2 as source
(this works)

The last bit is missing (that is merging the data from wing2 with the 
resampled data)


Jacques

2008/11/13 Berk Geveci [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]


Programmable filter can still be made to work. Do the datasets have
multiple parts? I am not sure how resampling would work with multiple
parts. It is impossible to guess which parts map to which parts...

-berk

On Thu, Nov 13, 2008 at 8:28 AM, Jacques Papper
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
  They are multi-block datasets from Ensight Reader.
  Is there another way of dealing with this then ?
  Jacques
 
  2008/11/13 Berk Geveci [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
 
  Are the inputs multi-block datasets by any chance?
 
 
  -berk
 
  On Thu, Nov 13, 2008 at 6:03 AM, Jacques Papper
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
   Hi Berk,
  
   I am trying out your suggestion of merging arrays :
  
   input0 = self.GetInputDataObject(0,0)
   input1 = self.GetInputDataObject(0,1)
   output = self.GetOutputDataObject(0)
  
  
output.GetPointData().AddArray(input0.GetPointData().GetArray(pressure1))
  
  
output.GetPointData().AddArray(input1.GetPointData().GetArray(pressure2))
  
   but I get the following error message :
  
 File string, line 2, in module
 File string, line 4, in RequestData
   AttributeError: GetPointData
  
   I also tried just using the programmable filter on one source
and with
   the
   following code, and  I get the same error :
  
   input0=self.GetInputDataObject(0,0)
   input0.GetPointData()
  
   I am using version 3.4.0
  
   ___
   ParaView mailing list
   ParaView@paraview.org mailto:ParaView@paraview.org
   http://www.paraview.org/mailman/listinfo/paraview
  
  
 
 





___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview

___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] Python Programmable Filter

2008-11-13 Thread Jacques Papper
Thanks a lot Utkarsh !

It works. I was almost there, but I couldn't figure out a way to expose the
available interface for each object!
Where am I supposed to look to figure out that CopyStructure(), and
NewInstance(), SetBlock() etc ... are functions available ?

Kind regards,
Jacques Papper


2008/11/13 Utkarsh Ayachit [EMAIL PROTECTED]

 Jacques,

 Couple of ways to solve your problem:

 * Solution One:
 If you don't want to deal with the fact that your data is a
 vtkMultiblockDataSet, apply the Merge Blocks filter after each of the
 Extract Block filters and then connect to the Programmable Filter to to
 the output from the Merge Blocks and then your current script should work
 just fine. The Merge Blocks will convert the vtkMultiBlockDataSet to a
 vtkUnstructuredGrid on which your script is applicable.

 * Solution Two:
 input0 = self.GetInputDataObject(0,0)
 input1 = self.GetInputDataObject(0,1)
 output = self.GetOutputDataObject(0)

 input0Block0 = input0.GetBlock(0)
 input1Block0 = input1.GetBlock(0)

 output.CopyStructure(input0)
 outputBlock0 = input0Block0.NewInstance()
 outputBlock0.CopyStructure(input0Block0)
 output.SetBlock(0, outputBlock0)


 outputBlock0.GetPointData().AddArray(input0Block0.GetPointData().GetArray(pressure1))

 outputBlock0.GetPointData().AddArray(input1Block0.GetPointData().GetArray(pressure2))

 The above script will work if you are extracting a single block using the
 Extract Block filter. If you want to merge arrays for all the blocks in the
 input you'll have to iterate over the datasets in the vtkMultiblockDataset.
 Take a look at

 http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets

 Utkarsh


 Jacques Papper wrote:

 Here is what I am doing at the moment.
 -Load geometry 1
 -Extract wing block

 -Load geometry 2
 -Extract wing block

 Then use the resample filter with wing1 as input and wing2 as source
 (this works)

 The last bit is missing (that is merging the data from wing2 with the
 resampled data)

 Jacques

 2008/11/13 Berk Geveci [EMAIL PROTECTED] mailto:
 [EMAIL PROTECTED]

Programmable filter can still be made to work. Do the datasets have
multiple parts? I am not sure how resampling would work with multiple
parts. It is impossible to guess which parts map to which parts...

-berk

On Thu, Nov 13, 2008 at 8:28 AM, Jacques Papper
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
  They are multi-block datasets from Ensight Reader.
  Is there another way of dealing with this then ?
  Jacques
 
  2008/11/13 Berk Geveci [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
 
  Are the inputs multi-block datasets by any chance?
 
 
  -berk
 
  On Thu, Nov 13, 2008 at 6:03 AM, Jacques Papper
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 wrote:
   Hi Berk,
  
   I am trying out your suggestion of merging arrays :
  
   input0 = self.GetInputDataObject(0,0)
   input1 = self.GetInputDataObject(0,1)
   output = self.GetOutputDataObject(0)
  
  

  output.GetPointData().AddArray(input0.GetPointData().GetArray(pressure1))
  
  

  output.GetPointData().AddArray(input1.GetPointData().GetArray(pressure2))
  
   but I get the following error message :
  
 File string, line 2, in module
 File string, line 4, in RequestData
   AttributeError: GetPointData
  
   I also tried just using the programmable filter on one source
and with
   the
   following code, and  I get the same error :
  
   input0=self.GetInputDataObject(0,0)
   input0.GetPointData()
  
   I am using version 3.4.0
  
   ___
   ParaView mailing list
   ParaView@paraview.org mailto:ParaView@paraview.org
   http://www.paraview.org/mailman/listinfo/paraview
  
  
 
 



 

 ___
 ParaView mailing list
 ParaView@paraview.org
 http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] Python Programmable Filter

2008-11-13 Thread David E DeMarle
There is probably a python way to get help more easily, but one way to
figure it out is to look at the VTK doxygen documentation for
vtkDataObject and it's subclasses, and realize that all (or almost
all) of the public C++ methods are wrapped into python and therefore
available to use.

cheers,
Dave

On 11/13/08, Jacques Papper [EMAIL PROTECTED] wrote:
 Thanks a lot Utkarsh !

 It works. I was almost there, but I couldn't figure out a way to expose the
 available interface for each object!
 Where am I supposed to look to figure out that CopyStructure(), and
 NewInstance(), SetBlock() etc ... are functions available ?

 Kind regards,
 Jacques Papper


 2008/11/13 Utkarsh Ayachit [EMAIL PROTECTED]

  Jacques,
 
  Couple of ways to solve your problem:
 
  * Solution One:
  If you don't want to deal with the fact that your data is a
 vtkMultiblockDataSet, apply the Merge Blocks filter after each of the
 Extract Block filters and then connect to the Programmable Filter to to
 the output from the Merge Blocks and then your current script should work
 just fine. The Merge Blocks will convert the vtkMultiBlockDataSet to a
 vtkUnstructuredGrid on which your script is applicable.
 
  * Solution Two:
 
  input0 = self.GetInputDataObject(0,0)
  input1 = self.GetInputDataObject(0,1)
  output = self.GetOutputDataObject(0)
 
  input0Block0 = input0.GetBlock(0)
  input1Block0 = input1.GetBlock(0)
 
  output.CopyStructure(input0)
  outputBlock0 = input0Block0.NewInstance()
  outputBlock0.CopyStructure(input0Block0)
  output.SetBlock(0, outputBlock0)
 
 
 outputBlock0.GetPointData().AddArray(input0Block0.GetPointData().GetArray(pressure1))
 
 outputBlock0.GetPointData().AddArray(input1Block0.GetPointData().GetArray(pressure2))
 
  The above script will work if you are extracting a single block using the
 Extract Block filter. If you want to merge arrays for all the blocks in the
 input you'll have to iterate over the datasets in the vtkMultiblockDataset.
 Take a look at
 
 http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets
 
  Utkarsh
 
 
  Jacques Papper wrote:
 
  
   Here is what I am doing at the moment.
   -Load geometry 1
   -Extract wing block
  
   -Load geometry 2
   -Extract wing block
  
   Then use the resample filter with wing1 as input and wing2 as source
   (this works)
  
   The last bit is missing (that is merging the data from wing2 with the
 resampled data)
  
   Jacques
  
   2008/11/13 Berk Geveci [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
  
  
  Programmable filter can still be made to work. Do the datasets have
  multiple parts? I am not sure how resampling would work with multiple
  parts. It is impossible to guess which parts map to which parts...
  
  -berk
  
  On Thu, Nov 13, 2008 at 8:28 AM, Jacques Papper
  
  [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
They are multi-block datasets from Ensight Reader.
Is there another way of dealing with this then ?
Jacques
   
2008/11/13 Berk Geveci [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED]
  
   
Are the inputs multi-block datasets by any chance?
   
   
-berk
   
On Thu, Nov 13, 2008 at 6:03 AM, Jacques Papper
  
[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
 Hi Berk,

 I am trying out your suggestion of merging arrays :

 input0 = self.GetInputDataObject(0,0)
 input1 = self.GetInputDataObject(0,1)
 output = self.GetOutputDataObject(0)


  
 output.GetPointData().AddArray(input0.GetPointData().GetArray(pressure1))


  
 output.GetPointData().AddArray(input1.GetPointData().GetArray(pressure2))

 but I get the following error message :

   File string, line 2, in module
   File string, line 4, in RequestData
 AttributeError: GetPointData

 I also tried just using the programmable filter on one source
  and with
 the
 following code, and  I get the same error :

 input0=self.GetInputDataObject(0,0)
 input0.GetPointData()

 I am using version 3.4.0


 ___
 ParaView mailing list
 ParaView@paraview.org mailto:ParaView@paraview.org
  

 http://www.paraview.org/mailman/listinfo/paraview


   
   
  
  
  
  
 
  
  
   ___
   ParaView mailing list
   ParaView@paraview.org
   http://www.paraview.org/mailman/listinfo/paraview
  
 


 ___
 ParaView mailing list
 ParaView@paraview.org
 http://www.paraview.org/mailman/listinfo/paraview




-- 
David E DeMarle
Kitware, Inc.
RD Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662

Re: [Paraview] Python Programmable Filter

2008-11-13 Thread Jacques Papper
Indeed the VTK online doxygen is very useful. Is there any way in python of
getting the name of the class of the object I'm dealing with ? That way I
can find the class documentation in the Doxygen ?
Thanks again,
Jacques

2008/11/13 David E DeMarle [EMAIL PROTECTED]

 There is probably a python way to get help more easily, but one way to
 figure it out is to look at the VTK doxygen documentation for
 vtkDataObject and it's subclasses, and realize that all (or almost
 all) of the public C++ methods are wrapped into python and therefore
 available to use.

 cheers,
 Dave

 On 11/13/08, Jacques Papper [EMAIL PROTECTED] wrote:
  Thanks a lot Utkarsh !
 
  It works. I was almost there, but I couldn't figure out a way to expose
 the
  available interface for each object!
  Where am I supposed to look to figure out that CopyStructure(), and
  NewInstance(), SetBlock() etc ... are functions available ?
 
  Kind regards,
  Jacques Papper
 
 
  2008/11/13 Utkarsh Ayachit [EMAIL PROTECTED]
 
   Jacques,
  
   Couple of ways to solve your problem:
  
   * Solution One:
   If you don't want to deal with the fact that your data is a
  vtkMultiblockDataSet, apply the Merge Blocks filter after each of the
  Extract Block filters and then connect to the Programmable Filter to
 to
  the output from the Merge Blocks and then your current script should
 work
  just fine. The Merge Blocks will convert the vtkMultiBlockDataSet to a
  vtkUnstructuredGrid on which your script is applicable.
  
   * Solution Two:
  
   input0 = self.GetInputDataObject(0,0)
   input1 = self.GetInputDataObject(0,1)
   output = self.GetOutputDataObject(0)
  
   input0Block0 = input0.GetBlock(0)
   input1Block0 = input1.GetBlock(0)
  
   output.CopyStructure(input0)
   outputBlock0 = input0Block0.NewInstance()
   outputBlock0.CopyStructure(input0Block0)
   output.SetBlock(0, outputBlock0)
  
  
 
 outputBlock0.GetPointData().AddArray(input0Block0.GetPointData().GetArray(pressure1))
  
 
 outputBlock0.GetPointData().AddArray(input1Block0.GetPointData().GetArray(pressure2))
  
   The above script will work if you are extracting a single block using
 the
  Extract Block filter. If you want to merge arrays for all the blocks in
 the
  input you'll have to iterate over the datasets in the
 vtkMultiblockDataset.
  Take a look at
  
 
 http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets
  
   Utkarsh
  
  
   Jacques Papper wrote:
  
   
Here is what I am doing at the moment.
-Load geometry 1
-Extract wing block
   
-Load geometry 2
-Extract wing block
   
Then use the resample filter with wing1 as input and wing2 as source
(this works)
   
The last bit is missing (that is merging the data from wing2 with the
  resampled data)
   
Jacques
   
2008/11/13 Berk Geveci [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED]
   
   
   Programmable filter can still be made to work. Do the datasets
 have
   multiple parts? I am not sure how resampling would work with
 multiple
   parts. It is impossible to guess which parts map to which parts...
   
   -berk
   
   On Thu, Nov 13, 2008 at 8:28 AM, Jacques Papper
   
   [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 They are multi-block datasets from Ensight Reader.
 Is there another way of dealing with this then ?
 Jacques

 2008/11/13 Berk Geveci [EMAIL PROTECTED]
   mailto:[EMAIL PROTECTED]
   

 Are the inputs multi-block datasets by any chance?


 -berk

 On Thu, Nov 13, 2008 at 6:03 AM, Jacques Papper
   
 [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  Hi Berk,
 
  I am trying out your suggestion of merging arrays :
 
  input0 = self.GetInputDataObject(0,0)
  input1 = self.GetInputDataObject(0,1)
  output = self.GetOutputDataObject(0)
 
 
   
 
 output.GetPointData().AddArray(input0.GetPointData().GetArray(pressure1))
 
 
   
 
 output.GetPointData().AddArray(input1.GetPointData().GetArray(pressure2))
 
  but I get the following error message :
 
File string, line 2, in module
File string, line 4, in RequestData
  AttributeError: GetPointData
 
  I also tried just using the programmable filter on one
 source
   and with
  the
  following code, and  I get the same error :
 
  input0=self.GetInputDataObject(0,0)
  input0.GetPointData()
 
  I am using version 3.4.0
 
 
  ___
  ParaView mailing list
  ParaView@paraview.org mailto:ParaView@paraview.org
   
 
  http://www.paraview.org/mailman/listinfo/paraview