[Paraview] Making vtkImageMathematics available in ParaView filters

Jérôme jerome.velut at gmail.com
Fri Apr 3 02:53:05 EDT 2009


Ok !
No, it doesn't work, but I made my mind:

* vtkImageMathematics has two input ports, the second one being optional.
That's why the XML works with one filter.

* Function SetInput1 and SetInput2 are wrappers around SetInputConnection
for old-style programming compatibility. SetInputX is in fact
SetInputConnection(X-1, input_port1 )

When using AddInputConnection like vtkImageAppend does, it is based on the
'one port' fashion of the filter, then multiple inputs means multiple
connections on one port... That is not the case for vtkImageMathematics !!

So, I would like to use kind of number_of_elements statement and
element_types statement to handle something like :
<InputProperty
                       name="Input1"
                       command="SetInputConnection"
                       number_of_elements="2"
                       element_types="0 3"   <!-- Yes I know, type '3' does
not exist: I want this to be vtkAlgorithmOutput -->
                       default_values="0 Input1"> <!-- Yes I know, but you
see what I means ?? -->
            <ProxyGroupDomain name="groups">
                  <Group name="sources"/>
                  <Group name="filters"/>
            </ProxyGroupDomain>
            <DataTypeDomain name="input_type">
                 <DataType value="vtkImageData"/>
            </DataTypeDomain>
            <Documentation>
                  Set the input to the vtkImageMathematics filter.
            </Documentation>
  </InputProperty>


And then the same with Input2, where default_values would be "1 Input2".
I know one solution is to create an inherited class from
vtkImageMathematics, with accessors on input port 0 and port 1. I already
did that for vtkImageStencil, what works fine. My problem here is to make
vtkImageMathematic available without building any plugins: c++-allergics
have rights to use image addition and substraction inside ParaView !! one
XML to load, that's all !

I hope -for these allergics- that there is a solution...

Best regards

Jerome

2009/4/2 Jérôme <jerome.velut at gmail.com>

