[vtkusers] Problems with visualizing multiple scalars on vtkDataSetMapper
Gerrick Bivins
gbivins at objectreservoir.com
Fri Jul 11 18:00:20 EDT 2008
Good to hear!
Because of the DemandDrivenPipeline nature of VTK, it probably doesn't
trigger an update until things are rendered. I have to force this so that
this so that every time I change scalars, I immediately call Render() to
make it update. Otherwise it doesn't change until I move the mouse.
Anyway, you got it workin so that's good!!
TGIF!!!
;)
Gerrick
On 7/11/08 4: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
>>>
>>>
>>>
>>
>>
>>
>
>
>
More information about the vtkusers
mailing list