[Paraview] Simple script severe slowdown in loop

Pat Marion pat.marion at kitware.com
Tue Jun 12 13:15:13 EDT 2012


Hi Andrew,

You're loading new data each loop, and never removing it.  For starters,
you could try adding a Delete call inside the loop after WriteImage:

  Delete(rho_180x180x180_frame0010_subs01_total_raw)

Pat


On Tue, Jun 12, 2012 at 1:03 PM, Andrew Pearson
<andrew.j.pearson at gmail.com>wrote:

> 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.
>
> for count in range(1,204):
>   try: paraview.simple
>   except: from paraview.simple import *
>   paraview.simple._DisableFirstRenderCameraReset()
>
>   filename='/home/andy/Desktop/L2-1
> Dicom/data8/rho_180x180x180_frame%04d_subs01_total.raw' % (count)
>   rho_180x180x180_frame0010_subs01_total_raw = ImageReader(
> FilePrefix=filename )
>
>   rho_180x180x180_frame0010_subs01_total_raw.DataExtent = [0, 179, 0, 179,
> 0, 179]
>   rho_180x180x180_frame0010_subs01_total_raw.DataScalarType = 'unsigned
> char'
>
>   RenderView1 = GetRenderView()
>   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 )
>
>   a1_ImageFile_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0,
> 0.0, 0.5, 0.0, 255.0, 1.0, 0.5, 0.0] )
>
>   DataRepresentation1 = Show()
>   DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]
>   DataRepresentation1.SelectionPointFieldDataArrayName = 'ImageFile'
>   DataRepresentation1.ScalarOpacityFunction =
> a1_ImageFile_PiecewiseFunction
>   DataRepresentation1.ColorArrayName = 'ImageFile'
>   DataRepresentation1.ScalarOpacityUnitDistance = 1.7320508075688779
>   DataRepresentation1.LookupTable = a1_ImageFile_PVLookupTable
>   DataRepresentation1.Representation = 'Volume'
>   DataRepresentation1.ScaleFactor = 17.900000000000002
>
>   RenderView1.CameraViewUp = [-0.24428917240633777, 0.2192776215931415,
> 0.9445846308899386]
>   RenderView1.CameraPosition = [495.4123489395223, -304.665940440324,
> 285.97976015645276]
>   RenderView1.CameraClippingRange = [296.6155313125564, 980.96172641737]
>   RenderView1.CameraFocalPoint = [89.5, 89.50000000000001, 89.5]
>   RenderView1.CameraParallelScale = 155.0185472774145
>   RenderView1.CenterOfRotation = [89.5, 89.5, 89.5]
>
>   filename_out='/home/andy/Desktop/L2-1 Dicom/data8/frame_%04d.bmp' %
> (count)
>   WriteImage(filename_out)
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120612/57502483/attachment.htm>


More information about the ParaView mailing list