this,SLOT(UpdateSliceRange(int,int,int,int,int)));
connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
+ this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
this,SLOT(UpdateSliceRange(int,int,int,int,int)));
connect(mSlicerManagers.back(),SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
+ this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
UpdateTree();
qApp->processEvents();
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvMainWindow::UpdateLinkedNavigation(std::string id, vvSlicerManager * sm)
+{
+ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
+ if (id == mSlicerManagers[i]->GetId()) {
+ mSlicerManagers[i]->UpdateLinkedNavigation(sm->GetSlicer(0));
+ }
+ }
+}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::ShowContextMenu(QPoint point)
{
if (value == NOVerticalSlider->value()) return;
else value = NOVerticalSlider->value();
// int value = NOVerticalSlider->value();
- for (unsigned int i = 0; i < mSlicerManagers.size(); i++)
- {
- if (DataTree->topLevelItem(i)->data(COLUMN_UL_VIEW,Qt::CheckStateRole).toInt() > 1)
- {
- if (mSlicerManagers[i]->GetSlicer(0)->GetSlice() != value) {
- mSlicerManagers[i]->GetSlicer(0)->SetSlice(value);
- mSlicerManagers[i]->VerticalSliderHasChanged(0, value);
-
- // If nor Update/Render -> slider not work
- // only render = ok navigation, but for contour Update needed but slower ?
-
- mSlicerManagers[i]->UpdateSlice(0); // <-- DS add this. Not too much update ? YES. but needed for ImageContour ...
- //mSlicerManagers[i]->GetSlicer(0)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ?
- }
- break;
- }
+ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
+ if (DataTree->topLevelItem(i)->data(COLUMN_UL_VIEW,Qt::CheckStateRole).toInt() > 1) {
+ if (mSlicerManagers[i]->GetSlicer(0)->GetSlice() != value) {
+ mSlicerManagers[i]->GetSlicer(0)->SetSlice(value);
+ mSlicerManagers[i]->VerticalSliderHasChanged(0, value);
+
+ // If nor Update/Render -> slider not work
+ // only render = ok navigation, but for contour Update needed but slower ?
+
+ mSlicerManagers[i]->UpdateSlice(0); // <-- DS add this. Not too much update ? YES. but needed for ImageContour ...
+ //mSlicerManagers[i]->GetSlicer(0)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ?
+ }
+ break;
}
+ }
}
//------------------------------------------------------------------------------
this,SLOT(UpdateSliceRange(int,int,int,int,int)));
connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
+ this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
#include <vtkLODActor.h>
#include <vtkPointData.h>
#include <vtksys/SystemTools.hxx>
+#include <vtkCamera.h>
//----------------------------------------------------------------------------
vvSlicerManager::vvSlicerManager(int numberOfSlicers)
// GetInteractorStyle()->AddObserver(vtkCommand::LeftButtonReleaseEvent, smc);
mSlicers[i]->GetRenderWindow()->GetInteractor()->
GetInteractorStyle()->AddObserver(vtkCommand::EndPickEvent, smc);
+ mSlicers[i]->GetRenderWindow()->GetInteractor()->
+ GetInteractorStyle()->AddObserver(vtkCommand::EndInteractionEvent, smc);
smc->Delete();
}
//----------------------------------------------------------------------------
}
//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+void vvSlicerManager::UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate)
+{
+ for ( unsigned int i = 0; i < mSlicers.size(); i++) {
+ vtkCamera *camera = mSlicers[i] ->GetRenderer()->GetActiveCamera();
+ vtkCamera *refCam = slicer->GetRenderer()->GetActiveCamera();
+ camera->SetParallelScale(refCam->GetParallelScale());
+
+ double position[3], focal[3];
+ camera->GetPosition(position);
+ camera->GetFocalPoint(focal);
+
+ double refPosition[3], refFocal[3];
+ refCam->GetPosition(refPosition);
+ refCam->GetFocalPoint(refFocal);
+
+ if(slicer->GetSliceOrientation()==mSlicers[i]->GetSliceOrientation()) {
+ for(int i=0; i<3; i++) {
+ position[i] = refPosition[i];
+ focal[i] = refFocal[i];
+ }
+ }
+
+ if(slicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
+ if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
+ position[0] = refPosition[0];
+ focal[0] = refFocal[0];
+ }
+ if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
+ position[1] = refPosition[1];
+ focal[1] = refFocal[1];
+ }
+ }
+
+ if(slicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
+ if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
+ position[2] = refPosition[2];
+ focal[2] = refFocal[2];
+ }
+ if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
+ position[0] = refPosition[0];
+ focal[0] = refFocal[0];
+ }
+ }
+
+ if(slicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
+ if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
+ position[1] = refPosition[1];
+ focal[1] = refFocal[1];
+ }
+ if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
+ position[2] = refPosition[2];
+ focal[2] = refFocal[2];
+ }
+ }
+
+ camera->SetFocalPoint(focal);
+ camera->SetPosition(position);
+
+ if(bPropagate)
+ for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++)
+ emit UpdateLinkedNavigation(*i, this);
+ }
+ Render();
+}
+//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
double vvSlicerManager::GetColorWindow()