[Paraview] Accessing mappers from within Paraview

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Apr 7 11:55:14 EDT 2010


Try:

> writer = MeasureObjects(FileName="/tmp/foo.blah")
> print writer.Input                         # make sure input is valid
> writer.UpdatePipeline()

Utkarsh

On Wed, Apr 7, 2010 at 11:51 AM, Christian Werner
<christian.werner at rwth-aachen.de> wrote:
> I am sorry, but it seems that I have a general misunderstanding in how to
> implement a writer. I actually took vtkImageWriter as a guide to writing
> some filter that takes an image as input and writes something to the disk.
> Everything seems fine, but I can't test any further since the RequestData
> method isn't called at all when I use the filter in the Python Shell (I
> cannot acces it anywhere else by the way). I attached my xml files.
>
> When using imaging filters in Python you would write something like this,
> after loading a volume:
>
> smooth = GaussianSmooth3D()
> Show()
>
> With my writer, I am trying
> writer = MeasureObjects()
> Show/Update//Execute/GoGoGo/Write/Save/DoSomething/ ...
>
> Nothing happens. No call to RequestData, which has a vtkErrorMacro just in
> the beginning that would show me that it was called.
>
>
> Best regards,
> Christian
>
>
>
> Utkarsh Ayachit wrote:
>>
>> You did change your proxy to be a "WriterProxy" or subclass instead of
>> "SourceProxy" right?
>>
>> Utkarsh
>>
>> On Wed, Apr 7, 2010 at 11:02 AM, Christian Werner
>> <christian.werner at rwth-aachen.de> wrote:
>>
>>>
>>> Hi!
>>>
>>> Thanks for the quick reply. I made it a writer and I am now able to
>>> access
>>> the plugin in Python. That's great, but somehow it doesn't execute. I can
>>> now set the FileName (which I forgot to mention in the xml), but I can't
>>> get
>>> it executed. The plugin is derived from vtkImageAlgorithm, but the
>>> RequestData method does not seem to be called. How do I trigger it?
>>>
>>> Best regards,
>>> Christian
>>>
>>>
>>> Utkarsh Ayachit wrote:
>>>
>>>>
>>>> Christian,
>>>>
>>>> Any reason why you are not making it a writer? To me it doesn't seem
>>>> anything different than that except looks like you are not explicitly
>>>> specifying the filename (is it hard coded?).
>>>>
>>>> Utkarsh
>>>>
>>>>
>>>> On Wed, Apr 7, 2010 at 7:16 AM, Christian Werner
>>>> <christian.werner at rwth-aachen.de> wrote:
>>>>
>>>>
>>>>>
>>>>> Hi!
>>>>>
>>>>> I just wrote a nice mapper which writes some data to the disk, taking a
>>>>> volume as input. I thought I could access it from the "Filters" menu,
>>>>> but
>>>>> this wasn't possible. In future, this mapper should be called from the
>>>>> python shell, but there, it isn't known either:
>>>>>
>>>>>
>>>>>
>>>>>>>>
>>>>>>>> help(MeasureObjects)
>>>>>>>>
>>>>>>>>
>>>>>
>>>>> Traceback (most recent call last):
>>>>>
>>>>> File "<console>", line 1, in <module>
>>>>>
>>>>> NameError: name 'MeasureObjects' is not defined
>>>>>
>>>>>
>>>>> The plugin-manager however says, that he loaded my plugin ("...is
>>>>> definetely
>>>>> a paraview plugin..."). It shows up as "loaded" when verifying this.
>>>>>
>>>>> The plugin is not intended as a writer or something like that, it just
>>>>> looks
>>>>> at the input and writes something to the disk which Paraview couldn't
>>>>> use
>>>>> for anything anyway. Here is my xml content:
>>>>>
>>>>> <ServerManagerConfiguration>
>>>>>  <!-- This is the server manager configuration XML. It defines the
>>>>> interface
>>>>> to
>>>>>    our new filter. As a rule of thumb, try to locate the configuration
>>>>> for
>>>>>    a filter already in ParaView (in
>>>>> Servers/ServerManager/Resources/*.xml)
>>>>>    that matches your filter and then model your xml on it -->
>>>>>  <ProxyGroup name="mappers">
>>>>>  <SourceProxy name="MeasureObjects" class="vtkMeasureObjects"
>>>>> label="MeasureObjects">
>>>>>  <Documentation
>>>>>     long_help="Measures objects (connected components) in a volume."
>>>>>     short_help="Classical measuring.">
>>>>>  This is classical object measuring filter.
>>>>>  </Documentation>
>>>>>  <InputProperty
>>>>>     name="Input"
>>>>>     command="SetInputConnection">
>>>>>        <ProxyGroupDomain name="groups">
>>>>>          <Group name="sources"/>
>>>>>          <Group name="filters"/>
>>>>>        </ProxyGroupDomain>
>>>>>        <DataTypeDomain name="input_type">
>>>>>          <DataType value="vtkImageData"/>
>>>>>        </DataTypeDomain>
>>>>>   </InputProperty>
>>>>>  <!-- End MeasureObjects -->
>>>>>  </SourceProxy>
>>>>> </ProxyGroup>
>>>>> </ServerManagerConfiguration>
>>>>>
>>>>>
>>>>> If I define the plugin as a filter then Paraview complains about not
>>>>> having
>>>>> an output port.
>>>>>
>>>>> Any suggestions?
>>>>>
>>>>>
>>>>> Best regards,
>>>>> Christian
>>>>> _______________________________________________
>>>>> 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