From 6d4c696c5443af116efb9bb5b7a202bdf0104281 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Thu, 22 Jul 2010 05:51:58 +0000 Subject: [PATCH] cosmetic --- vv/qt_ui/vvMainWindow.ui | 5 +- vv/qt_ui/vvProgressDialog.ui | 8 +- vv/qt_ui/vvToolExtractLung.ui | 290 +------------------------ vv/qt_ui/vvToolWidgetBase.ui | 2 +- vv/vvMainWindow.cxx | 41 ++-- vv/vvMainWindow.h | 1 + vv/vvMainWindowBase.cxx | 11 + vv/vvMainWindowBase.h | 2 + vv/vvToolCreatorBase.cxx | 6 +- vv/vvToolCreatorBase.h | 6 + vv/vvToolInputSelectorWidget.cxx | 33 +-- vv/vvToolInputSelectorWidget.h | 4 + vv/vvToolSimpleInputSelectorWidget.cxx | 4 - vv/vvToolStructureSetManager.cxx | 9 +- 14 files changed, 79 insertions(+), 343 deletions(-) diff --git a/vv/qt_ui/vvMainWindow.ui b/vv/qt_ui/vvMainWindow.ui index 496ff49..0dffe7b 100644 --- a/vv/qt_ui/vvMainWindow.ui +++ b/vv/qt_ui/vvMainWindow.ui @@ -2,6 +2,9 @@ vvMainWindow + + true + 0 @@ -758,7 +761,7 @@ 0 0 1008 - 23 + 27 diff --git a/vv/qt_ui/vvProgressDialog.ui b/vv/qt_ui/vvProgressDialog.ui index b1280ef..4b5c5f6 100644 --- a/vv/qt_ui/vvProgressDialog.ui +++ b/vv/qt_ui/vvProgressDialog.ui @@ -9,10 +9,16 @@ 0 0 - 264 + 261 120 + + + 0 + 0 + + Progress diff --git a/vv/qt_ui/vvToolExtractLung.ui b/vv/qt_ui/vvToolExtractLung.ui index 70609a1..f498c1b 100644 --- a/vv/qt_ui/vvToolExtractLung.ui +++ b/vv/qt_ui/vvToolExtractLung.ui @@ -6,8 +6,8 @@ 0 0 - 349 - 378 + 249 + 97 @@ -46,260 +46,9 @@ - - - - Extract Lung Options - - - - - - - - Resample before (faster) - - - false - - - false - - - - - - - false - - - - - - - false - - - - 0 - 0 - - - - mm - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - false - - - - - - - Initial upper threshold for air - - - - - - - - - - lower threshold for air - - - false - - - - - - - - - - - - 0 - 0 - - - - Min size - - - - - - - 999999 - - - 100 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Full connectivity - - - true - - - true - - - - - - - - - - 0 - 0 - - - - Remove - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - First Keep - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - Last Keep - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - vvIntensityValueSlider - QWidget -
vvIntensityValueSlider.h
- 1 -
vvLabelImageLoaderWidget QWidget @@ -310,38 +59,5 @@ - - - mFullConnectivityCheckBox_2 - toggled(bool) - mSamplingSpinBox - setEnabled(bool) - - - 151 - 141 - - - 233 - 134 - - - - - mFullConnectivityCheckBox_2 - toggled(bool) - dimensionStaticLabel_6 - setEnabled(bool) - - - 73 - 141 - - - 287 - 143 - - - - +
diff --git a/vv/qt_ui/vvToolWidgetBase.ui b/vv/qt_ui/vvToolWidgetBase.ui index e4f5653..944fea4 100644 --- a/vv/qt_ui/vvToolWidgetBase.ui +++ b/vv/qt_ui/vvToolWidgetBase.ui @@ -31,7 +31,7 @@ - + false diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index bf56a35..10dc42d 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -98,6 +98,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() mInputPathName = ""; mMenuTools = menuTools; + // mMenuSegmentation = menuSegmentation; mContextMenu = &contextMenu; mMenuExperimentalTools = menuExperimental; mMainWidget = this; @@ -765,18 +766,7 @@ void vvMainWindow::LoadImages(std::vector files, LoadedImageType fi bool SetImageSucceed=false; // Change filename if an image with the same already exist - // DD(files[i]); - int number=0; - for(unsigned int l=0; lGetBaseFileName()); - // DD(v->GetFileName()); - if (v->GetBaseFileName() == - vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(files[i]))) { - number = std::max(number, v->GetBaseFileNameNumber()+1); - } - } - + int number = GetImageDuplicateFilenameNumber(files[i]); if (filetype == IMAGE || filetype == IMAGEWITHTIME) SetImageSucceed = imageManager->SetImage(files[i],filetype, number); @@ -2715,13 +2705,36 @@ void vvMainWindow::SurfaceViewerLaunch() vvSurfaceViewerDialog surfaceViewer; surfaceViewer.exec(); } +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +int vvMainWindow::GetImageDuplicateFilenameNumber(std::string filename) +{ + int number=0; + for(unsigned int l=0; lGetBaseFileName() == + vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename))) { + number = std::max(number, v->GetBaseFileNameNumber()+1); + } + } + return number; +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filename) { + // Change filename if another image exist with the same name + int number = GetImageDuplicateFilenameNumber(filename); + + // Create new SliceManager vvSlicerManager* slicer_manager = new vvSlicerManager(4); - slicer_manager->SetImage(image); - slicer_manager->SetFilename(filename); + slicer_manager->SetImage(image);//, IMAGE, number); + // filename = filename+"_"+clitk::toString(number); + slicer_manager->SetFilename(filename, number); mSlicerManagers.push_back(slicer_manager); //create an item in the tree with good settings diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index 52da158..d4f23b1 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -173,6 +173,7 @@ private: int GetSlicerIndexFromItem(QTreeWidgetItem* item); QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm); void SaveScreenshot(vtkImageData* image); + int GetImageDuplicateFilenameNumber(std::string filename); QMenu contextMenu; //QMenu *AddSubImageMenu; diff --git a/vv/vvMainWindowBase.cxx b/vv/vvMainWindowBase.cxx index c94b1cd..1783962 100644 --- a/vv/vvMainWindowBase.cxx +++ b/vv/vvMainWindowBase.cxx @@ -15,6 +15,17 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ + #include "vvMainWindowBase.h" +//------------------------------------------------------------------------------ +QMenu * vvMainWindowBase::GetMenu(std::string menuName) const +{ + if (menuName == "Tools") return mMenuTools; + if (menuName == "Segmentation") return mMenuSegmentation; + std::cerr << "Error in vvMainWindowBase::GetMenu: menu '" << menuName << "' is unknown." << std::endl; + exit(0); +} +//------------------------------------------------------------------------------ + diff --git a/vv/vvMainWindowBase.h b/vv/vvMainWindowBase.h index 77e5539..a2787e4 100644 --- a/vv/vvMainWindowBase.h +++ b/vv/vvMainWindowBase.h @@ -40,6 +40,7 @@ public: virtual QTabWidget * GetTab() = 0; const std::vector & GetSlicerManagers() const { return mSlicerManagers; } QMenu * GetToolMenu() const { return mMenuTools; } + QMenu * GetMenu(std::string menuName) const;// { return mMenuTools; } QMenu * GetContextMenu() const { return mContextMenu; } QMenu * GetExperimentalToolMenu() const { return mMenuExperimentalTools; } int GetSlicerManagerCurrentIndex() const { return mSlicerManagerCurrentIndex; } @@ -53,6 +54,7 @@ signals: protected: std::vector mSlicerManagers; QMenu * mMenuTools; + QMenu * mMenuSegmentation; QMenu * mContextMenu; QMenu * mMenuExperimentalTools; int mSlicerManagerCurrentIndex; diff --git a/vv/vvToolCreatorBase.cxx b/vv/vvToolCreatorBase.cxx index 3b0610c..bb10c0f 100644 --- a/vv/vvToolCreatorBase.cxx +++ b/vv/vvToolCreatorBase.cxx @@ -26,6 +26,7 @@ vvToolCreatorBase::vvToolCreatorBase(QString name): mExperimental(false) { mUseContextMenu = false; mToolName = name; + m_MenuName = "Tools"; vvToolManager::GetInstance()->AddTool(this); } //------------------------------------------------------------------------------ @@ -58,8 +59,9 @@ void vvToolCreatorBase::InsertToolInMenu(vvMainWindowBase * m) connect(mAction, SIGNAL(triggered()), this, SLOT(MenuToolSlot())); if (mExperimental) mMainWindow->GetExperimentalToolMenu()->addAction(mAction); - else - mMainWindow->GetToolMenu()->addAction(mAction); + else { + mMainWindow->GetMenu(m_MenuName)->addAction(mAction); + } } //------------------------------------------------------------------------------ diff --git a/vv/vvToolCreatorBase.h b/vv/vvToolCreatorBase.h index 0255888..28610f5 100644 --- a/vv/vvToolCreatorBase.h +++ b/vv/vvToolCreatorBase.h @@ -17,7 +17,11 @@ ======================================================================-====*/ #ifndef VVTOOLCREATORBASE_H #define VVTOOLCREATORBASE_H + +//qt #include + +// vv #include "vvSlicerManager.h" #include "vvMainWindowBase.h" @@ -37,6 +41,7 @@ class vvToolCreatorBase: public QObject { virtual void MenuSpecificToolSlot() = 0; vvMainWindowBase * GetMainWindow() const { return mMainWindow; } void addMenuToContextMenu(QMenu * m); + void SetMenuName(std::string m) { m_MenuName = m; } QString mToolName; QString mToolMenuName; @@ -55,6 +60,7 @@ protected: vvMainWindowBase * mMainWindow; std::vector mListOfTool; QObject * mSender; + std::string m_MenuName; }; //------------------------------------------------------------------------------ diff --git a/vv/vvToolInputSelectorWidget.cxx b/vv/vvToolInputSelectorWidget.cxx index 9495705..25ef5e5 100644 --- a/vv/vvToolInputSelectorWidget.cxx +++ b/vv/vvToolInputSelectorWidget.cxx @@ -42,34 +42,29 @@ int vvToolInputSelectorWidget::GetNumberOfInput() //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::AddInputSelector(QString & s, - const std::vector & l, - int index, - bool allowSkip) + const std::vector & l, + int index, + bool allowSkip) { - // DD("ICICICICICICICIC AddInputSelector ADD layout"); - // DD(index); - //DD(l.size()); + // Create a input selector widget vvToolSimpleInputSelectorWidget * input = new vvToolSimpleInputSelectorWidget; mListOfSimpleInputWidget.push_back(input); mSkipInput.push_back(false); - input->SetText(s); input->EnableAllowSkip(allowSkip); - // copy list + // Copy the list of slicermanager std::vector * ll = new std::vector; for(unsigned int i=0; ipush_back(l[i]); - // add + // Add input->SetInputList(*ll, index); - // input->setObjectName(QString::fromUtf8("TOTO")); mVerticalLayout->addWidget(input); // Enable or disable if (GetNumberOfInput() == 1) input->setEnabled(true); else input->setEnabled(false); - //DD(GetNumberOfInput()); // Connect signals & slots connect(input, SIGNAL(accepted()), this, SLOT(accept())); @@ -82,7 +77,6 @@ void vvToolInputSelectorWidget::AddInputSelector(QString & s, //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::Initialize() { - // setWindowModality(Qt::WindowModal); for(unsigned int i=0; iInitialize(); } @@ -92,19 +86,12 @@ void vvToolInputSelectorWidget::Initialize() //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::accept() { - // setWindowModality(Qt::NonModal); - // DD("vvToolInputSelectorWidget::accept"); - //DD(mNumberOfAcceptedInputs); mNumberOfAcceptedInputs++; if (mNumberOfAcceptedInputs == GetNumberOfInput()) { setEnabled(false); emit accepted(); } else { - //DD("accepted"); - // for(unsigned int i=mNumberOfAcceptedInputs; iInitialize(); mListOfSimpleInputWidget[mNumberOfAcceptedInputs]->setEnabled(true); - //} } } //------------------------------------------------------------------------------ @@ -113,15 +100,10 @@ void vvToolInputSelectorWidget::accept() //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::reject() { - // DD("vvToolInputSelectorWidget::reject"); if (mNumberOfAcceptedInputs != 0) { - // for(unsigned int i=mNumberOfAcceptedInputs; iInitialize(); - // DD(mNumberOfAcceptedInputs); mListOfSimpleInputWidget[mNumberOfAcceptedInputs]->setEnabled(false); mListOfSimpleInputWidget[mNumberOfAcceptedInputs-1]->setEnabled(true); mNumberOfAcceptedInputs--; - //} } else { emit rejected(); } @@ -132,9 +114,8 @@ void vvToolInputSelectorWidget::reject() //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::skip() { - // DD("SKIP"); mSkipInput[mNumberOfAcceptedInputs] = true; - accept();//mNumberOfAcceptedInputs++; + accept(); } //------------------------------------------------------------------------------ diff --git a/vv/vvToolInputSelectorWidget.h b/vv/vvToolInputSelectorWidget.h index b965f53..8755c0f 100644 --- a/vv/vvToolInputSelectorWidget.h +++ b/vv/vvToolInputSelectorWidget.h @@ -17,8 +17,12 @@ ======================================================================-====*/ #ifndef VVTOOLINPUTSELECTORWIDGET_H #define VVTOOLINPUTSELECTORWIDGET_H + +// qt #include #include + +// vv #include "ui_vvToolInputSelectorWidget.h" class vvSlicerManager; diff --git a/vv/vvToolSimpleInputSelectorWidget.cxx b/vv/vvToolSimpleInputSelectorWidget.cxx index 0f0860a..94c7aba 100644 --- a/vv/vvToolSimpleInputSelectorWidget.cxx +++ b/vv/vvToolSimpleInputSelectorWidget.cxx @@ -136,15 +136,12 @@ void vvToolSimpleInputSelectorWidget::skip(QAbstractButton* b) //------------------------------------------------------------------------------ void vvToolSimpleInputSelectorWidget::changeInput(int index) { - // DD(index); if (index<0) return; if (index>=(int)mSlicerManagerList.size()) return; mCurrentIndex = index; vvImage * mCurrentImage = mSlicerManagerList[index]->GetImage(); if (mCurrentImage == NULL) return; - // DD("la"); unsigned int d = mCurrentImage->GetNumberOfDimensions(); - // DD(d); QString size; QString spacing; for(unsigned int i=0; iGetScalarTypeAsITKString().c_str()) .arg(size) .arg(spacing)); - // DD("fin"); } //------------------------------------------------------------------------------ diff --git a/vv/vvToolStructureSetManager.cxx b/vv/vvToolStructureSetManager.cxx index a755369..52a4f66 100644 --- a/vv/vvToolStructureSetManager.cxx +++ b/vv/vvToolStructureSetManager.cxx @@ -86,7 +86,7 @@ vvToolStructureSetManager::vvToolStructureSetManager(vvMainWindowBase * parent, } else { MustOpenDialogWhenCreated = false; - buttonBox->setEnabled(true); + mMainButtonBox->setEnabled(true); mCurrentSlicerManager = current; mCurrentImage = mCurrentSlicerManager->GetImage(); mToolWidget->setEnabled(true); @@ -585,7 +585,7 @@ void vvToolStructureSetManager::ReloadCurrentROI() { } // delete mCurrentROI->GetImage(); // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetDataReleased()); -// DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetReferenceCount()); + // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetReferenceCount()); mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData(); // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetDataReleased()); mCurrentROI->SetImage(mReader->GetOutput()); @@ -600,8 +600,6 @@ void vvToolStructureSetManager::ReloadCurrentROI() { //------------------------------------------------------------------------------ void vvToolStructureSetManager::CheckInputList(std::vector & l, int & index) { - DD("TODO CheckInputList"); - for(unsigned int i=0; i::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]); if (iter != mListOfInputs.end()) { @@ -619,9 +617,6 @@ void vvToolStructureSetManager::CheckInputList(std::vector & l // STATIC vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG) { - DD("static AddImage"); - DD(mListOfInputs.size()); - // If the tool is open for this vvSlicerManager, use it and return if (mListOfOpenTool[m]) { vvToolStructureSetManager * tool = mListOfOpenTool[m]; -- 2.47.1