[vtkusers] Getting an region of interest out of a ImageTracerWidget ?

Dean Inglis dean.inglis at camris.ca
Tue Aug 1 09:17:44 EDT 2006


Daniel,

not sure how you code this in python but in tcl you
might do this...

proc AdjustSpline { } {

  set closed [itw IsClosed]
  
  if { $closed } {
    isw ClosedOn
  } else {
    isw ClosedOff
    imageActor2 SetInput [extract GetOutput]
  }

  set npts [ itw GetNumberOfHandles ]
  if { $npts < 2 } {
    return
  }

  itw GetPath poly
  set pts [poly GetPoints]

  set npts [$pts GetNumberOfPoints] 
  for {set i 0} {$i < $npts} {incr i} {
    set pt [$pts GetPoint $i]
    set x [lindex $pt 0] 
    set y [lindex $pt 1] 
    set z [lindex $pt 2]
#
#    DO SOMETHING WITH x,y,z
#
  }
  
  
  isw InitializeHandles $pts  

  if { $closed } {
    isw GetPolyData spoly
    stencil Update
    imageActor2 SetInput [stencil GetOutput]
    }
}

Getting the coordinates of pixels/voxels inside the ROI
can also be done but the method might depend on why you would want to do
this. 

HTH,
Dean


In the ImageTracerWidget .py example how can I get from the poly 
instance in the AdjustSpline callback

    The coordinates of points that compose the green line around the 
region of interest ?
    or
    The coordinates of the points inside the the region of interest ?
     or
    I am totally wrong and I should get them from the extract instance ?


 



More information about the vtkusers mailing list