[vtkusers] vtkThreshold - multiple Input Ports?

Bhanu Hariharan bhanu at petrotel.com
Mon Nov 25 13:58:20 EST 2013


Thanks for the correction David.
One more question, if Array1 happens to have 3 components
(Array1.SetNumberofComponents(3) but Array2 only 1 component) would I still
be using AddArray like above?

That is on Viewport 1 I want to display a vector and Viewport 2 should be a
scalar.

Thanks,
Bhanu


On Mon, Nov 25, 2013 at 12:03 PM, David E DeMarle
<dave.demarle at kitware.com>wrote:

> You want TWO threshold filters, but otherwise yes that is the idea. See
> edits to the pseudocode below.
>
>
>> Array1.Setname("array1");
>> myUnstructuredGrid.AddArray(Array1);
>>
>> Array2.Setname("array2");
>> myUnstructuredGrid.AddArray(Array2);
>>
>>
>> Thresholdfilter.SetInput(myUnstructuredGrid);
>>
>> //Viewport 1
>> ==============
>>
>> arrayname = "array1";
>> Thresholdfilter->SetInputArrayToProcess(0, 0, 0,
>> vtkDataObject::FIELD_ASSOCIATION_CELLS, arrayname );
>> //Set Mapper1 and Actor1 etc.
>> Viewport1 -> Render();
>>
>>
> ThresholdFilter2 = vtkThresholdFilter::New();
> Thresholdfilter2->SetInput(myUnstructuredGrid);
>
>
>
>> //Viewport 2
>> ===========
>> arrayname = "array2";
>>
>
> /*
>
>> Thresholdfilter->SetInputArrayToProcess(1, 0, 0,
>> vtkDataObject::FIELD_ASSOCIATION_CELLS, arrayname );
>>
> */
>
> Thresholdfilter2->SetInputArrayToProcess(1, 0, 0,
> vtkDataObject::FIELD_ASSOCIATION_CELLS, arrayname );
>
> //Set Mapper2 and Actor2 etc.
>> Viewport2 -> Render();
>>
>>
>> Thanks,
>> Bhanu
>>
>>
>>
>> On Mon, Nov 25, 2013 at 11:45 AM, David E DeMarle <
>> dave.demarle at kitware.com> wrote:
>>
>>> Instead of calling data->SetScalars() to put the array choice on the
>>> data call filter->SetInputArrayToProcess() to put the array choice onto
>>> each filter.
>>>
>>>
>>> David E DeMarle
>>> Kitware, Inc.
>>> R&D Engineer
>>> 21 Corporate Drive
>>> Clifton Park, NY 12065-8662
>>> Phone: 518-881-4909
>>>
>>>
>>> On Mon, Nov 25, 2013 at 9:31 AM, Bhanu Hariharan <bhanu at petrotel.com>wrote:
>>>
>>>> Thanks David for the suggestion of Branching pipeline. Are there any
>>>> vtk examples for branching a pipeline.
>>>>
>>>> I had previously attempted to do something like this
>>>>
>>>> //Viewport 1
>>>> myUnstructuredGrid.SetScalars(Array1);
>>>>
>>>> Thresholdfilter1.SetInput(myUnstructuredGrid);
>>>> //Set Mapper1 and Actor1 etc.
>>>> Viewport1 -> Render();
>>>>
>>>> //Viewport 2
>>>> myUnstructuredGrid.SetScalars(Array2);
>>>>
>>>> Thresholdfilter2.SetInput(myUnstructuredGrid);
>>>> //Set Mapper2 and Actor2 etc.
>>>> Viewport2 -> Render();
>>>>
>>>> But I ended up getting same rendering in both - i.e. Array2 in both
>>>> viewports. Should I have seen different in both viewports? But if I made a
>>>> deep copy of myUnstructuredGrid and used that for Thresholdfilter2, then I
>>>> got Array 1 in Viewport 1 and Array 2 in viewport 2. Obviously I do not
>>>> want to make a copy of myUnstructuredGrid as it can be  huge.
>>>>
>>>> Did you mean to suggest something different?
>>>>
>>>> Thanks,
>>>> Bhanu
>>>>
>>>>
>>>>
>>>> On Mon, Nov 25, 2013 at 7:56 AM, David E DeMarle <
>>>> dave.demarle at kitware.com> wrote:
>>>>
>>>>> The number of inputs that the threshold filter accepts cannot be
>>>>> changed, without rewriting it that is.
>>>>>
>>>>> Instead, think about making a branching pipeline, that is sending your
>>>>> unstructured grid into multiple threshold filters, the output of each is to
>>>>> be rendered independently.
>>>>>
>>>>>
>>>>> David E DeMarle
>>>>> Kitware, Inc.
>>>>> R&D Engineer
>>>>> 21 Corporate Drive
>>>>> Clifton Park, NY 12065-8662
>>>>> Phone: 518-881-4909
>>>>>
>>>>>
>>>>> On Thu, Nov 21, 2013 at 3:22 PM, Bhanu Hariharan <bhanu at petrotel.com>wrote:
>>>>>
>>>>>> Dear vtk-users,
>>>>>>
>>>>>> I am trying to do set up multiple Input Ports for a vtkThreshold type
>>>>>> of filter.
>>>>>> Input to the threshold filter is a vtkUnstructuredGrid.
>>>>>>
>>>>>> My code looks like
>>>>>>
>>>>>> myThresholdfilter.SetInput(port0, myUnstructuredGrid);
>>>>>> myThresholdfilter.SetInput(port1, myUnstructuredGrid);
>>>>>>
>>>>>>
>>>>>> I would like to setup multiple viewports in my rendering window and
>>>>>> in each viewport I would like a different grid property rendered. The grid
>>>>>> property is a scalar array added to myUnstructuredGrid.
>>>>>>
>>>>>> (I thought I can render different image in different viewports this
>>>>>> way - I may be wrong here to begin with so if anyone wants to correct me
>>>>>> here please feel free).
>>>>>>
>>>>>> At run time as soon as the debugger hits the line
>>>>>> myThresholdfilter.SetInput(port1, myUnstructuredGrid);
>>>>>> it complaints that I attempted to use port index 1 when number of
>>>>>> ports is 1.
>>>>>>
>>>>>> I can't even seem to do
>>>>>> myThresholdfilter.SetNumberofInputPorts();
>>>>>> as this is a protected method.
>>>>>>
>>>>>> How do I set up multiple input ports for a vtkThreshold filter.
>>>>>> Please if anyone can shed some light on it, it would be a great help as I
>>>>>> have spent a lot of time on it trying this and that without any luck.
>>>>>>
>>>>>> Thanks in advance,
>>>>>> Bhanu
>>>>>>
>>>>>> ------------------------------
>>>>>> *DISCLAIMER*: This e-mail and any files transmitted with it
>>>>>> ("Message") is intended only for the use of the recipient(s) named above
>>>>>> and may contain confidential information. You are hereby notified that the
>>>>>> taking of any action in reliance upon, or any review, retransmission,
>>>>>> dissemination, distribution, printing or copying of this Message or any
>>>>>> part thereof by anyone other than the intended recipient(s) is strictly
>>>>>> prohibited. If you have received this Message in error, you should delete
>>>>>> this Message immediately and advise the sender by return e-mail. Opinions,
>>>>>> conclusions and other information in this Message that do not relate to the
>>>>>> official business of PETROTEL  or its affiliated Companies shall be
>>>>>> understood as neither given nor endorsed by PETROTEL or any of its
>>>>>> affiliated companies.
>>>>>> _______________________________________________
>>>>>> 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 VTK FAQ at:
>>>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> ------------------------------
>>>> *DISCLAIMER*: This e-mail and any files transmitted with it
>>>> ("Message") is intended only for the use of the recipient(s) named above
>>>> and may contain confidential information. You are hereby notified that the
>>>> taking of any action in reliance upon, or any review, retransmission,
>>>> dissemination, distribution, printing or copying of this Message or any
>>>> part thereof by anyone other than the intended recipient(s) is strictly
>>>> prohibited. If you have received this Message in error, you should delete
>>>> this Message immediately and advise the sender by return e-mail. Opinions,
>>>> conclusions and other information in this Message that do not relate to the
>>>> official business of PETROTEL  or its affiliated Companies shall be
>>>> understood as neither given nor endorsed by PETROTEL or any of its
>>>> affiliated companies.
>>>>
>>>
>>>
>>
>> ------------------------------
>> *DISCLAIMER*: This e-mail and any files transmitted with it ("Message")
>> is intended only for the use of the recipient(s) named above and may
>> contain confidential information. You are hereby notified that the taking
>> of any action in reliance upon, or any review, retransmission,
>> dissemination, distribution, printing or copying of this Message or any
>> part thereof by anyone other than the intended recipient(s) is strictly
>> prohibited. If you have received this Message in error, you should delete
>> this Message immediately and advise the sender by return e-mail. Opinions,
>> conclusions and other information in this Message that do not relate to the
>> official business of PETROTEL  or its affiliated Companies shall be
>> understood as neither given nor endorsed by PETROTEL or any of its
>> affiliated companies.
>>
>
>

-- 

------------------------------
*DISCLAIMER*: This e-mail and any files transmitted with it ("Message") is 
intended only for the use of the recipient(s) named above and may contain 
confidential information. You are hereby notified that the taking of any 
action in reliance upon, or any review, retransmission, dissemination, 
distribution, printing or copying of this Message or any part thereof by 
anyone other than the intended recipient(s) is strictly prohibited. If you 
have received this Message in error, you should delete this Message 
immediately and advise the sender by return e-mail. Opinions, conclusions 
and other information in this Message that do not relate to the official 
business of PETROTEL  or its affiliated Companies shall be understood as 
neither given nor endorsed by PETROTEL or any of its affiliated companies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131125/df00d7e9/attachment.htm>


More information about the vtkusers mailing list