[vtk-developers] vtkBoundedPlanePlacer problem

dean.inglis at camris.ca dean.inglis at camris.ca
Tue Oct 16 15:11:13 EDT 2007


Hi Karthik,

thanks for pointing that out, I missed the
second (original) implementation.  However,
even if I change vtkImageActorPointPlacer as
suggested, this will not work, at least with
MS Vis Studio, since the signatures of the
vtkBoundedPointPlacer's ComputeWorldPosition
are equivalent due to the vtkNotUsed macro:

// first appearanc in implementation file
// of ComputeWorldPosition
int vtkBoundedPlanePointPlacer::ComputeWorldPosition( 
    vtkRenderer * ren,
    double        displayPos[2],
    double        refWorldPos[3],
    double        worldPos[3],
    double      * vtkNotUsed(worldOrient) )
{


// second implementation "looks" the same
// so the compiler always calls the first implementation
int vtkBoundedPlanePointPlacer::ComputeWorldPosition( vtkRenderer *ren,
                                                      double displayPos[2],
                                                      double worldPos[3],
                                                      double worldOrient[9] ) 


I tried and the contour widget's handle translation still does
not function.
 
Dean


> 
> Hi Dean,
> 
> Could you please check if the following change to vtkImageActorPointPlacer
> fixes it.
> 
> On line 78, replace
>    this->Placer->ComputeWorldPosition( ren, displayPos, refWorldPos,
> worldPos, worldOrient );
> with
>    this->Placer->ComputeWorldPosition( ren, displayPos, worldPos,
> worldOrient );
> 
> If so, please commit it.
> 
> Thanks,
> Regards
> --
> karthik
> 
> On 10/16/07, dean.inglis at camris.ca <dean.inglis at camris.ca> wrote:
> >
> > Hi,
> >
> > there were some changes made to vtkBoundedPointPlacer for the
> > new vtkParallelopipedWidget that does not appear to allow
> > for simple placement on bounded 2D planes and breaks the functionality
> > of vtkImageActorPointPlacer .  Can anyone verify by
> > drawing on an image with vtkContourWidget and then trying to move
> > the widget's handles.  See script below...
> >
> > Dean
> >
> >
> > #------------------------------------------------------------------------------------
> > package require vtk
> > package require vtkinteraction
> >
> > # Start by loading some data.
> > #
> > vtkVolume16Reader v16
> >   v16 SetDataDimensions 64 64
> >   v16 SetDataByteOrderToLittleEndian
> >   v16 SetImageRange 1 93
> >   v16 SetDataSpacing 3.2 3.2 1.5
> >   v16 SetFilePrefix "$VTK_DATA_ROOT/Data/headsq/quarter"
> >   v16 Update
> >
> > # Display a y-z plane.
> > #
> > vtkImageViewer2 viewer
> >   viewer SetInput [v16 GetOutput]
> >   viewer SetSliceOrientationToXY
> >
> > vtkRenderWindowInteractor iren
> >   viewer SetupInteractor iren
> >
> >   vtkContourWidget ContourWidget
> >   ContourWidget KeyPressActivationOn
> >
> >   vtkOrientedGlyphContourRepresentation ContourRep
> >   ContourWidget SetRepresentation ContourRep
> >
> >   ContourWidget   SetInteractor iren
> >
> >
> >   #vtkImageActorPointPlacer placer
> >   #placer SetImageActor [ viewer GetImageActor ]
> >
> >   vtkBoundedPlanePointPlacer placer
> >
> >   placer DebugOn
> >
> >   ContourRep SetPointPlacer placer
> >
> > set bounds [[viewer GetImageActor] GetBounds]
> > set xmin [lindex $bounds 0]
> > set xmax [lindex $bounds 1]
> > set ymin [lindex $bounds 2]
> > set ymax [lindex $bounds 3]
> > set zmin [lindex $bounds 4]
> > set zmax [lindex $bounds 5]
> >
> >   placer SetProjectionNormalToZAxis
> >
> > set center [[viewer GetImageActor] GetCenter]
> > set c [lindex $center 2]
> >   placer SetProjectionPosition  $c
> >
> >   vtkPlane p1
> >   p1 SetOrigin $xmin $ymin $zmin
> >   p1 SetNormal 1.0 0.0 0.0
> >
> >   vtkPlane p2
> >   p2 SetOrigin $xmin $ymin $zmin
> >   p2 SetNormal 0.0 1.0 0.0
> >
> >   vtkPlane p3
> >   p3 SetOrigin $xmax $ymax $zmax
> >   p3 SetNormal -1.0 0.0 0.0
> >
> >   vtkPlane p4
> >   p4 SetOrigin $xmax $ymax $zmax
> >   p4 SetNormal 0.0 -1.0 0.0
> >
> >
> >   placer AddBoundingPlane p1
> >   placer AddBoundingPlane p2
> >   placer AddBoundingPlane p3
> >   placer AddBoundingPlane p4
> >
> >
> >
> >   [ContourRep GetLinesProperty] SetColor 0 0 1
> >   [ContourRep GetActiveProperty] SetColor 0 1 0
> >   [ContourRep GetProperty] SetColor 0 1 0
> >
> > iren AddObserver UserEvent {wm deiconify .vtkInteract}
> >
> > viewer Render
> >
> > ContourWidget On
> >
> >
> > # Prevent the tk window from showing up then start the event loop.
> > wm withdraw .
> > _______________________________________________
> > vtk-developers mailing list
> > vtk-developers at vtk.org
> > http://www.vtk.org/mailman/listinfo/vtk-developers
> >
> 
> 
> 
> -- 
> Karthik Krishnan
> R&D Engineer,
> Kitware Inc.
> 
> 



More information about the vtk-developers mailing list