Skip to content

Commit 2daf6a3

Browse files
committed
Closes #465
1 parent 521ecfe commit 2daf6a3

File tree

8 files changed

+1227
-179
lines changed

8 files changed

+1227
-179
lines changed

src/ExampleNets/regression/getFromBundle.srn5

Lines changed: 841 additions & 0 deletions
Large diffs are not rendered by default.

src/Interface/Modules/Bundle/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
SET(Interface_Modules_Bundle_FORMS
3131
GetFieldsFromBundleDialog.ui
32+
GetMatricesFromBundleDialog.ui
3233
GetStringsFromBundleDialog.ui
3334
InsertFieldsIntoBundleDialog.ui
3435
InsertMatricesIntoBundleDialog.ui
@@ -38,6 +39,7 @@ SET(Interface_Modules_Bundle_FORMS
3839

3940
SET(Interface_Modules_Bundle_HEADERS
4041
GetFieldsFromBundleDialog.h
42+
GetMatricesFromBundleDialog.h
4143
GetStringsFromBundleDialog.h
4244
InsertFieldsIntoBundleDialog.h
4345
InsertMatricesIntoBundleDialog.h
@@ -48,6 +50,7 @@ SET(Interface_Modules_Bundle_HEADERS
4850

4951
SET(Interface_Modules_Bundle_SOURCES
5052
GetFieldsFromBundleDialog.cc
53+
GetMatricesFromBundleDialog.cc
5154
GetStringsFromBundleDialog.cc
5255
InsertFieldsIntoBundleDialog.cc
5356
InsertMatricesIntoBundleDialog.cc
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2015 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#include <Modules/Legacy/Bundle/GetMatricesFromBundle.h>
30+
#include <Interface/Modules/Bundle/GetMatricesFromBundleDialog.h>
31+
#include <Core/Algorithms/Base/AlgorithmVariableNames.h>
32+
#include <Dataflow/Network/ModuleStateInterface.h> //TODO: extract into intermediate
33+
34+
using namespace SCIRun::Gui;
35+
using namespace SCIRun::Dataflow::Networks;
36+
using namespace SCIRun::Core::Algorithms;
37+
using namespace SCIRun::Modules::Bundles;
38+
39+
GetMatricesFromBundleDialog::GetMatricesFromBundleDialog(const std::string& name, ModuleStateHandle state,
40+
QWidget* parent /* = 0 */)
41+
: ModuleDialogGeneric(state, parent)
42+
{
43+
setupUi(this);
44+
setWindowTitle(QString::fromStdString(name));
45+
fixSize();
46+
addComboBoxManager(fieldComboBox1_, GetMatricesFromBundle::MatrixNames[0]);
47+
addComboBoxManager(fieldComboBox2_, GetMatricesFromBundle::MatrixNames[1]);
48+
addComboBoxManager(fieldComboBox3_, GetMatricesFromBundle::MatrixNames[2]);
49+
addComboBoxManager(fieldComboBox4_, GetMatricesFromBundle::MatrixNames[3]);
50+
addComboBoxManager(fieldComboBox5_, GetMatricesFromBundle::MatrixNames[4]);
51+
addComboBoxManager(fieldComboBox6_, GetMatricesFromBundle::MatrixNames[5]);
52+
}
53+
54+
void GetMatricesFromBundleDialog::pullSpecial()
55+
{
56+
auto names = transient_value_cast<std::vector<std::string>>(state_->getTransientValue(GetMatricesFromBundle::MatrixNameList.name()));
57+
if (matrixNames_ != names)
58+
{
59+
matrixNames_ = names;
60+
//TODO: put into an array, call functions.
61+
fieldComboBox1_->clear();
62+
fieldComboBox2_->clear();
63+
fieldComboBox3_->clear();
64+
fieldComboBox4_->clear();
65+
fieldComboBox5_->clear();
66+
fieldComboBox6_->clear();
67+
fieldObjectListWidget_->clear();
68+
69+
for (const auto& name : names)
70+
{
71+
auto qname = QString::fromStdString(name);
72+
fieldObjectListWidget_->addItem(qname);
73+
fieldComboBox1_->addItem(qname);
74+
fieldComboBox2_->addItem(qname);
75+
fieldComboBox3_->addItem(qname);
76+
fieldComboBox4_->addItem(qname);
77+
fieldComboBox5_->addItem(qname);
78+
fieldComboBox6_->addItem(qname);
79+
}
80+
fieldComboBox1_->setCurrentIndex(fieldComboBox1_->findText(QString::fromStdString(state_->getValue(GetMatricesFromBundle::MatrixNames[0]).toString())));
81+
fieldComboBox2_->setCurrentIndex(fieldComboBox2_->findText(QString::fromStdString(state_->getValue(GetMatricesFromBundle::MatrixNames[1]).toString())));
82+
fieldComboBox3_->setCurrentIndex(fieldComboBox3_->findText(QString::fromStdString(state_->getValue(GetMatricesFromBundle::MatrixNames[2]).toString())));
83+
fieldComboBox4_->setCurrentIndex(fieldComboBox4_->findText(QString::fromStdString(state_->getValue(GetMatricesFromBundle::MatrixNames[3]).toString())));
84+
fieldComboBox5_->setCurrentIndex(fieldComboBox5_->findText(QString::fromStdString(state_->getValue(GetMatricesFromBundle::MatrixNames[4]).toString())));
85+
fieldComboBox6_->setCurrentIndex(fieldComboBox6_->findText(QString::fromStdString(state_->getValue(GetMatricesFromBundle::MatrixNames[5]).toString())));
86+
}
87+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2015 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#ifndef INTERFACE_MODULES_GETMATRICESFROMBUNDLE_H
30+
#define INTERFACE_MODULES_GETMATRICESFROMBUNDLE_H
31+
32+
#include "Interface/Modules/Bundle/ui_GetMatricesFromBundleDialog.h"
33+
#include <Interface/Modules/Base/ModuleDialogGeneric.h>
34+
#include <Interface/Modules/Bundle/share.h>
35+
36+
namespace SCIRun {
37+
namespace Gui {
38+
39+
class SCISHARE GetMatricesFromBundleDialog : public ModuleDialogGeneric, public Ui::GetMatricesFromBundleDialog
40+
{
41+
Q_OBJECT
42+
43+
public:
44+
GetMatricesFromBundleDialog(const std::string& name,
45+
SCIRun::Dataflow::Networks::ModuleStateHandle state,
46+
QWidget* parent = 0);
47+
protected:
48+
virtual void pullSpecial() override;
49+
private:
50+
std::vector<std::string> matrixNames_;
51+
};
52+
53+
}
54+
}
55+
56+
#endif
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>GetMatricesFromBundleDialog</class>
4+
<widget class="QDialog" name="GetMatricesFromBundleDialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>612</width>
10+
<height>261</height>
11+
</rect>
12+
</property>
13+
<property name="minimumSize">
14+
<size>
15+
<width>600</width>
16+
<height>246</height>
17+
</size>
18+
</property>
19+
<property name="windowTitle">
20+
<string>Dialog</string>
21+
</property>
22+
<layout class="QHBoxLayout" name="horizontalLayout">
23+
<item>
24+
<widget class="QGroupBox" name="groupBox">
25+
<property name="sizePolicy">
26+
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
27+
<horstretch>0</horstretch>
28+
<verstretch>0</verstretch>
29+
</sizepolicy>
30+
</property>
31+
<property name="maximumSize">
32+
<size>
33+
<width>16777215</width>
34+
<height>200</height>
35+
</size>
36+
</property>
37+
<property name="title">
38+
<string>Bundle Matrix Outputs</string>
39+
</property>
40+
<property name="alignment">
41+
<set>Qt::AlignCenter</set>
42+
</property>
43+
<layout class="QGridLayout" name="gridLayout_2">
44+
<item row="0" column="0">
45+
<widget class="QLabel" name="label">
46+
<property name="text">
47+
<string>Matrix 1:</string>
48+
</property>
49+
</widget>
50+
</item>
51+
<item row="1" column="0">
52+
<widget class="QLabel" name="label_2">
53+
<property name="text">
54+
<string>Matrix 2:</string>
55+
</property>
56+
</widget>
57+
</item>
58+
<item row="2" column="0">
59+
<widget class="QLabel" name="label_3">
60+
<property name="text">
61+
<string>Matrix 3:</string>
62+
</property>
63+
</widget>
64+
</item>
65+
<item row="3" column="0">
66+
<widget class="QLabel" name="label_4">
67+
<property name="text">
68+
<string>Matrix 4:</string>
69+
</property>
70+
</widget>
71+
</item>
72+
<item row="4" column="0">
73+
<widget class="QLabel" name="label_5">
74+
<property name="text">
75+
<string>Matrix 5:</string>
76+
</property>
77+
</widget>
78+
</item>
79+
<item row="5" column="0">
80+
<widget class="QLabel" name="label_6">
81+
<property name="text">
82+
<string>Matrix 6:</string>
83+
</property>
84+
</widget>
85+
</item>
86+
<item row="0" column="1">
87+
<widget class="QComboBox" name="fieldComboBox1_">
88+
<property name="minimumSize">
89+
<size>
90+
<width>150</width>
91+
<height>0</height>
92+
</size>
93+
</property>
94+
</widget>
95+
</item>
96+
<item row="1" column="1">
97+
<widget class="QComboBox" name="fieldComboBox2_"/>
98+
</item>
99+
<item row="2" column="1">
100+
<widget class="QComboBox" name="fieldComboBox3_"/>
101+
</item>
102+
<item row="4" column="1">
103+
<widget class="QComboBox" name="fieldComboBox5_"/>
104+
</item>
105+
<item row="5" column="1">
106+
<widget class="QComboBox" name="fieldComboBox6_"/>
107+
</item>
108+
<item row="3" column="1">
109+
<widget class="QComboBox" name="fieldComboBox4_"/>
110+
</item>
111+
</layout>
112+
</widget>
113+
</item>
114+
<item>
115+
<widget class="QGroupBox" name="groupBox_2">
116+
<property name="maximumSize">
117+
<size>
118+
<width>16777215</width>
119+
<height>200</height>
120+
</size>
121+
</property>
122+
<property name="title">
123+
<string>Matrix Object Names</string>
124+
</property>
125+
<property name="alignment">
126+
<set>Qt::AlignCenter</set>
127+
</property>
128+
<layout class="QGridLayout" name="gridLayout">
129+
<item row="0" column="0">
130+
<widget class="QListWidget" name="fieldObjectListWidget_"/>
131+
</item>
132+
</layout>
133+
</widget>
134+
</item>
135+
</layout>
136+
</widget>
137+
<resources/>
138+
<connections/>
139+
</ui>

src/Modules/Factory/Config/GetMatricesFromBundle.module

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"header": "N/A"
1313
},
1414
"UI": {
15-
"name": "N/A",
16-
"header": "N/A"
15+
"name": "GetMatricesFromBundleDialog",
16+
"header": "Interface/Modules/Bundle/GetMatricesFromBundleDialog.h"
1717
}
1818
}

0 commit comments

Comments
 (0)