- DD("works");
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvToolRigidReg::InputIsSelected(std::vector<vvSlicerManager *> & l)
-{
- //inputs
- mInput1 = l[0];
- mInput2 = l[1];
-
- UpdateTextEditor(mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix(),textEdit_2);
-
- for(int i =0;i<4;i++)
- for(int j=0;j<4;j++)
- mInitialMatrix[i*4+j]=mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j);
-
- if(mInput1->GetFileName()==mInput2->GetFileName())
- {
- QMessageBox::information(this, "Warning","Your Reference and Target Images are the same");
- }
- mTwoInputs = true;
- SetOverlay();
- mImageSize=mInput1->GetImage()->GetSize();
- SetRotationCenter();
- SetSliderRanges();
-
- //connect all sigs to slots
- connect(resetbutton, SIGNAL(pressed()), this, SLOT(ResetTransform()));
- connect(tab2loadbutton, SIGNAL(pressed()), this, SLOT(AutoRegister()));
-
- connect(Xval, SIGNAL(editingFinished()), this, SLOT(SetXvalue()));
- connect(Yval, SIGNAL(editingFinished()), this, SLOT(SetYvalue()));
- connect(Zval, SIGNAL(editingFinished()), this, SLOT(SetZvalue()));
-
- connect(xtrans_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
- connect(ytrans_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
- connect(ztrans_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-
-
- connect(xrot_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
- connect(yrot_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
- connect(zrot_slider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransform_sliders()));
-
- connect(xtrans_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
- connect(ytrans_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
- connect(ztrans_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
- connect(xrot_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
- connect(yrot_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
- connect(zrot_sb, SIGNAL(valueChanged(double)), this, SLOT(UpdateTransform_sb()));
-
- connect(loadbutton, SIGNAL(pressed()), this, SLOT(ReadFile()));
- connect(savebutton, SIGNAL(pressed()), this, SLOT(SaveFile()));
-
+ mInput = input;
+ HideInputSelector();
+ QTabWidget * tab = dynamic_cast<vvMainWindow*>(mMainWindow)->GetTab();
+ move(tab->mapToGlobal(tab->pos()));
+ resize(tab->width(), 0);
+
+ //default image rotation center is the center of the image
+ QString xcord,ycord,zcord;
+ std::vector<double> imageorigin;
+ imageorigin=mInput->GetImage()->GetOrigin();
+ std::vector<int> imageSize = mInput->GetImage()->GetSize();
+ std::vector<double> imageSpacing = mInput->GetImage()->GetSpacing();
+ xcord=xcord.setNum(imageorigin[0]+(imageSize[0]-1)*imageSpacing[0]*0.5, 'g', 3);
+ ycord=ycord.setNum(imageorigin[1]+(imageSize[1]-1)*imageSpacing[1]*0.5, 'g', 3);
+ zcord=zcord.setNum(imageorigin[2]+(imageSize[2]-1)*imageSpacing[2]*0.5, 'g', 3);
+ Xval->setText(xcord);
+ Yval->setText(ycord);
+ Zval->setText(zcord);
+
+ //backup original matrix
+ for(int j=0; j<4; j++)
+ for(int i=0; i<4; i++)
+ // 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);
+
+ //connect all sigs to slots
+ connect(resetbutton, SIGNAL(pressed()), this, SLOT(ResetTransform()));
+ connect(loadbutton, SIGNAL(pressed()), this, SLOT(LoadFile()));
+ connect(savebutton, SIGNAL(pressed()), this, SLOT(SaveFile()));
+
+ connect(xtrans_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+ connect(ytrans_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+ connect(ztrans_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+ connect(xrot_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+ connect(yrot_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+ connect(zrot_slider, SIGNAL(valueChanged(int)), this, SLOT(SliderChange(int)));
+ connect(xtrans_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+ connect(ytrans_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+ connect(ztrans_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+ connect(xrot_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+ connect(yrot_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+ connect(zrot_sb, SIGNAL(valueChanged(double)), this, SLOT(SpinBoxChange(double)));
+
+ connect(stepTransSpinBox, SIGNAL(valueChanged(double)), this, SLOT(SetTranslationStep(double)));
+ connect(stepRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(SetRotationStep(double)));
+
+ connect(checkBoxDegrees, SIGNAL(stateChanged(int)), this, SLOT(ToggleSpinBoxAnglesUnit()));
+
+ connect(Xval, SIGNAL(editingFinished()), this, SLOT(ChangeOfRotationCenter()));
+ connect(Yval, SIGNAL(editingFinished()), this, SLOT(ChangeOfRotationCenter()));
+ connect(Zval, SIGNAL(editingFinished()), this, SLOT(ChangeOfRotationCenter()));
+
+ // Init step modifiers
+ stepTransSpinBox->setValue(1.);
+ stepRotSpinBox->setValue(1.);