In ParaView GUI, each object in the Pipeline Browser is called a source proxy. The call to ImageReader() constructs a new source proxy, just like using File --> Open in the gui. There is something called the Proxy Manager which keeps track of the source proxies, whether they are assigned to python variable names or not. Each time you load data, through the ImageReader() call, you are creating a new source proxy that must be explicitly removed from the Proxy Manager with a call to Delete(). Reassigning the variable will not delete the previous instance.<br>
<br>Pat<br><br><div class="gmail_quote">On Tue, Jun 12, 2012 at 1:54 PM, Weirs, V Gregory <span dir="ltr"><<a href="mailto:vgweirs@sandia.gov" target="_blank">vgweirs@sandia.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word">
<div>Try this:</div>
<div><br>
</div>
<div>
<div>------------</div><div class="im">
<div>try: paraview.simple</div>
<div>except: from paraview.simple import *</div>
<div>paraview.simple._DisableFirstRenderCameraReset()</div>
<div><br>
</div>
</div><div>count=1</div><div class="im">
<div><br>
</div>
<div>filename='/home/andy/Desktop/L2-1 Dicom/data8/rho_180x180x180_frame%04d_subs01_total.raw' % (count)</div>
<div>rho_180x180x180_frame0010_subs01_total_raw = ImageReader( FilePrefix=filename )</div>
<div><br>
</div>
<div>rho_180x180x180_frame0010_subs01_total_raw.DataExtent = [0, 179, 0, 179, 0, 179]</div>
<div>rho_180x180x180_frame0010_subs01_total_raw.DataScalarType = 'unsigned char'</div>
<div><br>
</div>
<div>RenderView1 = GetRenderView()</div>
<div>a1_ImageFile_PVLookupTable = GetLookupTableForArray( "ImageFile", 1, NanColor=[0.25, 0.0, 0.0], RGBPoints=[0.0, 0.23, 0.299, 0.754, 255.0, 0.706, 0.016, 0.15], VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 )</div>
<div><br>
</div>
<div>a1_ImageFile_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 255.0, 1.0, 0.5, 0.0] )</div>
<div><br>
</div>
<div>DataRepresentation1 = Show()</div>
<div>DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]</div>
<div>DataRepresentation1.SelectionPointFieldDataArrayName = 'ImageFile'</div>
<div>DataRepresentation1.ScalarOpacityFunction = a1_ImageFile_PiecewiseFunction</div>
<div>DataRepresentation1.ColorArrayName = 'ImageFile'</div>
<div>DataRepresentation1.ScalarOpacityUnitDistance = 1.7320508075688779</div>
<div>DataRepresentation1.LookupTable = a1_ImageFile_PVLookupTable</div>
<div>DataRepresentation1.Representation = 'Volume'</div>
<div>DataRepresentation1.ScaleFactor = 17.900000000000002</div>
<div><br>
</div>
<div>RenderView1.CameraViewUp = [-0.24428917240633777, 0.2192776215931415, 0.9445846308899386]</div>
<div>RenderView1.CameraPosition = [495.4123489395223, -304.665940440324, 285.97976015645276]</div>
<div>RenderView1.CameraClippingRange = [296.6155313125564, 980.96172641737]</div>
<div>RenderView1.CameraFocalPoint = [89.5, 89.50000000000001, 89.5]</div>
<div>RenderView1.CameraParallelScale = 155.0185472774145</div>
<div>RenderView1.CenterOfRotation = [89.5, 89.5, 89.5]</div>
<div><br>
</div>
<div>filename_out='/home/andy/Desktop/L2-1 Dicom/data8/frame_%04d.bmp' % (count)</div>
<div>WriteImage(filename_out)</div>
</div></div>
<div><br>
</div>
<div>for count in range(2,204):</div><div class="im">
<div> filename='/home/andy/Desktop/L2-1 Dicom/data8/rho_180x180x180_frame%04d_subs01_total.raw' % (count)</div>
<div>
<div> rho_180x180x180_frame0010_subs01_total_raw = ImageReader( FilePrefix=filename )</div>
</div>
<div><br>
</div>
</div><div class="im"><div>
<div> filename_out='/home/andy/Desktop/L2-1 Dicom/data8/frame_%04d.bmp' % (count)</div>
<div> WriteImage(filename_out)</div>
</div>
<div><br>
</div>
</div><span>
<div style="border-right:medium none;padding-right:0in;padding-left:0in;padding-top:3pt;text-align:left;font-size:11pt;border-bottom:medium none;font-family:Calibri;border-top:#b5c4df 1pt solid;padding-bottom:0in;border-left:medium none">
<span style="font-weight:bold">From: </span>Andrew Pearson <<a href="mailto:andrew.j.pearson@gmail.com" target="_blank">andrew.j.pearson@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Tue, 12 Jun 2012 13:03:52 -0400<br>
<span style="font-weight:bold">To: </span><<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>><br>
<span style="font-weight:bold">Subject: </span>[EXTERNAL] [Paraview] Simple script severe slowdown in loop<br>
</div><div><div class="h5">
<div><br>
</div>
Hi all. I'm a newbie to both ParaView and Python scripting. I have a large number of *.raw files that I wish to load, visualize and save via a screenshot. To do this, I used the start/stop trace feature to produce a python script for one instance, edited
the python script by adding a for loop, then ran it with pvbatch. The script produces the correct output, but it takes progressively longer on each iteration. To give you an idea, I started a batch of 200 files yesterday afternoon -- the first one took 10
seconds, but right now it's only on 180! I know that in Matlab, allocating and re-allocating progressively larger memory chunks in a loop can cause this behavior, but I don't see this happening here. Below is my script -- I appreciate any help anyone can
give.
<div><br>
</div>
<div>
<div>for count in range(1,204):</div>
<div> try: paraview.simple</div>
<div> except: from paraview.simple import *</div>
<div> paraview.simple._DisableFirstRenderCameraReset() </div>
<div><br>
</div>
<div> filename='/home/andy/Desktop/L2-1 Dicom/data8/rho_180x180x180_frame%04d_subs01_total.raw' % (count)</div>
<div> rho_180x180x180_frame0010_subs01_total_raw = ImageReader( FilePrefix=filename )</div>
<div><br>
</div>
<div> rho_180x180x180_frame0010_subs01_total_raw.DataExtent = [0, 179, 0, 179, 0, 179]</div>
<div> rho_180x180x180_frame0010_subs01_total_raw.DataScalarType = 'unsigned char'</div>
<div><br>
</div>
<div> RenderView1 = GetRenderView()</div>
<div> a1_ImageFile_PVLookupTable = GetLookupTableForArray( "ImageFile", 1, NanColor=[0.25, 0.0, 0.0], RGBPoints=[0.0, 0.23, 0.299, 0.754, 255.0, 0.706, 0.016, 0.15], VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 )</div>
<div><br>
</div>
<div> a1_ImageFile_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 255.0, 1.0, 0.5, 0.0] )</div>
<div><br>
</div>
<div> DataRepresentation1 = Show()</div>
<div> DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]</div>
<div> DataRepresentation1.SelectionPointFieldDataArrayName = 'ImageFile'</div>
<div> DataRepresentation1.ScalarOpacityFunction = a1_ImageFile_PiecewiseFunction</div>
<div> DataRepresentation1.ColorArrayName = 'ImageFile'</div>
<div> DataRepresentation1.ScalarOpacityUnitDistance = 1.7320508075688779</div>
<div> DataRepresentation1.LookupTable = a1_ImageFile_PVLookupTable</div>
<div> DataRepresentation1.Representation = 'Volume'</div>
<div> DataRepresentation1.ScaleFactor = 17.900000000000002</div>
<div><br>
</div>
<div> RenderView1.CameraViewUp = [-0.24428917240633777, 0.2192776215931415, 0.9445846308899386]</div>
<div> RenderView1.CameraPosition = [495.4123489395223, -304.665940440324, 285.97976015645276]</div>
<div> RenderView1.CameraClippingRange = [296.6155313125564, 980.96172641737]</div>
<div> RenderView1.CameraFocalPoint = [89.5, 89.50000000000001, 89.5]</div>
<div> RenderView1.CameraParallelScale = 155.0185472774145</div>
<div> RenderView1.CenterOfRotation = [89.5, 89.5, 89.5]</div>
<div><br>
</div>
<div> filename_out='/home/andy/Desktop/L2-1 Dicom/data8/frame_%04d.bmp' % (count)</div>
<div> WriteImage(filename_out)</div>
</div></div></div><div class="im">
_______________________________________________ Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> Visit other Kitware open-source projects at
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a> Please keep messages on-topic and check the ParaView Wiki at:
<a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a> Follow this link to subscribe/unsubscribe:
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a>
</div></span>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>