1 /*=========================================================================
4 Module: $RCSfile: vvToolInputSelectorWidget.cxx,v $
6 Date: $Date: 2010/01/29 13:54:37 $
7 Version: $Revision: 1.1 $
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 DD("Initialize"); DD(index);
52 mInputSequenceBox->clear();
53 mSlicerManagerList = l;
54 mCurrentIndex = index;
55 for (unsigned int i = 0; i < mSlicerManagerList.size(); i++) {
56 mInputSequenceBox->addItem(mSlicerManagerList[i]->GetFileName().c_str());
58 mInputSequenceBox->setCurrentIndex(mCurrentIndex);
59 if (mSlicerManagerList.size() == 0) {
61 DD("no input > error message");
64 if (mSlicerManagerList.size() == 1) {
68 //------------------------------------------------------------------------------
71 //------------------------------------------------------------------------------
72 void vvToolInputSelectorWidget::SetToolTip(QString s) {
73 // mLabelSelection->setToolTip(s);
74 //mInputSequenceBox->setToolTip(s);
77 //------------------------------------------------------------------------------
80 //------------------------------------------------------------------------------
81 void vvToolInputSelectorWidget::accept() {
82 mInputSelectionButtonBox->setEnabled(false);
83 mInputSequenceBox->setEnabled(false);
86 //------------------------------------------------------------------------------
89 //------------------------------------------------------------------------------
90 void vvToolInputSelectorWidget::reject() {
93 //------------------------------------------------------------------------------
96 //------------------------------------------------------------------------------
97 void vvToolInputSelectorWidget::changeInput(int index) {
98 mCurrentIndex = index;
99 vvImage * mCurrentImage = mSlicerManagerList[index]->GetImage();
100 unsigned int d = mCurrentImage->GetNumberOfDimensions();
103 for(unsigned int i=0; i<d-1; i++) {
104 size.append(QString("%1").arg(mCurrentImage->GetSize()[i]));
106 spacing.append(QString("%1").arg(mCurrentImage->GetSpacing()[i]));
109 size.append(QString("%1").arg(mCurrentImage->GetSize()[d-1]));
110 spacing.append(QString("%1").arg(mCurrentImage->GetSpacing()[d-1]));
111 mLabelInputInfo->setText(QString("Image: %1D %2 %3 %4")
113 .arg(mCurrentImage->GetScalarTypeAsString().c_str())
117 //------------------------------------------------------------------------------