[Paraview] Optional input ports
Cornelis Bockemühl
cornelis.bockemuehl at gmail.com
Tue Nov 15 17:41:11 EST 2016
Hello Mathieu,
Right: also for me "something" is changing - just after adding the second
input: I will have to check whether it is indeed the right thing!
So maybe this is indeed the way how it should operate - and I have to see
that it does it the same way also for my own filter.
I was fixed on the expectation that I would have to at least press "Apply"
again - or even be able to define the second input already before doing a
first "Apply" - but maybe this is not what the Paraview designers had in
mind...
However, just reasoning: In a simple case (like also mine) it may not be a
big deal to do the calculation twice, but if it is more "serious", this
extra "Apply" (once without then once more with the second input) looks a
bit weird to me!?
Anyway, let's try to play according to the rules - and change them only
with very serious reasons!
Thanks and regards,
Cornelis
2016-11-15 23:18 GMT+01:00 Mathieu Westphal <mathieu.westphal at kitware.com>:
> Hello
>
> Sorry i missed the part when you said that a standard filter showed this
> behavior.
> Indeed, the behavior you are seeing is normal, considering the input
> management greyed out. One could argue the that it should be authorized to
> change input before applying but it is not supported.
>
> However, this part
> | Now the "Change Input" would be avaliable in the context menu, but
> specifying any additional input NOW has no effect: the calculation is not
> redone any more...
>
> Looks like a bug in your filter. I know nothing about statistics, but a
> tried specifying the optional model input this way with multicorelative,
> and it seems to change trigger a recomputation of the filter with different
> results.
>
> Regards,
>
> Mathieu Westphal
>
> On Tue, Nov 15, 2016 at 10:19 PM, Cornelis Bockemühl <
> cornelis.bockemuehl at gmail.com> wrote:
>
>> Dear Mathieu,
>>
>> As I said I do not think it is a problem in my XML or C++ code, but a
>> "simple user question"! Which is why I explained that it also happens with
>> the "standard filter" from the standard package: Multicorrelative
>> Statistics.
>>
>> For this reason I am now providing also simply the XML for that filter
>> which is from the following file in the paraview sources:
>>
>> ParaViewCore/ServerManager/SMApplication/Resources/filter.xml
>>
>> """""""""""""""""""""""""""""
>> <SourceProxy class="vtkPSciVizMultiCorrelativeStats"
>> label="Multicorrelative Statistics"
>> name="MulticorrelativeStatistics">
>> <Documentation long_help="Compute a statistical model of a dataset
>> and/or assess the dataset with a statistical model."
>> short_help="Compute a statistical model of a dataset
>> and/or assess the dataset with a statistical model.">
>> This filter either computes a statistical model of a dataset or
>> takes
>> such a model as its second input. Then, the model (however it is
>> obtained) may optionally be used to assess the input
>> dataset.<p>
>> This filter computes the covariance matrix for all the arrays you
>> select
>> plus the mean of each array. The model is thus a multivariate
>> Gaussian
>> distribution with the mean vector and variances provided. Data is
>> assessed using this model by computing the Mahalanobis distance for
>> each
>> input point. This distance will always be positive.<p> The
>> learned
>> model output format is rather dense and can be confusing, so it is
>> discussed here. The first filter output is a multiblock dataset
>> consisting of 2 tables: <ol> <li> Raw covariance data.
>> <li> Covariance matrix and its Cholesky decomposition.
>> </ol>
>> The raw covariance table has 3 meaningful columns: 2 titled
>> "Column1" and
>> "Column2" whose entries generally refer to the N arrays you
>> selected when
>> preparing the filter and 1 column titled "Entries" that contains
>> numeric
>> values. The first row will always contain the number of
>> observations in
>> the statistical analysis. The next N rows contain the mean for each
>> of
>> the N arrays you selected. The remaining rows contain covariances of
>> pairs of arrays.<p> The second table (covariance matrix and
>> Cholesky decomposition) contains information derived from the raw
>> covariance data of the first table. The first N rows of the first
>> column
>> contain the name of one array you selected for analysis. These rows
>> are
>> followed by a single entry labeled "Cholesky" for a total of N+1
>> rows.
>> The second column, Mean contains the mean of each variable in the
>> first N
>> entries and the number of observations processed in the final (N+1)
>> row.<p> The remaining columns (there are N, one for each
>> array)
>> contain 2 matrices in triangular format. The upper right triangle
>> contains the covariance matrix (which is symmetric, so its lower
>> triangle
>> may be inferred). The lower left triangle contains the Cholesky
>> decomposition of the covariance matrix (which is triangular, so its
>> upper
>> triangle is zero). Because the diagonal must be stored for both
>> matrices,
>> an additional row is required — hence the N+1
>> rows and
>> the final entry of the column named "Column".</Documentation>
>> <InputProperty command="SetInputConnection"
>> name="Input"
>> port_index="0">
>> <ProxyGroupDomain name="groups">
>> <Group name="sources" />
>> <Group name="filters" />
>> </ProxyGroupDomain>
>> <DataTypeDomain name="input_type">
>> <DataType value="vtkImageData" />
>> <DataType value="vtkStructuredGrid" />
>> <DataType value="vtkPolyData" />
>> <DataType value="vtkUnstructuredGrid" />
>> <DataType value="vtkTable" />
>> <DataType value="vtkGraph" />
>> </DataTypeDomain>
>> <InputArrayDomain name="input_array" />
>> <Documentation>The input to the filter. Arrays from this dataset
>> will
>> be used for computing statistics and/or assessed by a statistical
>> model.</Documentation>
>> </InputProperty>
>> <InputProperty command="SetInputConnection"
>> name="ModelInput"
>> null_on_empty="1"
>> port_index="1">
>> <Hints>
>> <Optional />
>> <!-- No input selection dialog at instantiation -->
>> </Hints>
>> <ProxyGroupDomain name="groups">
>> <Group name="sources" />
>> <Group name="filters" />
>> </ProxyGroupDomain>
>> <DataTypeDomain name="input_type">
>> <DataType value="vtkTable" />
>> <DataType value="vtkMultiBlockDataSet" />
>> </DataTypeDomain>
>> <Documentation>A previously-calculated model with which to assess
>> a
>> separate dataset. This input is optional.</Documentation>
>> </InputProperty>
>> <IntVectorProperty command="SetAttributeMode"
>> default_values="0"
>> name="AttributeMode"
>> number_of_elements="1">
>> <FieldDataDomain enable_field_data="1"
>> name="enum">
>> <RequiredProperties>
>> <Property function="Input"
>> name="Input" />
>> </RequiredProperties>
>> </FieldDataDomain>
>> <Documentation>Specify which type of field data the arrays will be
>> drawn from.</Documentation>
>> </IntVectorProperty>
>> <StringVectorProperty clean_command="ClearAttributeArrays"
>> command="EnableAttributeArray"
>> label="Variables of Interest"
>> name="SelectArrays"
>> number_of_elements_per_command="1"
>> repeat_command="1">
>> <ArrayListDomain name="array_list">
>> <RequiredProperties>
>> <Property function="Input"
>> name="Input" />
>> <Property function="FieldDataSelection"
>> name="AttributeMode" />
>> </RequiredProperties>
>> </ArrayListDomain>
>> <Documentation>Choose arrays whose entries will be used to form
>> observations for statistical analysis.</Documentation>
>> </StringVectorProperty>
>> <IntVectorProperty animateable="0"
>> command="SetTask"
>> default_values="3"
>> name="Task"
>> number_of_elements="1">
>> <EnumerationDomain name="task_list">
>> <Entry text="Detailed model of input data"
>> value="0" />
>> <Entry text="Model a subset of the data"
>> value="1" />
>> <Entry text="Assess the data with a model"
>> value="2" />
>> <Entry text="Model and assess the same data"
>> value="3" />
>> </EnumerationDomain>
>> <Documentation>Specify the task to be performed: modeling and/or
>> assessment. <ol> <li> "Detailed model of input data,"
>> creates a set of output tables containing a calculated statistical
>> model of the <b>entire</b> input dataset;</li>
>> <li> "Model a subset of the data," creates an output table
>> (or
>> tables) summarizing a <b>randomly-chosen subset</b>
>> of the
>> input dataset;</li> <li> "Assess the data with a
>> model,"
>> adds attributes to the first input dataset using a model provided
>> on
>> the second input port; and</li> <li> "Model and
>> assess the
>> same data," is really just operations 2 and 3 above applied to
>> the same
>> input dataset. The model is first trained using a fraction of the
>> input
>> data and then the entire dataset is assessed using that
>> model.</li> </ol> When the task includes creating a
>> model
>> (i.e., tasks 2, and 4), you may adjust the fraction of the input
>> dataset used for training. You should avoid using a large
>> fraction of
>> the input data for training as you will then not be able to detect
>> overfitting. The <i>Training fraction</i> setting
>> will be
>> ignored for tasks 1 and 3.</Documentation>
>> </IntVectorProperty>
>> <DoubleVectorProperty animateable="1"
>> command="SetTrainingFraction"
>> default_values="0.1"
>> name="TrainingFraction"
>> number_of_elements="1">
>> <DoubleRangeDomain max="1"
>> min="0"
>> name="training_range" />
>> <Documentation>Specify the fraction of values from the input
>> dataset to
>> be used for model fitting. The exact set of values is chosen at
>> random
>> from the dataset.</Documentation>
>> </DoubleVectorProperty>
>> <OutputPort index="0"
>> name="Statistical Model" />
>> <OutputPort index="1"
>> name="Assessed Data" />
>> <Hints>
>> <Visibility replace_input="1" />
>> <!-- View can be used to specify the preferred view for the proxy
>> -->
>> <View type="SpreadSheetView" />
>> </Hints>
>> </SourceProxy>
>> <!-- MulticorrelativeStatistics -->
>> <!-- ====================================================================
>> -->
>> """""""""""""""""""""""""""""
>>
>> You find the explanation about the "optional" model input, and also the
>> second "InputProperty" tag, with the name "ModelInput", and the "Hint"
>> "optional".
>>
>> My problem is that if I am running ParaView just normally and try to
>> provide a first and second input to that filter, I do not find a way to
>> provide the second one that is "optional"!
>>
>> With my own filter I found now some stupid workaround: just drop the
>> "optional" in the "Hints": then it is not any more optional, but a window
>> pops up that asks for the inputs. In this case I can of course specify the
>> second input - or leave it: It is then a question of the RequestData
>> function in the C++ to handle this case properly: a second input with a
>> null pointer.
>>
>> But this is
>>
>> a) probably not how it SHOULD work, and
>> b) not an option for the standard filters (such as Multicorrelative
>> Statistics) - if I do not want to change all the paraview sources (xml) and
>> recompile...
>>
>> Sorry to bother this list at all because I am afraid that the solution is
>> in some very simple and "almost obvious" little thing that I have
>> overlooked in the paraview GUI... ;-)
>>
>> Regards,
>> Cornelis
>>
>>
>> 2016-11-15 21:12 GMT+01:00 Mathieu Westphal <mathieu.westphal at kitware.com
>> >:
>>
>>> Hello
>>>
>>> Can you provide your xml file ?
>>>
>>> Regards,
>>>
>>> Mathieu Westphal
>>>
>>> On Tue, Nov 15, 2016 at 9:07 PM, Cornelis Bockemühl <
>>> cornelis.bockemuehl at gmail.com> wrote:
>>>
>>>> Looks like I may have to provide an example that everybody can follow!?
>>>>
>>>> The "Multicorrelative Statistics" filter is already such an example!
>>>>
>>>> Reading the docs and looking into the server XML it is obvious that you
>>>> can optionally provide a model as a second input port. However, I cannot
>>>> find any way how to specify this second input:
>>>>
>>>> - Directly selecting it (next to the primary input) has the effect that
>>>> the filter is greyed out in Paraview - no chance!
>>>>
>>>> - Selecting only the primary data input allows to choose the
>>>> "Multicorrelative Statistics" filter just fine. I would expect that before
>>>> pressing "Apply" I should still specify the second input (the model thus),
>>>> but no chance: In the context menu, the "Change Input" option is greyed out
>>>> - and I cannot find any other way to enter any second input data.
>>>>
>>>> - Pressing "Apply" does apply the filter, but without the optional
>>>> model data. Now the "Change Input" would be avaliable in the context menu,
>>>> but specifying any additional input NOW has no effect: the calculation is
>>>> not redone any more...
>>>>
>>>> Bottom line: My first example was from a self-written filter, so there
>>>> is still the possibility that I have done something wrong. But with the
>>>> standard filter that comes with every Paraview installation I would expect
>>>> that there MUST be some way to provide that second input data item!?
>>>>
>>>> I am simply lost here!
>>>>
>>>> Regards,
>>>> Cornelis
>>>>
>>>> >Dear Parview users,
>>>> >
>>>> >This question seems trivial - but I do not find any solution on my own!
>>>> >
>>>> >I have a filter with one mandatory and two optional input ports, and this
>>>> >is how I proceed with it:
>>>> >
>>>> >- Select some data object, then call that filter. It does not open the
>>>> >input port item selection dialog because the one mandatory input is already
>>>> >satisfied.
>>>> >
>>>> >- I want to add one of the optional inputs (or both) - but the "change
>>>> >input" option is greyed! Strange - because for me this would be the logical
>>>> >moment to specify additional input, i.e.: BEFORE pressing the Apply
>>>> >button...
>>>> >
>>>> >- Ok, I press the Apply button thus. Of course the output is not what I
>>>> >want because the optional inputs were missing...
>>>> >
>>>> >- However, now I can choose also the "change input" option - and I do so. I
>>>> >select the two optional inputs. But now nothing happens any more - and now
>>>> >the Apply button is grey, so no way to trigger an update of the output!
>>>> >
>>>> >To me this does not look very logical, so I assume that I am missing some
>>>> >point...
>>>> >
>>>> >The other "intuitive option" would be to select all the desired input
>>>> >items, and only then open the filter. However this is impossible from the
>>>> >beginning because now the filter is already greyed in the menu as being
>>>> >"not applicable"!
>>>> >
>>>> >Thanks for any helpful hints!
>>>> >
>>>> >Regards,
>>>> >Cornelis Bockemühl
>>>>
>>>>
>>>> --
>>>> Cornelis Bockemühl
>>>> Basel, Schweiz
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>>
>>>
>>
>>
>> --
>> Cornelis Bockemühl
>> Basel, Schweiz
>>
>
>
--
Cornelis Bockemühl
Basel, Schweiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161115/7a025a88/attachment.html>
More information about the ParaView
mailing list