[vtkusers] Re: vtkImagePlaneWidget Oblique Reslice Bug!?
Istvan Matis
i_matis at yahoo.de
Tue Sep 7 17:19:07 EDT 2004
Hi Dean,
I use vtkImagePlaneWidget with the version:
Date: $Date: 2003/02/04 16:40:47 $
Version: $Revision: 1.61 $
The exception was thrown in vtkImageReslice (used by vtkIPW) at line 1465,
sorry about that.
Here:
// pixel copy function, templated for different scalar types
template<class T>
void vtkSetPixels(T *&outPtr, const T *inPtr, int numscalars, int n)
{
for (int i = 0; i < n; i++)
{
const T *tmpPtr = inPtr;
int m = numscalars;
do
{
*outPtr++ = *tmpPtr++; //Here!!! //////////////////
}
while (--m);
}
}
You were right , the two axes were not quite orthogonal (dot >> 0), I'll
have to work on that!
Thanks again!
Istvan
----- Original Message -----
From: "Dean Inglis" <dean.inglis at camris.ca>
To: "vtkusers archive" <vtkusers at vtk.org>
Sent: Tuesday, September 07, 2004 5:39 PM
Subject: [vtkusers] Re: vtkImagePlaneWidget Oblique Reslice Bug!?
> 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