[Paraview] Visualize slice thickness?
pat marion
pat.marion at kitware.com
Thu Jul 30 16:43:39 EDT 2009
You can do this:
w = Wavelet()
image = servermanager.Fetch(w)
image.GetExtent()
image.GetOrigin()
image.GetSpacing()
Calling servermanager.Fetch is going to pull the image data from the
paraview server to the paraview client, so if the data is big, it
could take some time and use up a lot of memory.
Pat
On Thu, Jul 30, 2009 at 3:58 PM, David Doria<daviddoria at gmail.com> wrote:
>
> On Thu, Jul 30, 2009 at 3:23 PM, pat marion <pat.marion at kitware.com> wrote:
>>
>> Why this sounds like a great opportunity for the new python macro
>> feature :-) You could two scripts, StepForward.py and
>> StepBackward.py, and add them to the macros toolbar. Now you'll have
>> two buttons for stepping forward and backward. I don't have time
>> right now to figure out the complete script but it would be something
>> like...
>>
>> e = GetActiveSource()
>> # maybe make sure e.GetVTKClassName() == "vtkExtractGeometry"
>> e.IntersectWith = "Plane"
>> planeOrigin = e.IntersectWith.Origin
>> imageInput = e.Input[0]
>> e.IntersectWith.Origin = computeNewOrigin(planeOrigin, imageInput)
>>
>> Then all you need to do is write the computeNewOrigin method that
>> takes the image, gets the origin, extens, and spacing, and then
>> computes a new plane origin to step the plane one discreet step
>> forward or backward.
>>
>> Pat
>
> These macros are very cool! That code was right on, it works perfectly if I
> set the new origin to a constant.
> e.IntersectWith.Origin = [x,y,z]
>
> Now for writing computeNewOrigin(), I looked at dir(imageInput) but I didn't
> see properties like "spacing" or "cellSize" - where should I look to find
> out how to get those properties from an image in python?
>
> Thanks,
>
> David
>
> _______________________________________________
> 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