[vtkusers] Problems with visualizing multiple scalars on vtkDataSetMapper
Sarah Macumber
S.Macumber at QuestReliability.com
Fri Jul 11 18:55:59 EDT 2008
Thanks Gerrick & Thanks Dave, your explainations make a lot of sense and I will watch for that in the future. It would be great if there were some notes on the doc pages saying that the data classes do not explicity call those events. I agree that functions like SetArray() maybe shouldn't call Modified() but what about ComputeBounds() ? Kinda seems like even though you haven't called Modified() the ComputeBounds() function should re-calculate the array bounds.
Have a great weekend!
Sarah
________________________________
From: David Cole [mailto:david.cole at kitware.com]
Sent: Fri 7/11/2008 5:07 PM
To: Sarah Macumber
Cc: Gerrick Bivins; VTK-users
Subject: Re: [vtkusers] Problems with visualizing multiple scalars on vtkDataSetMapper
It's intentional with better performance in mind...
This is one of the things you just have to come to grips with when using VTK. Some things call Modified for you when you change a value, some things do not. The basic philosophy is to call Modified automatically for most properties of most objects, but *not* to call Modified on things that will probably be performance critical for developers that use them. SetTuple is something that may be called thousands of times (or even way more...). Usually, the caller of those many SetTuples would not want a Modified event fired on the object for every call. One at the end suffices for most cases. So we leave it to you, who know more about the nature of your data anyhow...
:-)
HTH,
David
On Fri, Jul 11, 2008 at 5:36 PM, Sarah Macumber <S.Macumber at questreliability.com> wrote:
Hi Gerrick, I figured it out.
vtkDoubleArray is not calling Modified() internally after calls like Initialize() SetTuple() or SetArray() . An explicit call to Modified() fixes the issue. I am not clear why this is not being done.
I am developing in Dot Net.
Sarah
________________________________
From: Gerrick Bivins [mailto:gbivins at objectreservoir.com]
Sent: Fri 7/11/2008 4:07 PM
To: Sarah Macumber; VTK-users
Subject: Re: [vtkusers] Problems with visualizing multiple scalars on vtkDataSetMapper
Hey, what lang are you using, C++,Java, something else?
When are you calling the "getRange" method?
I could probably explain it better if I could see your setup code.
Gerrick
On 7/11/08 3:56 PM, "Sarah Macumber" <S.Macumber at QuestReliability.com>
wrote:
> Hi Gerrick thanks for the helpful reply, do you know why
>
> scalars.setArray(double, length,1);
> double [] range = scalars.getRange();
>
> the range of the data is not updated after you have set a new array? Even if
> I call ComputeRange I the value passed by from GetRange is not updated and I
> have to manually (for loop) compute my scalar range for the call,
>
> mapper.SetScalarRange( range);
>
> Thanks, Sarah
>
> ________________________________
>
> From: Gerrick Bivins [mailto:gbivins at objectreservoir.com]
> Sent: Fri 7/11/2008 1:33 PM
> To: Sarah Macumber; VTK-users
> Subject: Re: [vtkusers] Problems with visualizing multiple scalars on
> vtkDataSetMapper
>
>
>
> No Prob.
> I actually use vtkPointData interface which inherits from
> vtkDatasetAttribute rather than vtkFieldData
> http://www.vtk.org/doc/nightly/html/classvtkDataSetAttributes.html
>
> and then add my scalar arrays to that. For example:
>
> vtkFloatArray[] scalars = new vtkFloatArray[ numberOfScalars ];
> ...
> for( int f = 0; f < numberOfScalars; ++f )
> {
>
> scalars [f] = new vtkFloatArray();
> scalars [f].SetName( scalarComponents.get(f).GetName() );
> dataset.GetPointData().AddArray( scalars [f] );
> }
> ...
>
> Gerrick
>
> On 7/11/08 12:51 PM, "Sarah Macumber" <S.Macumber at QuestReliability.com>
> wrote:
>
>> Hey Gerrick thanks for the quick reply, can you please say more. How do you
>> connect your field data to begin with? Also I am using a vtkDataSetMapper
>> because I have 3D data and I think it may have issues with visualizing more
>> than the 0th scalar. When I try your code I get it to render correctly on
>> the
>> first pass but if I try to switch scalars I get a solid color rendering so it
>> is not switching to the other field.
>>
>> If you can send some code which shows how you connect your "field data" to
>> your polydata / grid that would be very useful.
>>
>> Thanks Sarah
>>
>> ________________________________
>>
>> From: Gerrick Bivins [mailto:gbivins at objectreservoir.com]
>> Sent: Fri 7/11/2008 12:08 PM
>> To: Sarah Macumber; VTK-users
>> Subject: Re: [vtkusers] Problems with visualizing multiple scalars on
>> vtkDataSetMapper
>>
>>
>>
>> Hi Sarah,
>> How are you setting up your mapper?
>>
>> I use a lookup table and setup my mapper something like this:
>> ...
>> lut = new vtkLookupTable();
>> lut.SetNumberOfTableValues(256);
>> lut.SetHueRange( 2.0f / 3.0f, 0.0f );
>>
>> mapper = new vtkPolyDataMapper();
>> mapper.SetLookupTable( lut );
>> mapper.SetScalarModeToUsePointFieldData();
>> ...
>>
>> Then anytime I change the current scalar, I update the mapper:
>>
>> void updateCurrentScalarForMapper( String currentScalar,
>> double [] currentScalarRange )
>> {
>> mapper.SelectColorArray( currentScalar );
>> mapper.SetScalarRange( currentScalarRange );
>> }
>>
>>
>>
>> Gerrick
>>
>>
>> On 7/11/08 11:46 AM, "Sarah Macumber" <S.Macumber at QuestReliability.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I have 2D / 3D data so I am using an vtkUnstructuredGrid & a
>>> vtkDataSetMapper
>>> to visualize my data. My data has several associated scalar values which I
>>> want to be able to switch between for coloring purposes. Calling SetScalars
>>> with the new scalar value does not update the visualization pipeline as
>>> described in this thread :
>>> Grid.GetCellData().SetScalars(currentScalars);
>>>
>>> http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html
>>> <http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html>
>>>
>>> but I still don't fully understand what to do about it.
>>>
>>> What is the best way to switch your viewable scalar value on a
>>> vtkUnstructuredGrid?
>>>
>>> Thanks, Sarah
>>>
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>>
>
>
>
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list