On Thu, Jul 30, 2009 at 3:23 PM, pat marion <[email protected]> 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

Reply via email to