[vtkusers] vtkResliceImage and appending slices
zarko.milosevic
zarko at kg.ac.rs
Wed Dec 3 17:45:34 EST 2014
Dear David,
I have encountered on some class vtkSplineDrivenImageSlicer which implements
everything that i need for the my task. Actually that class is facade
(wrapper) class which uses vtkImageReslice for reslicing and
vtkFrenetSerretFrame for generating resliceAxes of vtkImageReslice.
http://www.vtkjournal.org/browse/publication/838
To sum up. This class as input requires image data and path in form of poly
line. Using the path class generates three orthogonal vector representing
the local coordinate frame in every point of the polyline. For those
purposes this class uses Frenet Serret formula implemented in class
vtkFrenetSerretFrame. Using those vectors resliceAxes are generated and new
slices are extracted.
I have problem with one piece of code from that class to understand. This is
where i`m stuck:
for ( int comp = 0; comp < 3; comp++ )
{
// Here reslice matrix is built using thre ortogonal vectors generated in
previous step from path
resliceAxes->SetElement(0,comp,binormal[comp]);
resliceAxes->SetElement(1,comp,normal[comp]);
resliceAxes->SetElement(2,comp,tangent[comp]);
// Here is calculated orgin of the slice so it would not be in the origin of
the frame (resliceaxes) but in in // lower left corner of the slice because
sliceExtent is from 0, sliceExtent[0] and etc.
origin[comp] = center[comp] -
normal[comp]*this->SliceExtent[1]*this->SliceSpacing[1]/2.0
- binormal[comp]*this->SliceExtent[0]*this->SliceSpacing[0]/2.0;
}
//! Transform the origin in the homogeneous coordinate space. Is that
necessary in this way ?
origin[3] = 1.0;
double originXYZW[4];
resliceAxes->MultiplyPoint(origin, originXYZW);
//! Get the new origin from the transposed matrix.
resliceAxes->Transpose();
double neworiginXYZW[4];
resliceAxes->MultiplyPoint(originXYZW, neworiginXYZW);
resliceAxes->SetElement(0,3,neworiginXYZW[0]);
resliceAxes->SetElement(1,3,neworiginXYZW[1]);
resliceAxes->SetElement(2,3,neworiginXYZW[2]);
this->reslicer->SetResliceAxes( resliceAxes );
Creating the newOriginXYZW in this way does not have any sense.
newOriginXYZW is the same as Origin.
Transposing the resliceaxes where only rotation matrix elements are present
have same result as inverting the rotation matrix.
originXYZW = resliceAxes(onlyRotation) * origin
neworiginXYZW = resliceAxes(onlyRotation)^-1 * originXYZW => origin
But that is not main problem.
Main question is do you have idea why transposed (inverted rotation) is
passed to reslicer ?
Results with including Transposed matrix is little bit better than without
it. Images are little bit better aligned but nothing significant.
Best regards
Zarko
--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkImageReslice-and-appending-slices-tp5728537p5729669.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list