[vtkusers] Re: vtkImagePlaneWidget Oblique Reslice Bug!?
Dean Inglis
dean.inglis at camris.ca
Tue Sep 7 10:39:54 EDT 2004
Istvan,
I'm not sure which version of vtkImagePlaneWidget.cxx you
are using, since
"Undhandled Exception"s in vtkImagePlaneWidget.cxx line 1465
line 1465 corresponds to a comment in the method:
void vtkImagePlaneWidget::UpdateNormal()
but, it if an exception is being thrown from UpdateNormal,
it may be that you are not ensuring that points 1, 2 and the origin
form part of a right-handed orthogonal basis. vtkImagePlaneWidget
does not check/ensure that those inputs mathematically make
sense for reasons of efficiency. Therefore, either the vtkMatrix4x4
that receives the normalized vectors defining the directions along
the new plane axes is causing an exception when it attempts to perform
several math ops, or, the vtkImageReslice that receives this
matrix is. I would put a check in your code: e.g.,
for(int i=0;i<3;i++)
{
axis1[i] = p1__[i] - o__[i];
axis2[i] = p2__[i] - o__[i];
}
vtkMath::Normalize(axis1);
vtkMath::Normalize(axis2);
double dot = vtkMath::Dot(axis1,axis2);
double nearZero = 0.0000001; // or some other very small number...
if(dot > nearZero)
{
// ... DO SOMETHING APPROPRIATE HERE
}
regards,
Dean
More information about the vtkusers
mailing list