// vv
#include "vvToolRigidReg.h"
#include "vvSlicer.h"
+#include <vvBlendImageActor.h>
// vtk
#include <vtkImageData.h>
#include <vtkSmartPointer.h>
+#include <vtkInformation.h>
#include <vtkTransform.h>
+#include <vtkImageActor.h>
+#include <vtkImageMapper3D.h>
+#include <vtkOpenGLImageSliceMapper.h>
// itk
#include <itkEuler3DTransform.h>
// clitk
#include "clitkTransformUtilities.h"
+#include "clitkMatrix.h"
// qt
#include <QMessageBox>
//backup original matrix
for(int j=0; j<4; j++)
for(int i=0; i<4; i++)
- mInitialMatrix->SetElement(i,j, mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j));
- QString origTransformString = dynamic_cast<vvMainWindow*>(mMainWindow)->Get4x4MatrixDoubleAsString(mInitialMatrix);
+ // TODO SR and BP: check on the list of transforms and not the first only
+ mInitialMatrix->SetElement(i,j, mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix()->GetElement(i,j));
+ QString origTransformString(clitk::Get4x4MatrixDoubleAsString(mInitialMatrix).c_str());
transformationLabel->setText(origTransformString);
SetTransform(mInitialMatrix);
}
// Compute transform and set
- vtkSmartPointer<vtkTransform> transform_final=mInput->GetImage()->GetTransform();
+ // TODO SR and BP: check on the list of transforms and not the first only
+ vtkSmartPointer<vtkTransform> transform_final=mInput->GetImage()->GetTransform()[0];
transform_final->Identity();
transform_final->PostMultiply();
QFile file(filename);
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
- vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix();
- QString matrixStr = dynamic_cast<vvMainWindow*>(mMainWindow)->Get4x4MatrixDoubleAsString(matrix,16);
+ // TODO SR and BP: check on the list of transforms and not the first only
+ vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix();
+ QString matrixStr = clitk::Get4x4MatrixDoubleAsString(matrix,16).c_str();
QTextStream out(&file);
out << matrixStr;
}
//------------------------------------------------------------------------------
void vvToolRigidReg::ChangeOfRotationCenter()
{
- SetTransform(mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix());
+ // TODO SR and BP: check on the list of transforms and not the first only
+ SetTransform(mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix());
}
//------------------------------------------------------------------------------
void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix)
{
vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
- mCurrentSlicerManager->GetImage()->GetTransform()->SetMatrix(matrix);
+ // TODO SR and BP: check on the list of transforms and not the first only
+ mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(matrix);
transform->Update();
Render();
dynamic_cast<vvMainWindow*>(mMainWindow)->ImageInfoChanged();
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvToolRigidReg::ExtentMax(const double pointExtent[8][4], double maxExtent[2][3])
+{
+ double max, min;
+ for (int i=0; i<3; ++i) {
+ max = pointExtent[0][i];
+ min = pointExtent[0][i];
+ for (int j=1; j<8; ++j) {
+ if (pointExtent[j][i] > max) {
+ max = pointExtent[j][i];
+ }
+ if (pointExtent[j][i] < min) {
+ min = pointExtent[j][i];
+ }
+ }
+ maxExtent[0][i] = min;
+ maxExtent[1][i] = max;
+ }
+}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvToolRigidReg::Render()
{
- for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
- {
+for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
mCurrentSlicerManager->GetSlicer(i)->ForceUpdateDisplayExtent();
mCurrentSlicerManager->GetSlicer(i)->Render();
- }
+}
}
//------------------------------------------------------------------------------