// Image actor
this->ImageActor->SetVisibility(mImageVisibility);
- #if VTK_MAJOR_VERSION <= 5
this->ImageActor->SetDisplayExtent(w_ext);
- #else
+ #if VTK_MAJOR_VERSION >= 6
++//mSlicingTransform->Print(cout);
++//GetImage()->GetTransform()[0]->Print(cout);
++//mSlicingTransform = GetImage()->GetTransform()[0];
++//mImageReslice->SetResliceTransform(mSlicingTransform);
++//mImageReslice->AutoCropOutputOff();
++//mImageReslice->Update();
++int* extentTest = mImageReslice->GetOutput()->GetExtent();
++cout<< extentTest[0] << " " << extentTest[1] << " " << extentTest[2] << " " << extentTest[3] << " " << extentTest[4] << " " << extentTest[5] << endl;
++//this->GetInput()->Print(cout);
++//GetImageActor()->GetMapper()->Print(cout);
vtkSmartPointer<vtkOpenGLImageSliceMapper> mapperOpenGL= vtkSmartPointer<vtkOpenGLImageSliceMapper>::New();
-
try {
- mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
+ mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
} catch (const std::bad_cast& e) {
- std::cerr << e.what() << std::endl;
- std::cerr << "Conversion error" << std::endl;
- return;
+ std::cerr << e.what() << std::endl;
+ std::cerr << "Conversion error" << std::endl;
+ return;
}
if (mFirstSetSliceOrientation) {
copyExtent(ext, mRegisterExtent);
- this->ImageActor->SetDisplayExtent(w_ext); //initialisation
} else {
int w_croppingRegion[6];
- copyExtent(mRegisterExtent, w_croppingRegion);
- this->ImageActor->SetDisplayExtent(w_ext);
+ if (mUseReducedExtent) {
- copyExtent(mReducedExtent, w_croppingRegion);
++ copyExtent(extentTest, w_croppingRegion);
+ } else {
- copyExtent(mRegisterExtent, w_croppingRegion);
++ copyExtent(extentTest, w_croppingRegion);
+ }
- this->ImageActor->SetDisplayExtent(w_ext);
++ cout << "w_ext : " << w_ext[0] << " " << w_ext[1] << " " << w_ext[2] << " " << w_ext[3] << " " << w_ext[4] << " " << w_ext[5] << endl;
w_croppingRegion[ this->SliceOrientation*2 ] = this->Slice;
w_croppingRegion[ this->SliceOrientation*2+1 ] = this->Slice;
- mapperOpenGL->SetCroppingRegion(w_croppingRegion);
+ mapperOpenGL->SetCroppingRegion(w_croppingRegion);
++ cout << "w_croppingRegion : " << w_croppingRegion[0] << " " << w_croppingRegion[1] << " " << w_croppingRegion[2] << " " << w_croppingRegion[3] << " " << w_croppingRegion[4] << " " << w_croppingRegion[5] << endl;
}
-#endif
+#endif
#if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
// Fix for bug #1882
//----------------------------------------------------------------------------
void vvSlicer::Render()
- { cout << __func__ << endl;
+ { //out << __func__ << endl;
-
if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) {
legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
legend->UseOpacityOn();
double* GetCursorPosition() {
return mCursor;
}
--
vtkTransform * GetSlicingTransform() { return mSlicingTransform; }
vtkTransform * GetConcatenatedTransform() { return mConcatenatedTransform; }
vtkTransform * GetConcatenatedFusionTransform() { return mConcatenatedFusionTransform; }
vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
// TODO SR and BP: check on the list of transforms and not the first only
mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(matrix);
++ //mCurrentSlicerManager->GetSlicer(2)->GetSlicingTransform()->SetMatrix(matrix);
transform->Update();
Render();
dynamic_cast<vvMainWindow*>(mMainWindow)->ImageInfoChanged();
rotSliders[i]->setValue(iAngle);
rotSliders[i]->blockSignals(false);
}
-- }
++ }cout << euler->GetParameters()[0+3] << " " << euler->GetParameters()[1+3] << " " << euler->GetParameters()[2+3] << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolRigidReg::Render()
{ //out << __func__ << endl;
--#if VTK_MAJOR_VERSION > 5
++#if VTK_MAJOR_VERSION > 7
+double translationValues[4], translationValuesUpdate[4];
+mCurrentSlicerManager->GetImage()->GetTransform()[0]->Print(cout);
vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix();
vtkMatrix4x4* matrixTranspose = matrix->NewInstance();
for (int i=0; i<3; ++i) {
matrixTranspose->SetElement(i,j,matrix->GetElement(j,i));
}
}
-for (int i=0; i<4; ++i) {
- matrixTranspose->SetElement(3,i,matrix->GetElement(3,i));
+for (int j=0; j<3; ++j)
+{
+ translationValues[j] = matrix->GetElement(j,3);
+}
+translationValues[3] = 0.0;
+matrix->MultiplyPoint(translationValues, translationValuesUpdate);
+for (int i=0; i<3; ++i) {
+ matrixTranspose->SetElement(i,3,translationValuesUpdate[i]);
}
for (int i=0; i<4; ++i) {
- matrixTranspose->SetElement(i,3,matrix->GetElement(i,3));
+ matrixTranspose->SetElement(3,i,matrix->GetElement(3,i));
}
+
#endif
- for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++)
- {
-#if VTK_MAJOR_VERSION > 5
- double pointExtent[8][4], pointExtentUpdate[8][4];
+for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
- #if VTK_MAJOR_VERSION > 5
++#if VTK_MAJOR_VERSION > 7
+ double pointExtent[8][4], pointExtentUpdate[8][4], pointOverlayExtent[8][4], pointOverlayExtentUpdate[8][4], centre[3], translation[3];
std::vector<int> w_ext;
w_ext=mCurrentSlicerManager->GetImage()->GetSize();
pointExtent[0][0] = 0.0;