From: David Sarrut Date: Thu, 23 Feb 2012 12:39:47 +0000 (+0100) Subject: First version in tab. X-Git-Tag: v1.3.0~52^2~59 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=268292ed7f629f715a0aa7ae9e51de6dfacbc591;p=clitk.git First version in tab. --- diff --git a/vv/qt_ui/vvMainWindow.ui b/vv/qt_ui/vvMainWindow.ui index da5e5e4..3c65c2f 100644 --- a/vv/qt_ui/vvMainWindow.ui +++ b/vv/qt_ui/vvMainWindow.ui @@ -928,6 +928,9 @@ About + + true + @@ -998,6 +1001,9 @@ Save image in TL + + true + @@ -1007,6 +1013,9 @@ Save image in TR + + true + @@ -1016,6 +1025,9 @@ Save image in BL + + true + @@ -1025,6 +1037,9 @@ Save image in BR + + true + @@ -1052,11 +1067,17 @@ Add fusion image to current image + + true + Segmentation + + true + @@ -1067,6 +1088,9 @@ Surface Viewer + + true + @@ -1077,11 +1101,17 @@ Deformable Registration + + true + Verify Registration + + true + @@ -1104,6 +1134,9 @@ F1 + + true + @@ -1118,6 +1151,9 @@ Compute mid-position image + + true + @@ -1128,6 +1164,9 @@ Register vv + + true + diff --git a/vv/qt_ui/vvToolROIManager.ui b/vv/qt_ui/vvToolROIManager.ui index 6cd16f7..a778d47 100644 --- a/vv/qt_ui/vvToolROIManager.ui +++ b/vv/qt_ui/vvToolROIManager.ui @@ -6,8 +6,8 @@ 0 0 - 349 - 627 + 350 + 554 @@ -25,8 +25,8 @@ Form - - + + @@ -76,7 +76,7 @@ - + QFrame::StyledPanel @@ -84,106 +84,165 @@ QFrame::Raised - - - - - - - - 0 - 0 - - - - Load ROI from image - - - - - - - - 0 - 0 - - - - - 24 - 24 - - - - Open label image - - - - - - - :/common/icons/fileopen.png:/common/icons/fileopen.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - BG - - - - - - - - - - Tick if you want to consider FG mode instead of BG mode. - - - FG ? - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + 2 + + + 2 + + + + + + 0 + 0 + + + + Load ROI from image + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Open label image + + + + + + + :/common/icons/fileopen.png:/common/icons/fileopen.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + BG + + + + + + + + + + Tick if you want to consider FG mode instead of BG mode. + + + FG ? + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + Load DICOM-RT-Struct + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Open label image + + + + + + + :/common/icons/fileopen.png:/common/icons/fileopen.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + - + @@ -253,7 +312,7 @@ - + QFrame::StyledPanel @@ -398,6 +457,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -441,7 +513,7 @@ - Name : Lung + @@ -489,7 +561,7 @@ - + 2 @@ -617,6 +689,25 @@ + + mOpenBinaryButton + mBackgroundValueSpinBox + mBGModeCheckBox + mOpenDicomButton + mTree + mCheckBoxShow + mChangeColorButton + mReloadButton + mOpacitySlider + mOpacitySpinBox + mContourCheckBoxShow + mChangeContourColorButton + mContourWidthSpinBox + mDepthSpinBox + mCheckBoxShowAll + mContourCheckBoxShowAll + mCloseButton + @@ -628,12 +719,12 @@ setValue(int) - 219 - 385 + 289 + 371 - 376 - 376 + 413 + 374 @@ -648,8 +739,8 @@ 367 - 222 - 373 + 292 + 371 diff --git a/vv/vvToolCreatorBase.cxx b/vv/vvToolCreatorBase.cxx index 50a4489..f25926c 100644 --- a/vv/vvToolCreatorBase.cxx +++ b/vv/vvToolCreatorBase.cxx @@ -51,9 +51,12 @@ void vvToolCreatorBase::InsertToolInMenu(vvMainWindowBase * m) // Create main action if (mToolIconFilename == "noicon") mAction = new QAction(QString("&").append(mToolMenuName), this); - else + else { mAction = new QAction(QIcon(mToolIconFilename), QString("&").append(mToolMenuName), this); + mAction->setIconVisibleInMenu(true); + } + mAction->setStatusTip(mToolTip); // Connect the action connect(mAction, SIGNAL(triggered()), this, SLOT(MenuToolSlot())); diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx index fc95b26..d8bc827 100644 --- a/vv/vvToolROIManager.cxx +++ b/vv/vvToolROIManager.cxx @@ -41,34 +41,44 @@ ADD_TOOL(vvToolROIManager); //------------------------------------------------------------------------------ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f): - // vvToolWidgetBase(parent, f), - // if Qt::Widget -> No dialog in this case (in tab) ; PB = "invisible widget on menu" ! - // if "f" normal widget - QWidget(parent->GetTab()->widget(4)), + QWidget(parent->GetTab()), vvToolBase(parent), Ui::vvToolROIManager() { - // Insert the current QWidget into the tab layout (required) - QWidget * mother = qFindChild(parent->GetTab(), "ROItab"); - mother->layout()->addWidget(this); + // Store parent mMainWindow = parent; + // Assume the initial tab ROI index is 2 + mIndexFirstTab = 2; + + // Get the ROI Tab + QWidget * tab = qFindChild(parent->GetTab(), "ROItab"); + + // Set it as current + parent->GetTab()->setCurrentIndex(mIndexFirstTab); + + // Check if widget already used + if (tab->layout()->isEmpty()) { + tab->layout()->addWidget(this); + } + else { + close(); + return; + } + // Build the UI Ui_vvToolROIManager::setupUi(this); setAttribute(Qt::WA_DeleteOnClose); mTree->clear(); mTree->header()->resizeSection(0, 30); - parent->GetTab()->setCurrentIndex(2); // Set default LUT mDefaultLUTColor = vtkSmartPointer::New(); - DD(mDefaultLUTColor->GetNumberOfTableValues()); for(int i=0; iGetNumberOfTableValues(); i++) { double r = (rand()/(RAND_MAX+1.0)); double v = (rand()/(RAND_MAX+1.0)); double b = (rand()/(RAND_MAX+1.0)); mDefaultLUTColor->SetTableValue(i, r, v, b); - // std::cout << "mDefaultLUTColor->SetTableValue(" << i << ", " << r << ", " << v << ", " << b << ");" << std::endl; } #include "vvDefaultLut.h" @@ -97,8 +107,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f) connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI())); connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int))); connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool))); - - // mMainWindowBase->GetTab()->setTabIcon(mTabNumber, GetToolIcon()); + connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close())); } //------------------------------------------------------------------------------ @@ -126,12 +135,8 @@ void vvToolROIManager::Initialize() { //------------------------------------------------------------------------------ void vvToolROIManager::InputIsSelected(vvSlicerManager *m) { - std::cout << "vvToolROIManager::InputIsSelected()" << std::endl; mSlicerManager = m; - // Signal/slot - connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close())); - // Initialization mSlicerManager = m; mCurrentImage = mSlicerManager->GetImage(); @@ -155,15 +160,31 @@ void vvToolROIManager::InputIsSelected(vvSlicerManager *m) //------------------------------------------------------------------------------ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) { - if (m == mSlicerManager) close(); + DD("AnImageIsBeingClosed"); + if (m == mSlicerManager) { + close(); + return; + } +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolROIManager::close() +{ + DD("close"); + QWidget::close(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) { - if (m != mSlicerManager) hide(); - else show(); + DD("SelectedImageHasChanged"); + if (m != mSlicerManager) hide(); + else { + show(); + } } //------------------------------------------------------------------------------ @@ -213,8 +234,6 @@ void vvToolROIManager::OpenBinaryImage() void vvToolROIManager::AddImage(vvImage * binaryImage, std::string filename, double BG, bool modeBG) { - DD(modeBG); - // Check Dimension int dim = mCurrentImage->GetNumberOfDimensions(); int bin_dim = binaryImage->GetNumberOfDimensions(); @@ -228,13 +247,11 @@ void vvToolROIManager::AddImage(vvImage * binaryImage, std::string filename, // Compute roi index int n = mROIList.size(); - DD(n); // Compute the name of the new ROI std::ostringstream oss; oss << vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename)); std::string name = oss.str(); - DD(name); // Set color std::vector color; @@ -256,7 +273,6 @@ void vvToolROIManager::AddImage(vvImage * binaryImage, std::string filename, roi->SetForegroundValueLabelImage(BG); // Change color - DD("color"); if (nGetNumberOfTableValues ()) { double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ()); roi->SetDisplayColor(color[0], color[1], color[2]); @@ -319,7 +335,6 @@ void vvToolROIManager::UpdateAllROIStatus() { nbVisible++; } } - DD(nbVisible); // change the states disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int))); @@ -347,8 +362,6 @@ void vvToolROIManager::SelectedItemChangedInTree() { return; } QTreeWidgetItem * w = l[0]; - //std::cout << "selected item -> " << w->text(1).toStdString() << std::endl; - //std::cout << "m_NumberOfTool -> " << m_NumberOfTool << std::endl; if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) { // mCurrentROIActor = 0; mCurrentROI = NULL; @@ -391,6 +404,16 @@ void vvToolROIManager::SelectedItemChangedInTree() { connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int))); connect(mDepthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeDepth(int))); + + // Set the current color to the selected ROI name + mROInameLabel->setAutoFillBackground(true);// # This is important!! + mROInameLabel->setStyleSheet("QLabel { background-color : red; color : blue; }"); + QColor color = QColor(mCurrentROI->GetDisplayColor()[0]*255, + mCurrentROI->GetDisplayColor()[1]*255, + mCurrentROI->GetDisplayColor()[2]*255); + QString values = QString("%1, %2, %3").arg(color.red()).arg(color.green()).arg(color.blue()); + mROInameLabel->setStyleSheet("QLabel { background-color: rgb("+values+"); }"); + // is this needed ? // actor->Update(); // Final rendering @@ -542,5 +565,3 @@ void vvToolROIManager::ReloadCurrentROI() { mSlicerManager->Render(); } //------------------------------------------------------------------------------ - - diff --git a/vv/vvToolROIManager.h b/vv/vvToolROIManager.h index 14b9f42..4bbf394 100644 --- a/vv/vvToolROIManager.h +++ b/vv/vvToolROIManager.h @@ -62,12 +62,14 @@ class vvToolROIManager: void AllVisibleROIToggled(int b); void AllVisibleContourROIToggled(bool b); void ReloadCurrentROI(); + void close(); protected: Ui::vvToolROIManager ui; vvSlicerManager * mSlicerManager; vvImage * mCurrentImage; vvMainWindowBase * mMainWindow; + int mIndexFirstTab; int mNumberOfVisibleROI; int mNumberOfVisibleContourROI; @@ -85,7 +87,7 @@ protected: // Data for current selected roi clitk::DicomRT_ROI::Pointer mCurrentROI; - QSharedPointer mCurrentROIActor; + QSharedPointer mCurrentROIActor; }; // end class vvToolROIManager //------------------------------------------------------------------------------