X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMainWindow.cxx;h=882bc2b16d631c7cf68233f30ac3fe0c3640cf81;hb=bac54d8f063fa3d0cffedd59edc5996a2378ceab;hp=3c322555fdbcfe4d90233ef4a9f3a74e793f5f21;hpb=653bd3d5014f39b318c8d66f2532dde2c7e1879e;p=clitk.git diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 3c32255..882bc2b 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -160,6 +160,11 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(SelectFusionImage())); contextActions.push_back(actionAdd_fusion_image); + contextMenu.addSeparator(); + QAction* actionResetMatrix = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/identity.png")), + tr("Reset transformation to identity")); + connect(actionResetMatrix, SIGNAL(triggered()), this,SLOT(ResetTransformationToIdentity())); + // TRIAL DS /* QMenu * m = new QMenu(menubar); @@ -290,8 +295,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() connect(linkPanel,SIGNAL(removeLink(QString,QString)),this,SLOT(RemoveLink(QString,QString))); connect(overlayPanel,SIGNAL(VFPropertyUpdated(int,int,int,int,double,double,double)),this,SLOT(SetVFProperty(int,int,int,int,double,double,double))); connect(overlayPanel,SIGNAL(OverlayPropertyUpdated(int)),this,SLOT(SetOverlayProperty(int))); - connect(overlayPanel,SIGNAL(FusionPropertyUpdated(int,int,double,double)), - this,SLOT(SetFusionProperty(int,int,double,double))); + connect(overlayPanel,SIGNAL(FusionPropertyUpdated(int,int,int,double,double)), + this,SLOT(SetFusionProperty(int,int,int,double,double))); connect(landmarksPanel,SIGNAL(UpdateRenderWindows()),this,SLOT(UpdateRenderWindows())); playMode = 0;//pause @@ -910,8 +915,6 @@ void vvMainWindow::LoadImages(std::vector files, vvImageReader::Loa this, SLOT(OverlayChanged(int,double,double))); connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)), this, SLOT(FusionChanged(int,double))); - connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)), - this,SLOT(WindowsChanged(int, int, int))); connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)), this,SLOT(WindowLevelChanged(double, double, int, int))); connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)), @@ -1165,15 +1168,17 @@ void vvMainWindow::ImageInfoChanged() overlayPanel->getOverlayName(mSlicerManagers[index]->GetOverlayName().c_str()); overlayPanel->getOverlayProperty(-1); } + if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) { overlayPanel->getFusionName(mSlicerManagers[index]->GetFusionName().c_str()); overlayPanel->getFusionProperty(mSlicerManagers[index]->GetFusionOpacity(), + mSlicerManagers[index]->GetFusionThresholdOpacity(), mSlicerManagers[index]->GetFusionColorMap(), mSlicerManagers[index]->GetFusionWindow(), mSlicerManagers[index]->GetFusionLevel()); } else { overlayPanel->getFusionName(mSlicerManagers[index]->GetFusionName().c_str()); - overlayPanel->getFusionProperty(-1, -1,-1,-1); + overlayPanel->getFusionProperty(-1, -1, -1, -1, -1); } } } @@ -1382,7 +1387,7 @@ void vvMainWindow::DisplayChanged(QTreeWidgetItem *clickedItem, int column) mSlicerManagers[slicerManagerIndex]->UpdateInfoOnCursorPosition(column-1); DisplaySliders(slicerManagerIndex, column-1); if(clickedParentItem == clickedItem) { - // Toggle or force visibility if it was not on this branch so far + // Toggle vis = !draw || !vis; } clickedSlicer->SetActorVisibility("image", 0, vis); @@ -1623,13 +1628,6 @@ void vvMainWindow::FusionChanged(int visibility, double value) } //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -void vvMainWindow::WindowsChanged(int window, int view, int slice) -{ - infoPanel->setViews(window, view, slice); -} -//------------------------------------------------------------------------------ - //------------------------------------------------------------------------------ void vvMainWindow::WindowLevelChanged(double window, double level,int preset,int colormap) { @@ -1818,8 +1816,6 @@ void vvMainWindow::AddOverlayImage(int index, QString file) for (int j = 1; j <= 4; j++) { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); - mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("overlay",0, - DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt()); } //Create the buttons for reload and close @@ -1912,6 +1908,16 @@ void vvMainWindow::SelectFusionImage() } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvMainWindow::ResetTransformationToIdentity() +{ + std::string actorType = DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString().toStdString(); + int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); + mSlicerManagers[index]->ResetTransformationToIdentity(actorType); + ImageInfoChanged(); +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::AddFusionImage(int index, QString file) { @@ -1940,8 +1946,6 @@ void vvMainWindow::AddFusionImage(int index, QString file) for (int j = 1; j <= 4; j++) { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); - mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("fusion",0, - DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt()); } //Create the buttons for reload and close @@ -2025,8 +2029,6 @@ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk) for (int j = 1; j <= 4; j++) { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); - mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("vector",0, - DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt()); } //Create the buttons for reload and close @@ -2146,12 +2148,13 @@ void vvMainWindow::SetOverlayProperty(int color) //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -void vvMainWindow::SetFusionProperty(int opacity, int colormap,double window, double level) +void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap,double window, double level) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) { - mSlicerManagers[index]->SetFusionOpacity(opacity); mSlicerManagers[index]->SetFusionColorMap(colormap); + mSlicerManagers[index]->SetFusionOpacity(opacity); + mSlicerManagers[index]->SetFusionThresholdOpacity(thresOpacity); mSlicerManagers[index]->SetFusionWindow(window); mSlicerManagers[index]->SetFusionLevel(level); mSlicerManagers[index]->SetColorMap(0); @@ -2834,8 +2837,6 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen this, SLOT(OverlayChanged(int,double,double))); connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)), this, SLOT(FusionChanged(int,double))); - connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)), - this,SLOT(WindowsChanged(int, int, int))); connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)), this,SLOT(WindowLevelChanged(double, double, int, int))); connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),