<font color="#000000"><font size="2"><font face="tahoma,sans-serif">Hi<br><br>I found out that there was nothing wrong with the code snippet. I simply ran out of memory, so I could not do online rendering. I saved the vtkIsoVolume into an Unstructured Grid file and reopened it for offline rendering. Let me know if there is a more efficient way of doing this.<br>
<br>Thanks! <br><br></font></font></font><font color="#000000"><font size="2"><font face="'courier new', monospace">vtkXMLUnstructuredGridReader* reader = vtkXMLUnstructuredGridReader::New();</font></font></font><br>
<font color="#000000"><font size="2"><font face="'courier new', monospace">
reader->SetFileName("C://MyFile.vtu");</font></font></font><br><br><div style="margin-left: 40px;"><font color="#000000"><font size="2"><font face="'courier new', monospace">vtkIsoVolume* myIsoVolume = vtkIsoVolume::New(); </font></font></font><br>
<font color="#000000"><font size="2"><font face="'courier new', monospace">myIsoVolume ->SetInput((vtkDataSet*)reader->GetOutput()); </font></font></font><br><font color="#000000"><font size="2"><font face="'courier new', monospace">myIsoVolume ->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,"Pressure");</font></font></font><br>
<font color="#000000"><font size="2"><font face="'courier new', monospace">
myIsoVolume ->ThresholdBetween(-100,100);</font></font></font><br><font color="#000000"><font size="2"><font face="'courier new', monospace">myIsoVolume ->Update()</font></font></font><br></div><br><font style="font-family: courier new,monospace;" color="#000000"><font size="2"> vtkXMLUnstructuredGridWriter* writer2 = vtkXMLUnstructuredGridWriter::New();</font></font><br style="font-family: courier new,monospace;">
<font style="font-family: courier new,monospace;" color="#000000"><font size="2"> vtkUnstructuredGrid* unstructGrid = (vtkUnstructuredGrid*)</font></font><font style="font-family: courier new,monospace;" color="#000000"><font size="2">myIsoVolume </font></font><font style="font-family: courier new,monospace;" color="#000000"><font size="2">->GetOutputDataObject(0); </font></font><br style="font-family: courier new,monospace;">
<font style="font-family: courier new,monospace;" color="#000000"><font size="2"> writer2->SetInput((vtkDataSet*)unstructGrid);</font></font><br style="font-family: courier new,monospace;"><font style="font-family: courier new,monospace;" color="#000000"><font size="2"> writer2->SetFileName(volwriter);</font></font><br style="font-family: courier new,monospace;">
<font style="font-family: courier new,monospace;" color="#000000"><font size="2"> writer2->Write();</font></font><br><font color="#000000"><font size="2"><font face="tahoma,sans-serif"><br>Next run of application:<br>
<br> <span style="font-family: courier new,monospace;">vtkXMLUnstructuredGridReader* reader = vtkXMLUnstructuredGridReader::New();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> reader->SetFileName(volreader); </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> vtkGeometryFilter* geomFilter = vtkGeometryFilter::New();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> geomFilter->SetInput(reader->GetOutput());</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> geomFilter->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,"Pressure"); </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> geomFilter->Update();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> mapper->SetInput(geomFilter->GetOutput());</span><br> <span style="font-family: courier new,monospace;">// Render code</span><br></font></font></font><br>
<div class="gmail_quote">On Wed, Apr 20, 2011 at 4:41 AM, Alexis Chan <span dir="ltr"><<a href="mailto:alexisc@cs.unc.edu">alexisc@cs.unc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#000000"><font size="2"><font face="tahoma,sans-serif">Hi</font></font></font><div><font color="#000000"><font size="2"><font face="tahoma,sans-serif"><br></font></font></font></div><div><font color="#000000"><font size="2"><font face="tahoma,sans-serif">Is there a vtkIsoVolume example that I can refer to? </font></font></font><span style="font-family: tahoma,sans-serif;">When I open a vtu file in ParaView and apply the "Iso Volume" filter to it, I am able to see the Iso Volume. I tried to replicate that in my VTK application but I ran into "Unable to allocate memory" error.</span></div>
<div><font face="tahoma, sans-serif">Here's the code snippet (</font><span style="font-family: tahoma,sans-serif;"> I verified using the debugger that ParaView uses the same values for the </span><span style="font-family: tahoma,sans-serif;">SetInputArrayToProcess):</span></div>
<div><font face="tahoma, sans-serif"><br></font></div><div><font color="#000000"><font size="2"><font face="'courier new', monospace">vtkXMLUnstructuredGridReader* reader = vtkXMLUnstructuredGridReader::New();<br>
reader->SetFileName("C://MyFile.vtu");<br><br>vtkIsoVolume* myIsoVolume = vtkIsoVolume::New(); <br>myIsoVolume ->SetInput((vtkDataSet*)reader->GetOutput()); <br>myIsoVolume ->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,"Pressure");<br>
myIsoVolume ->ThresholdBetween(-100,100);<br>myIsoVolume ->Update();</font><br clear="all"><br><font face="tahoma, sans-serif">-- </font><br><font face="tahoma, sans-serif">Regards,</font><br>
<font face="tahoma, sans-serif">Alexis</font><br><br>
<font face="tahoma, sans-serif"><a href="http://alexisylchan.wordpress.com/" target="_blank"></a></font><br>
</font></font></div>
</blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Alexis<br><br>