> Hi,
>
> Many thanks for your quick answer. The problem I described was observed on
> Paraview 3.4 release, debug build. I have a 3.5 CVS (not updated, so bad...)
> on which I tried my XML just right now: "Image Math" is no more gray!! I am
> able to apply the filter on a single image, with "Add constant", "Multiply
> by constant", etc.
>
> The new problem is when I want to add two image. I selected two mandelbrot
> sources, then I plugged the "Image Math" filter. The output window claims:
> "Input port 0 of algorithm vtkImageMathematics(0x7f081c4bcb70) has 2
> connections but is not repeatable".
>
> I tried the repeat_command="1" statement, without optimism and not much
> success... It seems that vtkImageMathematics input is old-fashionned, but
> the VTK doc says that SetInput1 and SetInput2 is like involking
> AddInputConnection. Where do I miss something ???
>
> Thanks for all,
>
> Jerome
>
> 2009/4/2 Utkarsh Ayachit <utkarsh.ayachit at kitware.com>
>
> I justed loaded your XML as a plugin in CVS ParaView is seems to being
>> enabled fine. I was able to apply the filter to Mandlebrot source.
>> What version of ParaView are you using?
>>
>> Utkarsh
>>
>> 2009/4/2 Jérôme <jerome.velut at gmail.com>:
>> > Dear all,
>> >
>> > I am unsuccessfully fighting with XML description of the VTK
>> > vtkImageMathematics filter. I want it to be available in the ParaView
>> > filters. At the end of this mail is the XML I wrote, widely inspired
>> from
>> > "Append Geometry".
>> >
>> > Note that it is part of a larger file making available
>> ImageGaussianSmooth,
>> > ImageSobel3D, ImageFilp, SplineFilter, some different sources...
>> Everything
>> > works well, except Image Mathematics and Image Reslice (I told about
>> Reslice
>> > in another thread).
>> >
>> > The symptom is the following : the "Image Math" appears in the filters
>> list,
>> > but is always unavailable, even if I select one proxy or two in the
>> > pipeline. What is the diagnostic, doctors ? Is there a therapy ?
>> >
>> > Thanks all !
>> >
>> > Best regards,
>> > Jerome
>> >
>> > <ServerManagerConfiguration>
>> >    <ProxyGroup name="filters">
>> >       <!--
>> > ================================================================== -->
>> >       <SourceProxy name="ImageMathematics" class="vtkImageMathematics"
>> > label="Image Math">
>> >          <Documentation
>> >                        long_help="Provides some image operations, one or
>> two
>> > inputs."
>> >                        short_help="vtkImageMathematics filter.">
>> >          </Documentation>
>> >       <InputProperty
>> >          name="Input"
>> >          command="AddInputConnection"
>> >          clean_command="RemoveAllInputs"
>> >          multiple_input="1">
>> >            <ProxyGroupDomain name="groups">
>> >              <Group name="sources"/>
>> >              <Group name="filters"/>
>> >            </ProxyGroupDomain>
>> >            <DataTypeDomain name="input_type">
>> >              <DataType value="vtkImageData"/>
>> >            </DataTypeDomain>
>> >            <Documentation>
>> >              Set the input to the Append Geometry filter.
>> >            </Documentation>
>> >       </InputProperty>
>> >
>> >          <IntVectorProperty
>> >                            name="Operation"
>> >                            command="SetOperation"
>> >                            number_of_elements="1"
>> >                            default_values="0">
>> >
>> >             <EnumerationDomain name="enum">
>> >                <Entry value="0" text="Add"/>
>> >                <Entry value="1" text="Substract"/>
>> >                <Entry value="2" text="Multiply"/>
>> >                <Entry value="3" text="Divide"/>
>> >                <Entry value="4" text="Invert"/>
>> >                <Entry value="5" text="Sin"/>
>> >                <Entry value="6" text="Cos"/>
>> >                <Entry value="7" text="Exp"/>
>> >                <Entry value="8" text="Log"/>
>> >                <Entry value="9" text="Abs"/>
>> >                <Entry value="10" text="Sqr"/>
>> >                <Entry value="11" text="Sqrt"/>
>> >                <Entry value="12" text="Min"/>
>> >                <Entry value="13" text="Max"/>
>> >                <Entry value="14" text="Atan"/>
>> >                <Entry value="15" text="Atan2"/>
>> >                <Entry value="16" text="Multiply by k"/>
>> >                <Entry value="17" text="Add c"/>
>> >                <Entry value="18" text="Conjugate"/>
>> >                <Entry value="19" text="Complex multiply"/>
>> >                <Entry value="20" text="Replace by k"/>
>> >             </EnumerationDomain>
>> >          </IntVectorProperty>
>> >
>> >          <DoubleVectorProperty
>> >                               name="ConstantK"
>> >                               command="SetConstantK"
>> >                               number_of_elements="1"
>> >                               default_values="1">
>> >          </DoubleVectorProperty>
>> >
>> >          <DoubleVectorProperty
>> >                               name="ConstantC"
>> >                               command="SetConstantC"
>> >                               number_of_elements="1"
>> >                               default_values="0">
>> >          </DoubleVectorProperty>
>> >
>> >          <IntVectorProperty
>> >                            name="DivideByZeroToC"
>> >                            command="SetDivideByZeroToC"
>> >                            number_of_elements="1"
>> >                            default_values="1">
>> >             <BooleanDomain name="boolean"/>
>> >          </IntVectorProperty>
>> >
>> >       </SourceProxy>
>> >       <!-- End ImageMathematics -->
>> >    </ProxyGroup>
>> >    <!-- End Filters Group -->
>> > </ServerManagerConfiguration>
>> >
>> >
>> >
>> > _______________________________________________
>> > 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
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090403/7cd9e1b4/attachment-0001.htm>


More information about the ParaView mailing list