[Paraview] RAW to STL Script Help?

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Oct 14 09:02:07 EDT 2010


The documentation is for the current (git) version. You can go back
and look in the history to see the comment for 3.8.

Seb

On Thu, Oct 14, 2010 at 8:58 AM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> This wiki page describes some of the functionality, but doesn't seem to be quite up to date regarding "Trace State". If you find the things Sebastien is mentioning and have trouble just let us know.
>
> http://www.cmake.org/Wiki/Python_GUI_Tools
>
> -Eric
>
> On Oct 14, 2010, at 8:24 AM, Sebastien Jourdain wrote:
>
>> Hi Christopher,
>>
>> the python trace allow the user to record some actions in the UI and
>> generate a python script out of it.
>> Depending on the ParaView version:
>> - You will have some button start/stop trace on the right side of the
>> Python shell.
>> - or from the Git repo, directly accessible from the Tools menu.
>>
>> Enjoy,
>>
>> Seb
>>
>> On Wed, Oct 13, 2010 at 11:33 PM, Christopher Olah
>> <christopherolah.co at gmail.com> wrote:
>>> I've actually never heard of python state trace. So, please, go on.
>>> The only thing that comes up with Google is a paraview mailing list
>>> thread about it being broken and a few miscellaneous mentions.
>>>
>>> On Wed, Oct 13, 2010 at 7:32 PM, Christopher Olah
>>> <christopherolah.co at gmail.com> wrote:
>>>> Hey Eric,
>>>>
>>>> Thanks! I was using 3.8.1 but I'm pulling from git right now. :) If
>>>> someone knows how to write an STL in 3.8.1, it would still be nice to
>>>> know, of course.
>>>>
>>>> Thanks again,
>>>>
>>>> Christopher
>>>>
>>>> On Wed, Oct 13, 2010 at 6:11 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
>>>>> Hey Christopher,
>>>>>
>>>>> Well, I think that page is the best current documentation. Which version of ParaView are you using? (The API has changed quite a bit over various versions, and if you're using an earlier version than 3.8 or 3.9, the Python API has gotten much nicer these days.)
>>>>>
>>>>> I'm not actually sure how to write the STL file with PV 3.8.1, but with the current development version (3.9) you can load the data and write the STL with something like this (which I used the Python State Trace to figure out the commands -- ask if you don't know how to use this functionality because it's _really_ helpful in writing scripts):
>>>>>
>>>>> # =====================
>>>>> try: paraview.simple
>>>>> except: from paraview.simple import *
>>>>>
>>>>> noisy_10x100x100_sphere_raw = ImageReader( guiName="noisy_10x100x100_sphere.raw", ScalarArrayName='ImageFile', DataExtent=[0, 10, 0, 100, 0, 100], FilePrefix='/Users/emonson/Programming/ParaView_git/ParaViewData/Data/noisy_10x100x100_sphere.raw', NumberOfScalarComponents=1, FileDimensionality='3', DataByteOrder='LittleEndian', DataOrigin=[0.0, 0.0, 0.0], FilePattern='%s', DataSpacing=[10.0, 1.0, 1.0], DataScalarType='unsigned int', FileLowerLeft=1 )
>>>>>
>>>>> Contour1 = Contour( guiName="Contour1", Isosurfaces=[1021190000.0, 1043550000.0, 1065900000.0], ComputeNormals=1, ComputeGradients=0, ComputeScalars=0, ContourBy=['POINTS', 'ImageFile'], PointMergeMethod="Uniform Binning" )
>>>>>
>>>>> Show()
>>>>>
>>>>> ResetCamera()
>>>>> Render()
>>>>>
>>>>> writer= CreateWriter("raw_contours.stl", Contour1)
>>>>> writer.UpdatePipeline()
>>>>> # =====================
>>>>>
>>>>> Note that some of the options that are specified might be defaults that you wouldn't have to include, but I got these from the State Trace. Also, I didn't try to include the loop for varied file names...
>>>>>
>>>>> Maybe someone else can chime in with the STL writing if you're using 3.8.1.
>>>>>
>>>>> Hope this points you in the right direction,
>>>>> -Eric
>>>>>
>>>>> ------------------------------------------------------
>>>>> Eric E Monson
>>>>> Duke Visualization Technology Group
>>>>>
>>>>>
>>>>> On Oct 13, 2010, at 5:06 PM, Christopher Olah wrote:
>>>>>
>>>>>> Dear All,
>>>>>>
>>>>>> I have a large number of RAW files (unsigned characters in 3
>>>>>> dimensions of varying size) and I need to extract isosurfaces and save
>>>>>> them as STLs. I've been using paraview to do this (and it's awesome!),
>>>>>> but doing it by hand is becoming impractical. Unfortunately, I've been
>>>>>> having trouble figuring out how to script it.
>>>>>>
>>>>>> In particular, I can't figure out how to load RAW files or how save
>>>>>> STLs. In fact, the best documentation on the python API I can find is
>>>>>> http://www.paraview.org/Wiki/ParaView/Python_Scripting ... Could
>>>>>> someone direct me towards something a bit more comprehensive?
>>>>>>
>>>>>> Thanks in advance,
>>>>>>
>>>>>> Christopher Olah
>>>>>>
>>>>>> PS. I hope this isn't too trivial to write to you about -- I couldn't
>>>>>> really find anything on what level of question was appropriate for
>>>>>> this list.
>>>>>> _______________________________________________
>>>>>> 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
>>>>>
>>>>>
>>>>
>>> _______________________________________________
>>> 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
>>>
>
> _______________________________________________
> 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
>


More information about the ParaView mailing list