[vtkusers] vtkImagePlaneWidget :Size of the Slice
dean.inglis at camris.ca
dean.inglis at camris.ca
Mon May 8 09:26:32 EDT 2006
Mohamed,
VTK objects are created with:
vtkSomeObject* object = vtkSomeObject::New();
and release their memory with
object->Delete();
for the widget, there are several ways to get the
size of the plane:
double v1[3];
widget->GetVector1(v1);
double v2[3];
widget->GetVector2(v2);
double width = vtkMath::Norm(v1);
double height = vtkMath::Norm(v2);
or use the vtkImageData generated by the widget to get the
number of pixels along x,y:
vtkImageData* data = widget->GetResliceOutput();
int dims[3];
data->GetDimensions(dims);
int width = dims[0];
int height = dims[1];
If you want the lengths of those axes from the image data:
double spacing[3];
int extents[6];
data->GetSpacing(spacing);
data->GetExtents(extents);
double width = (extents[1]-extents[0]+1)*spacing[0];
double height = (extents[3]-extents[2]+1)*spacing[1];
regards,
Dean
hello!
I've asked these questions before and I still look for answers because these informations are very important for my project.
Is it possible to know the size of the Image displayied or the ratio used for ,in the vtkImagePlaneWidget (height and width).
Hhow can I release all the memory allocated by vtkStructuredPoints and vtkImagePlaneWidget?
thank you for your help!
More information about the vtkusers
mailing list