[Paraview-developers] apply a filter to only a selected block

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Sep 2 10:42:48 EDT 2014


Great! Glad it's working.

On Tue, Sep 2, 2014 at 10:17 AM, Felipe Bordeu
<felipe.bordeu at ec-nantes.fr> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Le 28/08/2014 18:49, Utkarsh Ayachit a écrit :
>> Maybe go the custom filter route instead. You cannot have a choice of
>> filters to chose from a comb-box, in that case. But you can  create a
>> ExtractBlock+Filter version of every filter you're interested in.
>> Something similar to how we deal with file-series readers, for
>> example.
>>
>
> It works like a charm!!!
>
> I created a class (called vtkApplyOnBlocksFilter) to apply a filter to
> only selected blocks. Then a vtkSIMetaFilterProxy (like the
> vtkSIMetaReaderProxy).And now just generate one "SourceProxy" entry in
> the xml description for every filter that I want to use.
>
> Life is so much easier now. The added bonus. I put all theses new
> filters in a submenu "On Block Filters" with theirs original icons.
>
> Now any new ApplyOnBlocksFilters filters can be added to ParaView using
> only a xml description.
>
> Thanks Utkarsh and all the ParaView team.
>
> Felipe
>
>>
>>
>> On Thu, Aug 28, 2014 at 12:04 PM, Felipe Bordeu
>> <felipe.bordeu at ec-nantes.fr> wrote:
>> Thanks,
>>
>> It works, but (I know there is always a but)...
>>
>> 1) Paraview (at the creation of my mainfilter) calls RequestInformation
>> on all the internal filters available, and because they don't have
>> connections, I get plenty of :
>>
>> ERROR: In
>> /Big/fbordeu/sources/ParaView4/VTK/Common/ExecutionModel/vtkExecutive.cxx,
>> line 783
>> vtkPVCompositeDataPipeline (0x686f5b0): Algorithm
>> vtkPVArrayCalculator(0x6875210) returned failure for request:
>> vtkInformation (0x686dde0)
>>
>> ERROR: In
>> /Big/fbordeu/sources/ParaView4/VTK/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx,
>> line 710
>> vtkPVCompositeDataPipeline (0x6940a30): Input port 0 of algorithm
>> vtkPVMetaClipDataSet(0x6921660) has 0 connections but is not optional.
>>
>>
>> ERROR: In
>> /Big/fbordeu/sources/ParaView4/VTK/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx,
>> line 710
>> vtkPVCompositeDataPipeline (0x6969450): Input port 0 of algorithm
>> vtkThreshold(0x696f170) has 0 connections but is not optional.
>>
>>
>> ERROR: In
>> /Big/fbordeu/sources/ParaView4/VTK/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx,
>> line 710
>> vtkPVCompositeDataPipeline (0x6977740): Input port 0 of algorithm
>> vtkDataSetSurfaceFilter(0x697f540) has 0 connections but is not optional.
>>
>> 2) The panels of filters with custom widget are not generated correctly
>> (the case of the calculator filter).
>>
>> 3) Because of the filters don't have information about the input, the 3D
>> widget are not plot in the renderview ( the plane of the clip filter)
>>
>> I know I'm trying to do something tricky, but we do this kind of
>> operation often (extract a block apply a filter, extract another block
>> apply a filter, extract all the remaining block, and then do  "append
>> datasets" to recover a multi-block structure). And even with this we
>> lost the original structure of the multi-block.
>>
>> the point 2 and tree are not that important (we can set the data from
>> the panel, and for the calculator we still have the function field)
>>
>> Felipe
>>
>> ps: in the attachement there is an image of the filter
>>
>> Le 28/08/2014 16:30, Utkarsh Ayachit a écrit :
>>>>> I am not sure I'd recommend anyone to do this :), but since you're
>>>>> experimenting .. here's something to try:
>>>>>
>>>>> Don't do the SetInputDataObject() in RequestInformation, try passing
>>>>> the output of ExtractBlock to the input in RequestData() instead.
>>>>>
>>>>> Utkarsh
>>>>>
>>>>> On Wed, Aug 27, 2014 at 10:03 AM, Felipe Bordeu
>>>>> <felipe.bordeu at ec-nantes.fr> wrote:
>>>>> Hi,
>>>>>
>>>>> I'm writing a filter to apply a filter(for example a cut, or clip ) to
>>>>> only a selected block of a vtkMultiBlockData.
>>>>>
>>>>> So I start reading the implementation of the vtkExtractBlock and
>>>>> vtkPVGlyphFilter (because I what to select interactively the filter to
>>>>> apply in the same way we can choose the type of glyph).
>>>>>
>>>>> Now the problematic point. This is the  part of the xml to select the
>>>>> filter to apply (in the same way as the glyph filter) :
>>>>>
>>>>>
>>>>> <InputProperty command="SetalgoToApply"
>>>>>                label="Filter To Apply"
>>>>>                 name="Source">
>>>>>
>>>>>     <ProxyGroupDomain name="groups">
>>>>>         <Group name="filters" />
>>>>>     </ProxyGroupDomain>
>>>>>
>>>>>     <DataTypeDomain name="input_type" composite_data_supported="1">
>>>>>         <DataType value="vtkDataObject" />
>>>>>     </DataTypeDomain>
>>>>>
>>>>>     <ProxyListDomain name="proxy_list">
>>>>>         <Proxy group="filters" name="Cut" />
>>>>>         <!-- More filter here -->
>>>>>     </ProxyListDomain>
>>>>> </InputProperty>
>>>>>
>>>>> The interface is generated correctly in paraview.
>>>>> In the code a receive the algorithm with this function
>>>>>
>>>>> vtkfiltertest::vtkSetMacro(algoToApply, vtkAlgorithmOutput*);
>>>>>
>>>>>
>>>>> But I don't know how to set the input to the algorithm.
>>>>>
>>>>> I tried this (vtkDataSet* tmpinput  is a pointer to some data, )
>>>>>
>>>>> void vtkfiltertest::SetalgoToApply (vtkAlgorithmOutput* _arg) {
>>>>>    if (this->algoToApply != _arg) {
>>>>>      this->algoToApply = _arg;
>>>>>      this->algoToApply->GetProducer()->SetInputDataObject(0,tmpinput);
>>>>>      this->Modified();
>>>>>    }
>>>>> }
>>>>>
>>>>> and also in
>>>>> vtkfiltertest::RequestInformation(){
>>>>> ...
>>>>> this->algoToApply->GetProducer()->SetInputDataObject(0,tmpinput);
>>>>> ..
>>>>> }
>>>>>
>>>>> but in paraview when I create the vtkfiltertest (click in the menu) I
>>>>> get this:
>>>>>
>>>>> ERROR: In
>>>>> /Big/fbordeu/sources/ParaView4/VTK/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx,
>>>>> line 710
>>>>> vtkPVCompositeDataPipeline (0x7845e80): Input port 0 of algorithm
>>>>> vtkPVMetaSliceDataSet(0x783d880) has 0 connections but is not optional.
>>>>>
>>>>> Is this possible of I'm asking to much???
>>>>>
>>>>> Thanks.
>>>>>> _______________________________________________
>>>>>> Paraview-developers mailing list
>>>>>> Paraview-developers at paraview.org
>>>>>> http://public.kitware.com/mailman/listinfo/paraview-developers
>>
>
> - --
> Felipe Bordeu Weldt
> Ingénieur de Recherche
> - -------------------------------------
> Tél. : 33 (0)2 40 37 16 57
> Fax. : 33 (0)2 40 74 74 06
> Felipe.Bordeu at ec-nantes.fr
> Institut GeM - UMR CNRS 6183
> École Centrale Nantes
> 1 Rue de La Noë, 44321 Nantes, FRANCE
> - -------------------------------------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iQEcBAEBAgAGBQJUBdGGAAoJEE/fMfNgU9/DcCYH/ic1RytF5WNehxqYeyerNeBQ
> 0IymWxeiWm+Zi5cOKwx4ebdSkl6Mmks1httD7+ojGqppSTJ6feNaQQhx/29haQv6
> z99Yc5tefz5qIRsKQnfI36fgDhl+o/Fp7025L/6gmE2y+lTdgbIaiHRsp11ZVgk0
> ys2wzdUbb69UFU++9pWhO6E7ebPG8jVfqMAL3QCDmQfqY1tDdGj8o5GRf8Gm2a2s
> lZeSrzT0MibiyMjkKzWF3ygDiJa1BN0fJcO0+cYTxn9yUG/xaI16iImBcvpW97Rg
> GD7ctUQm2ooUzMugpMekFtIJWzIIj61kBqBsmSYYQecjcqGheBgfT2whTO4enOc=
> =btJx
> -----END PGP SIGNATURE-----
> _______________________________________________
> Paraview-developers mailing list
> Paraview-developers at paraview.org
> http://public.kitware.com/mailman/listinfo/paraview-developers


More information about the Paraview-developers mailing list