[vtkusers] Reslicer rotation axis

Fabian Torres fabian.trobles at gmail.com
Fri May 27 15:26:17 EDT 2016


Hi all.

I have a volume and I want to extract the center sagital slice of the
volume and rotate it around the x axis in the center of the image. For this
I'm using vtkImageReslice and vtkTransform.
Everything works fine until I rotate the slice. It is rotating around the
origin of the output image (lower left corner of the image) and not through
the center of it. Can any one explain to me how do I choose the rotation
axis in the transform. here is a brief of my code.

const double MainWindow::sagitalElements[16] = {
0, 0, 1, 0,
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 0, 1
};

volumeData->GetSpacing(spacing);
volumeData->GetOrigin(origin);
volumeData->GetDimensions(dimensions);

centerSlice[0] = floor(dimensions[0]*0.5);
centerSlice[1] = floor(dimensions[1]*0.5);
centerSlice[2] = floor(dimensions[2]*0.5);

positionCenter[0] = origin[0] + spacing[0] * centerSlice[0];
positionCenter[1] = origin[1] + spacing[1] * centerSlice[1];
positionCenter[2] = origin[2] + spacing[2] * centerSlice[2];

resliceAxesSagital->DeepCopy(sagitalElements);

transformSagital->RotateX(rotate);

reslicerSagital->SetInput(volumeData);
reslicerSagital->SetOutputDimensionality(2);
reslicerSagital->SetResliceAxes(resliceAxesSagital);
reslicerSagital->SetResliceAxesOrigin(positionCenter);
reslicerSagital->SetInterpolationModeToLinear();

reslicerSagital->SetResliceTransform(transformSagital);
reslicerSagital->Update();
sliceImageSagital = reslicerSagital->GetOutput();


As I dsaid before the problem is that I want to rotate around the
center of the image and not the origin of the image.


Thanks a lot


-- 
Fabián Torres Robles
Maestria en Ciencias en Ingeniería Electrónica
Ingeniería en Sistemas Electrónicos
tel. 58081280, 0445534661338
e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160527/6ac0ba7d/attachment.html>


More information about the vtkusers mailing list