Commit 92b6da1d authored by saubatn's avatar saubatn
Browse files

FIXED Bug 155.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@2179 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 04b616dd
......@@ -215,7 +215,7 @@ Action::ApplyStatus EditFrame::apply() {
// Refresh only 3D viewer : there is only it displaying the frame.
InteractiveViewer::get3DViewer()->refresh();
return SUCCESS;
}
......
......@@ -246,6 +246,17 @@ bool VtkImageComponentExtension::save(Component* component) const {
}
rotationInfo += "\n";
text.replace(QRegExp("TransformMatrix = (([-+]?(?:\\b[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+\\b)(?:[eE][-+]?[0-9]+\\b)?)[ |\\n])+"), rotationInfo);
// Retrieve offset information
// Offset = translation / parent frame
// frame translation vector = translation / parent frame rotated
rotationMatrix->Invert(); // which is a transpose in this case ...
double translation[3] = {0.0, 0.0, 0.0};
rotationMatrix->MultiplyPoint(component->getTransform()->GetPosition(), translation);
QString translationInfo = "Offset = " + QString::number(translation[0]) +
" " + QString::number(translation[1]) +
" " + QString::number(translation[2]) + "\n";
text.replace(QRegExp("Offset = (([-+]?(?:\\b[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+\\b)(?:[eE][-+]?[0-9]+\\b)?)[ |\\n])+"), translationInfo);
file.seek(0); // go to the beginning of the file
file.write(text.toAscii()); // write back the file, in ASCII to preserve data format
......
......@@ -334,6 +334,7 @@ void ImageComponent::prepareForSaving() {
vtkSmartPointer<vtkMatrix4x4> frameMatrix = frame->GetMatrix();
vtkSmartPointer<vtkMatrix4x4> userMatrix = vtkSmartPointer<vtkMatrix4x4>::New();
vtkMatrix4x4::Multiply4x4(initialFrameMatrixInverse, frameMatrix , userMatrix);
vtkSmartPointer<vtkTransform> userTransform = vtkSmartPointer<vtkTransform>::New();
userTransform->SetMatrix(userMatrix);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment