It&#39;s intentional with better performance in mind...<div><br></div><div>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...</div>
<div><br></div><div>:-)</div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br><br><div class="gmail_quote">On Fri, Jul 11, 2008 at 5:36 PM, Sarah Macumber &lt;<a href="mailto:S.Macumber@questreliability.com">S.Macumber@questreliability.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Gerrick, I figured it out.<br>
<br>
vtkDoubleArray is not calling Modified() internally after calls like Initialize() SetTuple() or SetArray() . &nbsp;An explicit call to Modified() fixes the issue. &nbsp;I am not clear why this is not being done.<br>
<br>
I am developing in Dot Net.<br>
<div class="Ih2E3d"><br>
Sarah<br>
<br>
________________________________<br>
<br>
From: Gerrick Bivins [mailto:<a href="mailto:gbivins@objectreservoir.com">gbivins@objectreservoir.com</a>]<br>
</div>Sent: Fri 7/11/2008 4:07 PM<br>
<div><div></div><div class="Wj3C7c">To: Sarah Macumber; VTK-users<br>
Subject: Re: [vtkusers] Problems with visualizing multiple scalars on vtkDataSetMapper<br>
<br>
<br>
<br>
Hey, what lang are you using, C++,Java, something else?<br>
<br>
When are you calling the &quot;getRange&quot; method?<br>
I could probably explain it better if I could see your setup code.<br>
Gerrick<br>
<br>
On 7/11/08 3:56 PM, &quot;Sarah Macumber&quot; &lt;S.Macumber@QuestReliability.com&gt;<br>
wrote:<br>
<br>
&gt; Hi Gerrick thanks for the helpful reply, do you know why<br>
&gt;<br>
&gt; &nbsp; &nbsp;scalars.setArray(double, length,1);<br>
&gt; &nbsp; &nbsp;double [] range = scalars.getRange();<br>
&gt;<br>
&gt; the range of the data is not updated after you have set a new array? &nbsp;Even if<br>
&gt; I call ComputeRange I the value passed by from GetRange is not updated and I<br>
&gt; have to manually (for loop) compute my scalar range for the call,<br>
&gt;<br>
&gt; mapper.SetScalarRange( range);<br>
&gt;<br>
&gt; Thanks, Sarah<br>
&gt;<br>
&gt; ________________________________<br>
&gt;<br>
&gt; From: Gerrick Bivins [mailto:<a href="mailto:gbivins@objectreservoir.com">gbivins@objectreservoir.com</a>]<br>
&gt; Sent: Fri 7/11/2008 1:33 PM<br>
&gt; To: Sarah Macumber; VTK-users<br>
&gt; Subject: Re: [vtkusers] Problems with visualizing multiple scalars on<br>
&gt; vtkDataSetMapper<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; No Prob.<br>
&gt; I actually use vtkPointData interface &nbsp;which inherits from<br>
&gt; vtkDatasetAttribute rather than vtkFieldData<br>
&gt; <a href="http://www.vtk.org/doc/nightly/html/classvtkDataSetAttributes.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkDataSetAttributes.html</a><br>
&gt;<br>
&gt; and then add my scalar arrays to that. For example:<br>
&gt;<br>
&gt; &nbsp;vtkFloatArray[] scalars = new vtkFloatArray[ numberOfScalars ];<br>
&gt; ...<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;for( int f = 0; f &lt; numberOfScalars; ++f )<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;{<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scalars [f] = new vtkFloatArray();<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scalars [f].SetName( scalarComponents.get(f).GetName() );<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataset.GetPointData().AddArray( scalars [f] );<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt; ...<br>
&gt;<br>
&gt; Gerrick<br>
&gt;<br>
&gt; On 7/11/08 12:51 PM, &quot;Sarah Macumber&quot; &lt;S.Macumber@QuestReliability.com&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;&gt; Hey Gerrick thanks for the quick reply, can you please say more. &nbsp;How do you<br>
&gt;&gt; connect your field data to begin with? &nbsp;Also I am using a vtkDataSetMapper<br>
&gt;&gt; because I have 3D data and I think it may have issues with visualizing more<br>
&gt;&gt; than the 0th scalar. &nbsp;When I try your code I get it to render correctly on<br>
&gt;&gt; the<br>
&gt;&gt; first pass but if I try to switch scalars I get a solid color rendering so it<br>
&gt;&gt; is not switching to the other field.<br>
&gt;&gt;<br>
&gt;&gt; If you can send some code which shows how you connect your &quot;field data&quot; to<br>
&gt;&gt; your polydata / grid that would be very useful.<br>
&gt;&gt;<br>
&gt;&gt; Thanks Sarah<br>
&gt;&gt;<br>
&gt;&gt; ________________________________<br>
&gt;&gt;<br>
&gt;&gt; From: Gerrick Bivins [mailto:<a href="mailto:gbivins@objectreservoir.com">gbivins@objectreservoir.com</a>]<br>
&gt;&gt; Sent: Fri 7/11/2008 12:08 PM<br>
&gt;&gt; To: Sarah Macumber; VTK-users<br>
&gt;&gt; Subject: Re: [vtkusers] Problems with visualizing multiple scalars on<br>
&gt;&gt; vtkDataSetMapper<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi Sarah,<br>
&gt;&gt; How are you setting up your mapper?<br>
&gt;&gt;<br>
&gt;&gt; I use a lookup table and setup my mapper something like this:<br>
&gt;&gt; ...<br>
&gt;&gt; &nbsp;lut = new vtkLookupTable();<br>
&gt;&gt; &nbsp;lut.SetNumberOfTableValues(256);<br>
&gt;&gt; &nbsp;lut.SetHueRange( 2.0f / 3.0f, 0.0f );<br>
&gt;&gt;<br>
&gt;&gt; &nbsp;mapper = new vtkPolyDataMapper();<br>
&gt;&gt; &nbsp;mapper.SetLookupTable( lut );<br>
&gt;&gt; &nbsp;mapper.SetScalarModeToUsePointFieldData();<br>
&gt;&gt; ...<br>
&gt;&gt;<br>
&gt;&gt; Then anytime I change the current scalar, I update the mapper:<br>
&gt;&gt;<br>
&gt;&gt; void updateCurrentScalarForMapper( String currentScalar,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double [] currentScalarRange )<br>
&gt;&gt; {<br>
&gt;&gt; &nbsp; &nbsp;mapper.SelectColorArray( currentScalar );<br>
&gt;&gt; &nbsp; &nbsp;mapper.SetScalarRange( currentScalarRange );<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Gerrick<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 7/11/08 11:46 AM, &quot;Sarah Macumber&quot; &lt;S.Macumber@QuestReliability.com&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I have 2D / 3D data so I am using an vtkUnstructuredGrid &amp; a<br>
&gt;&gt;&gt; vtkDataSetMapper<br>
&gt;&gt;&gt; to visualize my data. &nbsp;My data has several associated scalar values which I<br>
&gt;&gt;&gt; want to be able to switch between for coloring purposes. &nbsp;Calling SetScalars<br>
&gt;&gt;&gt; with the new scalar value does not update the visualization pipeline as<br>
&gt;&gt;&gt; described in this thread :<br>
&gt;&gt;&gt; Grid.GetCellData().SetScalars(currentScalars);<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; <a href="http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html" target="_blank">http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html</a><br>
&gt;&gt;&gt; &lt;<a href="http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html" target="_blank">http://www.vtk.org/pipermail/vtk-developers/2007-September/004700.html</a>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; but I still don&#39;t fully understand what to do about it.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; What is the best way to switch your viewable scalar value on a<br>
&gt;&gt;&gt; vtkUnstructuredGrid?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks, Sarah<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; This is the private VTK discussion list.<br>
&gt;&gt;&gt; Please keep messages on-topic. Check the FAQ at:<br>
&gt;&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br></div>