]> Creatis software - clitk.git/blob - vv/vvStructSelector.cxx
Initial revision
[clitk.git] / vv / vvStructSelector.cxx
1 /*=========================================================================
2
3  Program:   vv
4  Language:  C++
5  Author :   Joel Schaerer (joel.schaerer@insa-lyon.fr)
6
7 Copyright (C) 2008
8 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
9 CREATIS-LRMN http://www.creatis.insa-lyon.fr
10
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, version 3 of the License.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23 =========================================================================*/
24
25 #include "vvStructSelector.h"
26 #include <iostream>
27 #include <sstream>
28
29 void vvStructSelector::SetStructures(StructureType structures)
30 {
31     mStructures=structures;
32     for (StructureType::iterator i=structures.begin();i!=structures.end();i++)
33     {
34         std::ostringstream ss;
35         ss << (*i).first << ":" << (*i).second;
36         this->structSelectionWidget->addItem(ss.str().c_str());
37     }
38 }
39
40 std::vector<int> vvStructSelector::getSelectedItems()
41 {
42     std::vector<int> result;
43     for (int i=0;i<structSelectionWidget->count();i++)
44     {
45         if (structSelectionWidget->item(i)->isSelected())
46             result.push_back(mStructures[i].first);
47     }
48     return result;
49 }
50
51
52 vvStructSelector::vvStructSelector()
53 {
54     setupUi(this);
55 }