1 /*=========================================================================
4 Module: $RCSfile: vvToolInputSelectorWidget.cxx,v $
6 Date: $Date: 2010/02/24 11:42:42 $
7 Version: $Revision: 1.2 $
8 Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr)
11 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
12 CREATIS http://www.creatis.insa-lyon.fr
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, version 3 of the License.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 =========================================================================*/
28 #ifndef VVTOOLINPUTSELECTORWIDGET_CXX
29 #define VVTOOLINPUTSELECTORWIDGET_CXX
31 #include "vvToolInputSelectorWidget.h"
32 #include "vvSlicerManager.h"
34 //------------------------------------------------------------------------------
35 vvToolInputSelectorWidget::vvToolInputSelectorWidget(QWidget * parent, Qt::WindowFlags f):
41 // Connect signals & slots
42 connect(mInputSelectionButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
43 connect(mInputSelectionButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
44 connect(mInputSequenceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeInput(int)));
46 //------------------------------------------------------------------------------
49 //------------------------------------------------------------------------------
50 void vvToolInputSelectorWidget::Initialize(std::vector<vvSlicerManager*> l, int index) {
51 mInputSequenceBox->clear();
52 mSlicerManagerList = l;
53 mCurrentIndex = index;
54 for (unsigned int i = 0; i < mSlicerManagerList.size(); i++) {
55 mInputSequenceBox->addItem(mSlicerManagerList[i]->GetFileName().c_str());
57 mInputSequenceBox->setCurrentIndex(mCurrentIndex);
58 if (mSlicerManagerList.size() == 0) {
60 DD("no input > error message");
63 if (mSlicerManagerList.size() == 1) {
67 //------------------------------------------------------------------------------
70 //------------------------------------------------------------------------------
71 void vvToolInputSelectorWidget::SetToolTip(QString s) {
74 //------------------------------------------------------------------------------
77 //------------------------------------------------------------------------------
78 void vvToolInputSelectorWidget::accept() {
79 mInputSelectionButtonBox->setEnabled(false);
80 mInputSequenceBox->setEnabled(false);
83 //------------------------------------------------------------------------------
86 //------------------------------------------------------------------------------
87 void vvToolInputSelectorWidget::reject() {
90 //------------------------------------------------------------------------------
93 //------------------------------------------------------------------------------
94 void vvToolInputSelectorWidget::changeInput(int index) {
95 mCurrentIndex = index;
96 vvImage * mCurrentImage = mSlicerManagerList[index]->GetImage();
97 unsigned int d = mCurrentImage->GetNumberOfDimensions();
100 for(unsigned int i=0; i<d-1; i++) {
101 size.append(QString("%1").arg(mCurrentImage->GetSize()[i]));
103 spacing.append(QString("%1").arg(mCurrentImage->GetSpacing()[i]));
106 size.append(QString("%1").arg(mCurrentImage->GetSize()[d-1]));
107 spacing.append(QString("%1").arg(mCurrentImage->GetSpacing()[d-1]));
108 mLabelInputInfo->setText(QString("Image: %1D %2 %3 %4")
110 .arg(mCurrentImage->GetScalarTypeAsString().c_str())
114 //------------------------------------------------------------------------------