Many thanks again Cory.
How can one find out about this on one's own in general?
The assignment of textures is far from intuitive to me. Also I've checked the Paraview API, the Paraview-Python docs and VTK docs and some promising parts of the sources but did not find that it's registrationName instead of guiName (as is the parameter in most cases for setting the name used in the GUI).

On 08/01/16 16:04, Cory Quammen wrote:
Sure. Try this instead:

pvs.servermanager.Register(texProxy, registrationName="MyAwesomeTexture")

Cory

On Fri, Jan 8, 2016 at 7:07 AM, Grothausmann, Roman Dr.
<grothausmann.ro...@mh-hannover.de> wrote:
Many, many thanks Cory for Your answer. That did the trick.
Is there any chance to also set a guiName for the texture that is then shown
in the list of textures when the PVSM is loaded?

On 05/01/16 19:26, Cory Quammen wrote:

Hi Roman,

It's not obvious, but you need to register the ImageTexture proxy with the
proxy
manager:

pvs.servermanager.Register(texProxy)

Just add that in before you save the state, and you should be good.

HTH,
Cory

On Tue, Dec 8, 2015 at 5:01 AM, Grothausmann, Roman Dr.
<grothausmann.ro...@mh-hannover.de
<mailto:grothausmann.ro...@mh-hannover.de>>

wrote:

     After some hours of searching I found an answer that sadly was not
linked to
     the question:
     http://www.paraview.org/pipermail/paraview/2012-March/024261.html

     The code below run as a macro in paraview shows a plane with a
texture.
     However, saving the state in a *.pvsm either by code or within the GUI
does
     not save the texture and its assignment.

     What is missing to save the texture and its assignment in a state
file?


     ______________________________________________________

     import paraview.simple as pvs

     plane1 = pvs.Plane(guiName="xz-plane")
     dp = pvs.GetDisplayProperties(plane1)
     dp.Representation = 'Surface With Edges'

     texProxy = pvs.servermanager.CreateProxy("textures", "ImageTexture")
     texProxy.GetProperty("FileName").SetElement(0, "texture.png")
     texProxy.UpdateVTKObjects()

     dp.Texture= texProxy
     print dp.Texture
     pvs.Render()

     pvs.servermanager.SaveState("test.pvsm")





     On 07/12/15 17:50, Grothausmann, Roman Dr. wrote:

         Dear mailing list members,


         Is it possible to assign a 2D texture image to an object that has
TCords
         in python?
         I found quite a few people trying and reporting that it does not
work
         nor does
         the Trace Option under paraview tell what happens if a texture is
         assigned in
         the GUI:
         http://www.paraview.org/pipermail/paraview/2012-March/024255.html
         http://www.paraview.org/Bug/view.php?id=12953

         I've tried:

               import paraview.simple as pvs


               reader = pvs.OpenDataFile("test.png)
               #reader.UpdatePipelineInformation()
               reader.UpdatePipeline()
               print reader.GetDataInformation().GetBounds() # needs
UpdatePipeline

               obj = pvs.Plane()
               plane1Display = pvs.Show(obj)
               plane1Display.Texture = reader

               dp = pvs.GetDisplayProperties(obj)
               dp.Representation = 'Surface With Edges'

               dp.Texture = reader


         but neither plane1Display.Texture nor dp.Texture seem to allow to
set the
         texture (see error below)

         Any help or hints are very much appreciated
         Roman


         RROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkPVSessionCore.cxx,
         line 390
         vtkPVSessionCore (0x258c2e0): Object type:
vtkGlyph3DRepresentation,
         could not
         find requested method: "SetTexture"
         or the method was called with incorrect arguments.

         while processing
         Message 0 = Invoke
             Argument 0 = vtk_object_pointer {vtkGlyph3DRepresentation
(0x551b0a0)}
             Argument 1 = string_value {SetTexture}
             Argument 2 = vtk_object_pointer {vtkImageFileSeriesReader
(0x4f68190)}


         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkPVSessionCore.cxx,
         line 391
         vtkPVSessionCore (0x258c2e0): Aborting execution for debugging
purposes.

         ############ ABORT #############
         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkSIProxy.cxx,
         line 134
         vtkSISourceProxy (0x551af30): Error pushing property state:
Texture

         global_id: 396
         location: 21
         [paraview_protobuf.ProxyState.property] {
             name: "Texture"
             value {
               type: INPUT
               proxy_global_id: 350
               port_number: 0
             }
         }
         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkPVSessionCore.cxx,
         line 390
         vtkPVSessionCore (0x258c2e0): Object type:
vtkOutlineRepresentation,
         could not
         find requested method: "SetTexture"
         or the method was called with incorrect arguments.

         while processing
         Message 0 = Invoke
             Argument 0 = vtk_object_pointer {vtkOutlineRepresentation
(0x5549800)}
             Argument 1 = string_value {SetTexture}
             Argument 2 = vtk_object_pointer {vtkImageFileSeriesReader
(0x4f68190)}


         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkPVSessionCore.cxx,
         line 391
         vtkPVSessionCore (0x258c2e0): Aborting execution for debugging
purposes.

         ############ ABORT #############
         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkSIProxy.cxx,
         line 134
         vtkSISourceProxy (0x5549690): Error pushing property state:
Texture

         global_id: 407
         location: 21
         [paraview_protobuf.ProxyState.property] {
             name: "Texture"
             value {
               type: INPUT
               proxy_global_id: 350
               port_number: 0
             }
         }
         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkPVSessionCore.cxx,
         line 390
         vtkPVSessionCore (0x258c2e0): Object type:
         vtkGeometryRepresentationWithFaces,
         could not find requested method: "SetTexture"
         or the method was called with incorrect arguments.

         while processing
         Message 0 = Invoke
             Argument 0 = vtk_object_pointer
{vtkGeometryRepresentationWithFaces
         (0x59a6df0)}
             Argument 1 = string_value {SetTexture}
             Argument 2 = vtk_object_pointer {vtkImageFileSeriesReader
(0x4f68190)}


         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkPVSessionCore.cxx,
         line 391
         vtkPVSessionCore (0x258c2e0): Aborting execution for debugging
purposes.

         ############ ABORT #############
         ERROR: In

/opt/compilation/paraview-git/ParaViewCore/ServerImplementation/Core/vtkSIProxy.cxx,
         line 134
         vtkSISourceProxy (0x5afc8e0): Error pushing property state:
Texture

         global_id: 440
         location: 21
         [paraview_protobuf.ProxyState.property] {
             name: "Texture"
             value {
               type: INPUT
               proxy_global_id: 350
               port_number: 0
             }
         }



     --
     Dr. Roman Grothausmann

     Tomographie und Digitale Bildverarbeitung
     Tomography and Digital Image Analysis

     Institut für Funktionelle und Angewandte Anatomie, OE 4120
     Medizinische Hochschule Hannover
     Carl-Neuberg-Str. 1
     D-30625 Hannover

     Tel. +49 511 532-2900 <tel:%2B49%20511%20532-2900>
     _______________________________________________
     Powered by www.kitware.com <http://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




--
Cory Quammen
R&D Engineer
Kitware, Inc.


--
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover

Tel. +49 511 532-2900




--
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover

Tel. +49 511 532-2900
_______________________________________________
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

Reply via email to