<ui version="4.0">
<class>vvMainWindow</class>
<widget class="QMainWindow" name="vvMainWindow">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
<property name="geometry">
<rect>
<x>0</x>
<x>0</x>
<y>0</y>
<width>1008</width>
- <height>23</height>
+ <height>27</height>
</rect>
</property>
<property name="defaultUp">
<rect>
<x>0</x>
<y>0</y>
- <width>264</width>
+ <width>261</width>
<height>120</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
<string>Progress</string>
</property>
<rect>
<x>0</x>
<y>0</y>
- <width>349</width>
- <height>378</height>
+ <width>249</width>
+ <height>97</height>
</rect>
</property>
<property name="windowTitle">
</layout>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="mOptionsBox">
- <property name="title">
- <string>Extract Lung Options</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <widget class="QCheckBox" name="mFullConnectivityCheckBox_2">
- <property name="text">
- <string>Resample before (faster)</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <property name="tristate">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="mSamplingSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="dimensionStaticLabel_6">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="2" column="2">
- <widget class="vvIntensityValueSlider" name="mThresholdSlider2" native="true">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Initial upper threshold for air</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="vvIntensityValueSlider" name="mThresholdSlider1" native="true"/>
- </item>
- <item row="2" column="1">
- <widget class="QRadioButton" name="mRadioButtonLowerThan">
- <property name="text">
- <string>lower threshold for air</string>
- </property>
- <property name="autoExclusive">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QLabel" name="dimensionStaticLabel_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Min size</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="mMinSizeSpinBox">
- <property name="maximum">
- <number>999999</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="mFullConnectivityCheckBox">
- <property name="text">
- <string>Full connectivity</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="tristate">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="dimensionStaticLabel_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="mBackgroundValueSpinBox"/>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="dimensionStaticLabel_4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>First Keep</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="mBackgroundValueSpinBox_2"/>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="dimensionStaticLabel_5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Last Keep</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="mBackgroundValueSpinBox_3"/>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
</layout>
</widget>
<customwidgets>
- <customwidget>
- <class>vvIntensityValueSlider</class>
- <extends>QWidget</extends>
- <header>vvIntensityValueSlider.h</header>
- <container>1</container>
- </customwidget>
<customwidget>
<class>vvLabelImageLoaderWidget</class>
<extends>QWidget</extends>
<resources>
<include location="../vvIcons.qrc"/>
</resources>
- <connections>
- <connection>
- <sender>mFullConnectivityCheckBox_2</sender>
- <signal>toggled(bool)</signal>
- <receiver>mSamplingSpinBox</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>151</x>
- <y>141</y>
- </hint>
- <hint type="destinationlabel">
- <x>233</x>
- <y>134</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>mFullConnectivityCheckBox_2</sender>
- <signal>toggled(bool)</signal>
- <receiver>dimensionStaticLabel_6</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>73</x>
- <y>141</y>
- </hint>
- <hint type="destinationlabel">
- <x>287</x>
- <y>143</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
</widget>
</item>
<item>
- <widget class="QDialogButtonBox" name="buttonBox">
+ <widget class="QDialogButtonBox" name="mMainButtonBox">
<property name="enabled">
<bool>false</bool>
</property>
mInputPathName = "";
mMenuTools = menuTools;
+ // mMenuSegmentation = menuSegmentation;
mContextMenu = &contextMenu;
mMenuExperimentalTools = menuExperimental;
mMainWidget = this;
bool SetImageSucceed=false;
// Change filename if an image with the same already exist
- // DD(files[i]);
- int number=0;
- for(unsigned int l=0; l<mSlicerManagers.size(); l++) {
- vvSlicerManager * v = mSlicerManagers[l];
- // DD(v->GetBaseFileName());
- // 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);
vvSurfaceViewerDialog surfaceViewer;
surfaceViewer.exec();
}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+int vvMainWindow::GetImageDuplicateFilenameNumber(std::string filename)
+{
+ int number=0;
+ for(unsigned int l=0; l<mSlicerManagers.size(); l++) {
+ vvSlicerManager * v = mSlicerManagers[l];
+ if (v->GetBaseFileName() ==
+ 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
int GetSlicerIndexFromItem(QTreeWidgetItem* item);
QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm);
void SaveScreenshot(vtkImageData* image);
+ int GetImageDuplicateFilenameNumber(std::string filename);
QMenu contextMenu;
//QMenu *AddSubImageMenu;
- 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);
+}
+//------------------------------------------------------------------------------
+
virtual QTabWidget * GetTab() = 0;
const std::vector<vvSlicerManager*> & 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; }
protected:
std::vector<vvSlicerManager*> mSlicerManagers;
QMenu * mMenuTools;
+ QMenu * mMenuSegmentation;
QMenu * mContextMenu;
QMenu * mMenuExperimentalTools;
int mSlicerManagerCurrentIndex;
{
mUseContextMenu = false;
mToolName = name;
+ m_MenuName = "Tools";
vvToolManager::GetInstance()->AddTool(this);
}
//------------------------------------------------------------------------------
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);
+ }
}
//------------------------------------------------------------------------------
======================================================================-====*/
#ifndef VVTOOLCREATORBASE_H
#define VVTOOLCREATORBASE_H
+
+//qt
#include <QObject>
+
+// vv
#include "vvSlicerManager.h"
#include "vvMainWindowBase.h"
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;
vvMainWindowBase * mMainWindow;
std::vector<vvToolBaseBase*> mListOfTool;
QObject * mSender;
+ std::string m_MenuName;
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolInputSelectorWidget::AddInputSelector(QString & s,
- const std::vector<vvSlicerManager*> & l,
- int index,
- bool allowSkip)
+ const std::vector<vvSlicerManager*> & 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<vvSlicerManager*> * ll = new std::vector<vvSlicerManager*>;
for(unsigned int i=0; i<l.size(); i++)
ll->push_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()));
//------------------------------------------------------------------------------
void vvToolInputSelectorWidget::Initialize()
{
- // setWindowModality(Qt::WindowModal);
for(unsigned int i=0; i<mListOfSimpleInputWidget.size(); i++)
mListOfSimpleInputWidget[i]->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; i<mListOfSimpleInputWidget.size(); i++) {
- // mListOfSimpleInputWidget[i]->Initialize();
mListOfSimpleInputWidget[mNumberOfAcceptedInputs]->setEnabled(true);
- //}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolInputSelectorWidget::reject()
{
- // DD("vvToolInputSelectorWidget::reject");
if (mNumberOfAcceptedInputs != 0) {
- // for(unsigned int i=mNumberOfAcceptedInputs; i<mListOfSimpleInputWidget.size(); i++) {
- // mListOfSimpleInputWidget[i]->Initialize();
- // DD(mNumberOfAcceptedInputs);
mListOfSimpleInputWidget[mNumberOfAcceptedInputs]->setEnabled(false);
mListOfSimpleInputWidget[mNumberOfAcceptedInputs-1]->setEnabled(true);
mNumberOfAcceptedInputs--;
- //}
} else {
emit rejected();
}
//------------------------------------------------------------------------------
void vvToolInputSelectorWidget::skip()
{
- // DD("SKIP");
mSkipInput[mNumberOfAcceptedInputs] = true;
- accept();//mNumberOfAcceptedInputs++;
+ accept();
}
//------------------------------------------------------------------------------
======================================================================-====*/
#ifndef VVTOOLINPUTSELECTORWIDGET_H
#define VVTOOLINPUTSELECTORWIDGET_H
+
+// qt
#include <QtDesigner/QDesignerExportWidget>
#include <QDialog>
+
+// vv
#include "ui_vvToolInputSelectorWidget.h"
class vvSlicerManager;
//------------------------------------------------------------------------------
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; i<d-1; i++) {
.arg(mCurrentImage->GetScalarTypeAsITKString().c_str())
.arg(size)
.arg(spacing));
- // DD("fin");
}
//------------------------------------------------------------------------------
}
else {
MustOpenDialogWhenCreated = false;
- buttonBox->setEnabled(true);
+ mMainButtonBox->setEnabled(true);
mCurrentSlicerManager = current;
mCurrentImage = mCurrentSlicerManager->GetImage();
mToolWidget->setEnabled(true);
}
// 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());
//------------------------------------------------------------------------------
void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
{
- DD("TODO CheckInputList");
-
for(unsigned int i=0; i<l.size(); i++) {
std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
if (iter != mListOfInputs.end()) {
// 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];