Utkarsh, this is exactly what I want. Thanks a lot !<br>
For those interested in, I give in the following the XML for exposing
vtkImageMathematics filter into ParaView filters menu. They are some
weird behaviour, but I am going further on (like : no "Change input"
choice when right clicking on the Image Math in the pipeline...)<br>
<br>
Thanks again !<br>
<br>
Jerome<br>
<br>
<!-- ================================================================== --><br>
<SourceProxy name="ImageMathematics" class="vtkImageMathematics" label="Image Math"><br>
<Documentation<br>
long_help="Provides some image operations, one or two inputs."<br>
short_help="vtkImageMathematics filter."><br>
</Documentation><br>
<InputProperty<br>
name="Input1"<br>
command="SetInputConnection"<br>
port_index="0"><br>
<ProxyGroupDomain name="groups"><br>
<Group name="sources"/><br>
<Group name="filters"/><br>
</ProxyGroupDomain><br>
<DataTypeDomain name="input_type"><br>
<DataType value="vtkImageData"/><br>
</DataTypeDomain><br>
<Documentation><br>
Set the input to the Image Mathematics filter.<br>
</Documentation><br>
</InputProperty><br>
<InputProperty<br>
name="Input2"<br>
command="SetInputConnection"<br>
port_index="1"><br>
<ProxyGroupDomain name="groups"><br>
<Group name="sources"/><br>
<Group name="filters"/><br>
</ProxyGroupDomain><br>
<DataTypeDomain name="input_type"><br>
<DataType value="vtkImageData"/><br>
</DataTypeDomain><br>
<Documentation><br>
Set the input to the Image Mathematics filter.<br>
</Documentation><br>
</InputProperty><br>
<br>
<IntVectorProperty<br>
name="Operation"<br>
command="SetOperation"<br>
number_of_elements="1"<br>
default_values="0"><br>
<br>
<EnumerationDomain name="enum"><br>
<Entry value="0" text="Add"/><br>
<Entry value="1" text="Substract"/><br>
<Entry value="2" text="Multiply"/><br>
<Entry value="3" text="Divide"/><br>
<Entry value="4" text="Invert"/><br>
<Entry value="5" text="Sin"/><br>
<Entry value="6" text="Cos"/><br>
<Entry value="7" text="Exp"/><br>
<Entry value="8" text="Log"/><br>
<Entry value="9" text="Abs"/><br>
<Entry value="10" text="Sqr"/><br>
<Entry value="11" text="Sqrt"/><br>
<Entry value="12" text="Min"/><br>
<Entry value="13" text="Max"/><br>
<Entry value="14" text="Atan"/><br>
<Entry value="15" text="Atan2"/><br>
<Entry value="16" text="Multiply by k"/><br>
<Entry value="17" text="Add c"/><br>
<Entry value="18" text="Conjugate"/><br>
<Entry value="19" text="Complex multiply"/><br>
<Entry value="20" text="Replace by k"/><br>
</EnumerationDomain><br>
</IntVectorProperty><br>
<br>
<DoubleVectorProperty<br>
name="ConstantK"<br>
command="SetConstantK"<br>
number_of_elements="1"<br>
default_values="1"><br>
</DoubleVectorProperty><br>
<br>
<DoubleVectorProperty<br>
name="ConstantC"<br>
command="SetConstantC"<br>
number_of_elements="1"<br>
default_values="0"><br>
</DoubleVectorProperty><br>
<br>
<IntVectorProperty<br>
name="DivideByZeroToC"<br>
command="SetDivideByZeroToC"<br>
number_of_elements="1"<br>
default_values="1"><br>
<BooleanDomain name="boolean"/><br>
</IntVectorProperty><br>
<br>
</SourceProxy><br>
<!-- End ImageMathematics --><br><br><div class="gmail_quote">2009/4/3 Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You are on the right track. The difference between vtkImageAppend and<br>
vtkImageMathematics is that the former supports "multiple input<br>
connections on a single input port" while the latter supports "one<br>
input connection each on two input ports". This former is supported in<br>
the XML by using the multiple_input attribute, while for the latter,<br>
you need to have two separate input properties as follows:<br>
<br>
<InputProperty name="Input1" command="SetInputConnection" ... /> <!--<br>
port_index="0" is by default --><br>
<InputProperty name="Input2" port_index="1" command="SetInputConnection" ... /><br>
<br>
The key here is the "port_index" attribute.<br>
<font color="#888888"><br>
Utkarsh<br>
</font><div><div></div><div class="h5"><br>
On Fri, Apr 3, 2009 at 2:53 AM, Jérôme <<a href="mailto:jerome.velut@gmail.com">jerome.velut@gmail.com</a>> wrote:<br>
> Ok !<br>
> No, it doesn't work, but I made my mind:<br>
><br>
> * vtkImageMathematics has two input ports, the second one being optional.<br>
> That's why the XML works with one filter.<br>
><br>
> * Function SetInput1 and SetInput2 are wrappers around SetInputConnection<br>
> for old-style programming compatibility. SetInputX is in fact<br>
> SetInputConnection(X-1, input_port1 )<br>
><br>
> When using AddInputConnection like vtkImageAppend does, it is based on the<br>
> 'one port' fashion of the filter, then multiple inputs means multiple<br>
> connections on one port... That is not the case for vtkImageMathematics !!<br>
><br>
> So, I would like to use kind of number_of_elements statement and<br>
> element_types statement to handle something like :<br>
> <InputProperty<br>
> name="Input1"<br>
> command="SetInputConnection"<br>
> number_of_elements="2"<br>
> element_types="0 3" <!-- Yes I know, type '3' does<br>
> not exist: I want this to be vtkAlgorithmOutput --><br>
> default_values="0 Input1"> <!-- Yes I know, but you<br>
> see what I means ?? --><br>
> <ProxyGroupDomain name="groups"><br>
> <Group name="sources"/><br>
> <Group name="filters"/><br>
> </ProxyGroupDomain><br>
> <DataTypeDomain name="input_type"><br>
> <DataType value="vtkImageData"/><br>
> </DataTypeDomain><br>
> <Documentation><br>
> Set the input to the vtkImageMathematics filter.<br>
> </Documentation><br>
> </InputProperty><br>
><br>
> And then the same with Input2, where default_values would be "1 Input2".<br>
> I know one solution is to create an inherited class from<br>
> vtkImageMathematics, with accessors on input port 0 and port 1. I already<br>
> did that for vtkImageStencil, what works fine. My problem here is to make<br>
> vtkImageMathematic available without building any plugins: c++-allergics<br>
> have rights to use image addition and substraction inside ParaView !! one<br>
> XML to load, that's all !<br>
><br>
> I hope -for these allergics- that there is a solution...<br>
><br>
> Best regards<br>
><br>
> Jerome<br>
><br>
> 2009/4/2 Jérôme <<a href="mailto:jerome.velut@gmail.com">jerome.velut@gmail.com</a>><br>
>><br>
>> Hi,<br>
>><br>
>> Many thanks for your quick answer. The problem I described was observed on<br>
>> Paraview 3.4 release, debug build. I have a 3.5 CVS (not updated, so bad...)<br>
>> on which I tried my XML just right now: "Image Math" is no more gray!! I am<br>
>> able to apply the filter on a single image, with "Add constant", "Multiply<br>
>> by constant", etc.<br>
>><br>
>> The new problem is when I want to add two image. I selected two mandelbrot<br>
>> sources, then I plugged the "Image Math" filter. The output window claims:<br>
>> "Input port 0 of algorithm vtkImageMathematics(0x7f081c4bcb70) has 2<br>
>> connections but is not repeatable".<br>
>><br>
>> I tried the repeat_command="1" statement, without optimism and not much<br>
>> success... It seems that vtkImageMathematics input is old-fashionned, but<br>
>> the VTK doc says that SetInput1 and SetInput2 is like involking<br>
>> AddInputConnection. Where do I miss something ???<br>
>><br>
>> Thanks for all,<br>
>><br>
>> Jerome<br>
>><br>
>> 2009/4/2 Utkarsh Ayachit <<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>><br>
>>><br>
>>> I justed loaded your XML as a plugin in CVS ParaView is seems to being<br>
>>> enabled fine. I was able to apply the filter to Mandlebrot source.<br>
>>> What version of ParaView are you using?<br>
>>><br>
>>> Utkarsh<br>
>>><br>
>>> 2009/4/2 Jérôme <<a href="mailto:jerome.velut@gmail.com">jerome.velut@gmail.com</a>>:<br>
>>> > Dear all,<br>
>>> ><br>
>>> > I am unsuccessfully fighting with XML description of the VTK<br>
>>> > vtkImageMathematics filter. I want it to be available in the ParaView<br>
>>> > filters. At the end of this mail is the XML I wrote, widely inspired<br>
>>> > from<br>
>>> > "Append Geometry".<br>
>>> ><br>
>>> > Note that it is part of a larger file making available<br>
>>> > ImageGaussianSmooth,<br>
>>> > ImageSobel3D, ImageFilp, SplineFilter, some different sources...<br>
>>> > Everything<br>
>>> > works well, except Image Mathematics and Image Reslice (I told about<br>
>>> > Reslice<br>
>>> > in another thread).<br>
>>> ><br>
>>> > The symptom is the following : the "Image Math" appears in the filters<br>
>>> > list,<br>
>>> > but is always unavailable, even if I select one proxy or two in the<br>
>>> > pipeline. What is the diagnostic, doctors ? Is there a therapy ?<br>
>>> ><br>
>>> > Thanks all !<br>
>>> ><br>
>>> > Best regards,<br>
>>> > Jerome<br>
>>> ><br>
>>> > <ServerManagerConfiguration><br>
>>> > <ProxyGroup name="filters"><br>
>>> > <!--<br>
>>> > ================================================================== --><br>
>>> > <SourceProxy name="ImageMathematics" class="vtkImageMathematics"<br>
>>> > label="Image Math"><br>
>>> > <Documentation<br>
>>> > long_help="Provides some image operations, one<br>
>>> > or two<br>
>>> > inputs."<br>
>>> > short_help="vtkImageMathematics filter."><br>
>>> > </Documentation><br>
>>> > <InputProperty<br>
>>> > name="Input"<br>
>>> > command="AddInputConnection"<br>
>>> > clean_command="RemoveAllInputs"<br>
>>> > multiple_input="1"><br>
>>> > <ProxyGroupDomain name="groups"><br>
>>> > <Group name="sources"/><br>
>>> > <Group name="filters"/><br>
>>> > </ProxyGroupDomain><br>
>>> > <DataTypeDomain name="input_type"><br>
>>> > <DataType value="vtkImageData"/><br>
>>> > </DataTypeDomain><br>
>>> > <Documentation><br>
>>> > Set the input to the Append Geometry filter.<br>
>>> > </Documentation><br>
>>> > </InputProperty><br>
>>> ><br>
>>> > <IntVectorProperty<br>
>>> > name="Operation"<br>
>>> > command="SetOperation"<br>
>>> > number_of_elements="1"<br>
>>> > default_values="0"><br>
>>> ><br>
>>> > <EnumerationDomain name="enum"><br>
>>> > <Entry value="0" text="Add"/><br>
>>> > <Entry value="1" text="Substract"/><br>
>>> > <Entry value="2" text="Multiply"/><br>
>>> > <Entry value="3" text="Divide"/><br>
>>> > <Entry value="4" text="Invert"/><br>
>>> > <Entry value="5" text="Sin"/><br>
>>> > <Entry value="6" text="Cos"/><br>
>>> > <Entry value="7" text="Exp"/><br>
>>> > <Entry value="8" text="Log"/><br>
>>> > <Entry value="9" text="Abs"/><br>
>>> > <Entry value="10" text="Sqr"/><br>
>>> > <Entry value="11" text="Sqrt"/><br>
>>> > <Entry value="12" text="Min"/><br>
>>> > <Entry value="13" text="Max"/><br>
>>> > <Entry value="14" text="Atan"/><br>
>>> > <Entry value="15" text="Atan2"/><br>
>>> > <Entry value="16" text="Multiply by k"/><br>
>>> > <Entry value="17" text="Add c"/><br>
>>> > <Entry value="18" text="Conjugate"/><br>
>>> > <Entry value="19" text="Complex multiply"/><br>
>>> > <Entry value="20" text="Replace by k"/><br>
>>> > </EnumerationDomain><br>
>>> > </IntVectorProperty><br>
>>> ><br>
>>> > <DoubleVectorProperty<br>
>>> > name="ConstantK"<br>
>>> > command="SetConstantK"<br>
>>> > number_of_elements="1"<br>
>>> > default_values="1"><br>
>>> > </DoubleVectorProperty><br>
>>> ><br>
>>> > <DoubleVectorProperty<br>
>>> > name="ConstantC"<br>
>>> > command="SetConstantC"<br>
>>> > number_of_elements="1"<br>
>>> > default_values="0"><br>
>>> > </DoubleVectorProperty><br>
>>> ><br>
>>> > <IntVectorProperty<br>
>>> > name="DivideByZeroToC"<br>
>>> > command="SetDivideByZeroToC"<br>
>>> > number_of_elements="1"<br>
>>> > default_values="1"><br>
>>> > <BooleanDomain name="boolean"/><br>
>>> > </IntVectorProperty><br>
>>> ><br>
>>> > </SourceProxy><br>
>>> > <!-- End ImageMathematics --><br>
>>> > </ProxyGroup><br>
>>> > <!-- End Filters Group --><br>
>>> > </ServerManagerConfiguration><br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>> ><br>
>>> > Visit other Kitware open-source projects at<br>
>>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>> ><br>
>>> > Please keep messages on-topic and check the ParaView Wiki at:<br>
>>> > <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
>>> ><br>
>>> > Follow this link to subscribe/unsubscribe:<br>
>>> > <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
>>> ><br>
>>> ><br>
>><br>
><br>
><br>
</div></div></blockquote></div><br>