--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolSimpleInputSelectorWidget</class>
+ <widget class="QWidget" name="vvToolSimpleInputSelectorWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>573</width>
+ <height>125</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="title">
+ <string>Select reference image</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QWidget" name="widget_2" native="true">
+ <layout class="QGridLayout" name="gridLayout_5">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="title">
+ <string>Already open</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QComboBox" name="mInputSequenceBox">
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <item>
+ <property name="text">
+ <string>Bidon image number 1</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="mRadioButtonLowerThan">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>OR</string>
+ </property>
+ <property name="autoExclusive">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="title">
+ <string>Open a new file</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Or open a new one</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButton">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit">
+ <property name="text">
+ <string>/home/toto/truc.mhd</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QGridLayout" name="gridLayout_4">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="mLabelInputInfo">
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>3D image Pixel type short bla bla</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="mInputSelectionButtonBox">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>mRadioButtonLowerThan</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>groupBox_3</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>296</x>
+ <y>102</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>528</x>
+ <y>122</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>mRadioButtonLowerThan</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mInputSequenceBox</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>269</x>
+ <y>93</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>214</x>
+ <y>93</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+/*=========================================================================
+
+ Program: vv
+ Module: $RCSfile: vvToolSimpleInputSelectorWidget.cxx,v $
+ Language: C++
+ Date: $Date: 2010/03/17 11:23:46 $
+ Version: $Revision: 1.1 $
+ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
+
+ Copyright (C) 2010
+ Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ CREATIS http://www.creatis.insa-lyon.fr
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ =========================================================================*/
+
+#ifndef VVTOOLINPUTSELECTORWIDGET_CXX
+#define VVTOOLINPUTSELECTORWIDGET_CXX
+
+#include "vvToolSimpleInputSelectorWidget.h"
+#include "vvSlicerManager.h"
+
+//------------------------------------------------------------------------------
+vvToolSimpleInputSelectorWidget::vvToolSimpleInputSelectorWidget(QWidget * parent, Qt::WindowFlags f):
+ QWidget(parent, f) {
+ setupUi(this);
+ setEnabled(true);
+ mSlicerManagerList.clear();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::Initialize() {
+ // Connect signals & slots
+ connect(mInputSelectionButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(mInputSelectionButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(mInputSequenceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeInput(int)));
+ DD("vvToolSimpleInputSelectorWidget::Initialize");
+ DD(mSlicerManagerList.size());
+ if (mSlicerManagerList.size() == 1) {
+ DD("Initialize::accept");
+ accept();
+ }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::SetInputList(const std::vector<vvSlicerManager*> & l, int index) {
+ DD("vvToolSimpleInputSelectorWidget::SetInputList");
+ DD(index);
+ mInputSequenceBox->clear();
+ for(unsigned int i=0; i<l.size(); i++)
+ mSlicerManagerList.push_back(l[i]);
+ mCurrentIndex = index;
+ for (unsigned int i = 0; i < mSlicerManagerList.size(); i++) {
+ mInputSequenceBox->addItem(mSlicerManagerList[i]->GetFileName().c_str());
+ }
+ mInputSequenceBox->setCurrentIndex(mCurrentIndex);
+ if (mSlicerManagerList.size() == 0) {
+ // TODO !!!
+ DD("no input > error message");
+ reject();
+ }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::setEnabled(bool b) {
+ QWidget::setEnabled(b);
+ mInputSelectionButtonBox->setEnabled(b);
+ mInputSequenceBox->setEnabled(b);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::accept() {
+ mInputSelectionButtonBox->setEnabled(false);
+ mInputSequenceBox->setEnabled(false);
+ emit accepted();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::reject() {
+ DD("vvToolSimpleInputSelectorWidget::reject()");
+ emit rejected();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolSimpleInputSelectorWidget::changeInput(int index) {
+ DD("changeInput");
+ DD(index);
+ if (index<0) return;
+ mCurrentIndex = index;
+ vvImage * mCurrentImage = mSlicerManagerList[index]->GetImage();
+ unsigned int d = mCurrentImage->GetNumberOfDimensions();
+ QString size;
+ QString spacing;
+ for(unsigned int i=0; i<d-1; i++) {
+ size.append(QString("%1").arg(mCurrentImage->GetSize()[i]));
+ size.append("x");
+ spacing.append(QString("%1").arg(mCurrentImage->GetSpacing()[i]));
+ spacing.append("x");
+ }
+ size.append(QString("%1").arg(mCurrentImage->GetSize()[d-1]));
+ spacing.append(QString("%1").arg(mCurrentImage->GetSpacing()[d-1]));
+ mLabelInputInfo->setText(QString("Image: %1D %2 %3 %4")
+ .arg(d)
+ .arg(mCurrentImage->GetScalarTypeAsString().c_str())
+ .arg(size)
+ .arg(spacing));
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvSlicerManager * vvToolSimpleInputSelectorWidget::GetSelectedInput() {
+ return mSlicerManagerList[GetSelectedInputIndex()];
+}
+//------------------------------------------------------------------------------
+
+#endif
+
--- /dev/null
+/*=========================================================================
+
+ Program: vv
+ Module: $RCSfile: vvToolSimpleInputSelectorWidget.h,v $
+ Language: C++
+ Date: $Date: 2010/03/17 11:23:45 $
+ Version: $Revision: 1.1 $
+ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
+
+ Copyright (C) 2010
+ Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ CREATIS http://www.creatis.insa-lyon.fr
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ =========================================================================*/
+
+#ifndef VVTOOLSIMPLEINPUTSELECTORWIDGET_H
+#define VVTOOLSIMPLEINPUTSELECTORWIDGET_H
+
+#include <QtDesigner/QDesignerExportWidget>
+#include <QDialog>
+#include "ui_vvToolSimpleInputSelectorWidget.h"
+
+class vvSlicerManager;
+
+//------------------------------------------------------------------------------
+class vvToolSimpleInputSelectorWidget: public QWidget, private Ui::vvToolSimpleInputSelectorWidget
+{
+ Q_OBJECT
+ public:
+ vvToolSimpleInputSelectorWidget(QWidget * parent=0, Qt::WindowFlags f=0);
+ ~vvToolSimpleInputSelectorWidget() {}
+
+ void SetInputList(const std::vector<vvSlicerManager*> & l, int index);
+ void Initialize();
+ int GetSelectedInputIndex() { return mCurrentIndex; }
+ vvSlicerManager * GetSelectedInput();
+
+ public slots:
+ void accept();
+ void reject();
+ void setEnabled(bool b);
+
+ signals:
+ void accepted();
+ void rejected();
+
+ protected slots:
+ void changeInput(int i);
+
+ protected:
+ Ui::vvToolSimpleInputSelectorWidget ui;
+ std::vector<vvSlicerManager*> mSlicerManagerList;
+ int mCurrentIndex;
+ vvSlicerManager * mCurrentSliceManager;
+
+}; // end class vvToolSimpleInputSelectorWidget
+//------------------------------------------------------------------------------
+
+#endif
+