[vtkusers] ROI using vtkImageTracerWidget
Dean Inglis
dean.inglis at sympatico.ca
Thu Feb 19 20:56:14 EST 2009
Sercani:
You can get the vtkPolyData
of the vtkImageTracerWidget and get its bounds using, for example:
vtkPolyData poly = vtkPolyData::New();
widget->GetPath( poly );
double* bounds = poly->GetBounds();
from the bounds and knowing the underlying vtkImageActor's
input (vtkImageData) origin and spacing, you can calculate
the enclosed region's extents and feed those into
a vtkImageClip to clip the vtkImageActor's input:
double* origin = imageActor->GetInput()->GetOrigin();
double* spacing = imageActor->GetInput()->GetSpacing();
int xmin = (int)((bounds[0] - origin[0])/spacing[0] + 0.5);
int xmax = (int)((bounds[1] - origin[0])/spacing[0] + 0.5);
int ymin = (int)((bounds[2] - origin[1])/spacing[1] + 0.5);
int ymax = (int)((bounds[3] - origin[1])/spacing[1] + 0.5);
etc., etc.
vtkImageClip clip = vtkImageClip::New();
clip->SetOutputWholeExtent( xmin,xmax,ymin,ymax,zmin,zmax);
clip->SetInput(imageActor->GetInput());
Dean
>Isn't there anyone who did this before? I have implemented
>vtkImageTracerWidget example code to my project but i couldn't get the
image
>region inside this closed spline.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dean Inglis, PhD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~ Center for Appendicular ~~~~~
Magnetic Resonance Imaging Studies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
610 - 25 Charlton Ave. E.
Hamilton, Ontario, L8N 1Y2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assistant Professor (Adjunct)
Department of Civil Engineering
McMaster University
Hamilton, Ontario
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Software Demos:
http://www.youtube.com/watch?v=_zYNtHC9-0s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090219/eaa50ede/attachment.htm>
More information about the vtkusers
mailing list