Commit ede9d099bee202963cb8cc9dd6b0cc3ac1ed3f82
1 parent
8ce535ac
Exists in
usp-navegador
ENH: Restructuring the spatial tracker communication.
Showing
5 changed files
with
547 additions
and
363 deletions
Show diff stats
invesalius/.idea/workspace.xml
@@ -2,10 +2,10 @@ | @@ -2,10 +2,10 @@ | ||
2 | <project version="4"> | 2 | <project version="4"> |
3 | <component name="ChangeListManager"> | 3 | <component name="ChangeListManager"> |
4 | <list default="true" id="1c49d80e-bb12-444a-b5f1-49d733261d55" name="Default" comment=""> | 4 | <list default="true" id="1c49d80e-bb12-444a-b5f1-49d733261d55" name="Default" comment=""> |
5 | - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/constants.py" afterPath="$PROJECT_DIR$/constants.py" /> | ||
6 | <change type="MODIFICATION" beforePath="$PROJECT_DIR$/data/coordinates.py" afterPath="$PROJECT_DIR$/data/coordinates.py" /> | 5 | <change type="MODIFICATION" beforePath="$PROJECT_DIR$/data/coordinates.py" afterPath="$PROJECT_DIR$/data/coordinates.py" /> |
6 | + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gui/dialogs.py" afterPath="$PROJECT_DIR$/gui/dialogs.py" /> | ||
7 | <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gui/task_navigator.py" afterPath="$PROJECT_DIR$/gui/task_navigator.py" /> | 7 | <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gui/task_navigator.py" afterPath="$PROJECT_DIR$/gui/task_navigator.py" /> |
8 | - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> | 8 | + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/data/trackers.py" afterPath="$PROJECT_DIR$/data/trackers.py" /> |
9 | </list> | 9 | </list> |
10 | <ignored path="invesalius.iws" /> | 10 | <ignored path="invesalius.iws" /> |
11 | <ignored path=".idea/workspace.xml" /> | 11 | <ignored path=".idea/workspace.xml" /> |
@@ -30,13 +30,38 @@ | @@ -30,13 +30,38 @@ | ||
30 | </component> | 30 | </component> |
31 | <component name="FileEditorManager"> | 31 | <component name="FileEditorManager"> |
32 | <leaf> | 32 | <leaf> |
33 | - <file leaf-file-name="coordinates.py" pinned="false" current-in-tab="true"> | 33 | + <file leaf-file-name="coordinates.py" pinned="false" current-in-tab="false"> |
34 | <entry file="file://$PROJECT_DIR$/data/coordinates.py"> | 34 | <entry file="file://$PROJECT_DIR$/data/coordinates.py"> |
35 | <provider selected="true" editor-type-id="text-editor"> | 35 | <provider selected="true" editor-type-id="text-editor"> |
36 | - <state vertical-scroll-proportion="0.0" vertical-offset="612" max-vertical-offset="5423"> | ||
37 | - <caret line="36" column="28" selection-start-line="36" selection-start-column="28" selection-end-line="36" selection-end-column="28" /> | 36 | + <state vertical-scroll-proportion="0.0" vertical-offset="102" max-vertical-offset="4964"> |
37 | + <caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" /> | ||
38 | <folding> | 38 | <folding> |
39 | - <element signature="e#0#10#0" expanded="true" /> | 39 | + <element signature="e#2#20#0" expanded="true" /> |
40 | + <element signature="e#7877#9444#0" expanded="false" /> | ||
41 | + </folding> | ||
42 | + </state> | ||
43 | + </provider> | ||
44 | + </entry> | ||
45 | + </file> | ||
46 | + <file leaf-file-name="trackers.py" pinned="false" current-in-tab="true"> | ||
47 | + <entry file="file://$PROJECT_DIR$/data/trackers.py"> | ||
48 | + <provider selected="true" editor-type-id="text-editor"> | ||
49 | + <state vertical-scroll-proportion="0.18106312" vertical-offset="894" max-vertical-offset="3128"> | ||
50 | + <caret line="59" column="24" selection-start-line="59" selection-start-column="24" selection-end-line="59" selection-end-column="24" /> | ||
51 | + <folding> | ||
52 | + <element signature="e#0#20#0" expanded="true" /> | ||
53 | + </folding> | ||
54 | + </state> | ||
55 | + </provider> | ||
56 | + </entry> | ||
57 | + </file> | ||
58 | + <file leaf-file-name="dialogs.py" pinned="false" current-in-tab="false"> | ||
59 | + <entry file="file://$PROJECT_DIR$/gui/dialogs.py"> | ||
60 | + <provider selected="true" editor-type-id="text-editor"> | ||
61 | + <state vertical-scroll-proportion="0.0" vertical-offset="10846" max-vertical-offset="45050"> | ||
62 | + <caret line="663" column="54" selection-start-line="663" selection-start-column="54" selection-end-line="663" selection-end-column="54" /> | ||
63 | + <folding> | ||
64 | + <element signature="e#1053#1062#0" expanded="true" /> | ||
40 | </folding> | 65 | </folding> |
41 | </state> | 66 | </state> |
42 | </provider> | 67 | </provider> |
@@ -45,8 +70,8 @@ | @@ -45,8 +70,8 @@ | ||
45 | <file leaf-file-name="task_navigator.py" pinned="false" current-in-tab="false"> | 70 | <file leaf-file-name="task_navigator.py" pinned="false" current-in-tab="false"> |
46 | <entry file="file://$PROJECT_DIR$/gui/task_navigator.py"> | 71 | <entry file="file://$PROJECT_DIR$/gui/task_navigator.py"> |
47 | <provider selected="true" editor-type-id="text-editor"> | 72 | <provider selected="true" editor-type-id="text-editor"> |
48 | - <state vertical-scroll-proportion="0.0" vertical-offset="7890" max-vertical-offset="14637"> | ||
49 | - <caret line="494" column="28" selection-start-line="494" selection-start-column="28" selection-end-line="494" selection-end-column="28" /> | 73 | + <state vertical-scroll-proportion="0.0" vertical-offset="6768" max-vertical-offset="14671"> |
74 | + <caret line="495" column="43" selection-start-line="495" selection-start-column="43" selection-end-line="495" selection-end-column="43" /> | ||
50 | <folding /> | 75 | <folding /> |
51 | </state> | 76 | </state> |
52 | </provider> | 77 | </provider> |
@@ -55,7 +80,7 @@ | @@ -55,7 +80,7 @@ | ||
55 | <file leaf-file-name="constants.py" pinned="false" current-in-tab="false"> | 80 | <file leaf-file-name="constants.py" pinned="false" current-in-tab="false"> |
56 | <entry file="file://$PROJECT_DIR$/constants.py"> | 81 | <entry file="file://$PROJECT_DIR$/constants.py"> |
57 | <provider selected="true" editor-type-id="text-editor"> | 82 | <provider selected="true" editor-type-id="text-editor"> |
58 | - <state vertical-scroll-proportion="0.0" vertical-offset="9462" max-vertical-offset="10064"> | 83 | + <state vertical-scroll-proportion="0.0" vertical-offset="9309" max-vertical-offset="10064"> |
59 | <caret line="576" column="10" selection-start-line="576" selection-start-column="10" selection-end-line="576" selection-end-column="10" /> | 84 | <caret line="576" column="10" selection-start-line="576" selection-start-column="10" selection-end-line="576" selection-end-column="10" /> |
60 | <folding /> | 85 | <folding /> |
61 | </state> | 86 | </state> |
@@ -117,29 +142,6 @@ | @@ -117,29 +142,6 @@ | ||
117 | </provider> | 142 | </provider> |
118 | </entry> | 143 | </entry> |
119 | </file> | 144 | </file> |
120 | - <file leaf-file-name="corregistration.py" pinned="false" current-in-tab="false"> | ||
121 | - <entry file="file://$PROJECT_DIR$/data/corregistration.py"> | ||
122 | - <provider selected="true" editor-type-id="text-editor"> | ||
123 | - <state vertical-scroll-proportion="0.0" vertical-offset="68" max-vertical-offset="1071"> | ||
124 | - <caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="9" /> | ||
125 | - <folding /> | ||
126 | - </state> | ||
127 | - </provider> | ||
128 | - </entry> | ||
129 | - </file> | ||
130 | - <file leaf-file-name="viewer_slice.py" pinned="false" current-in-tab="false"> | ||
131 | - <entry file="file://$PROJECT_DIR$/data/viewer_slice.py"> | ||
132 | - <provider selected="true" editor-type-id="text-editor"> | ||
133 | - <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> | ||
134 | - <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> | ||
135 | - <folding> | ||
136 | - <element signature="e#1054#1070#0" expanded="true" /> | ||
137 | - <marker date="1425490600613" expanded="true" signature="46428:46559" placeholder=""""..."""" /> | ||
138 | - </folding> | ||
139 | - </state> | ||
140 | - </provider> | ||
141 | - </entry> | ||
142 | - </file> | ||
143 | </leaf> | 145 | </leaf> |
144 | </component> | 146 | </component> |
145 | <component name="Git.Settings"> | 147 | <component name="Git.Settings"> |
@@ -150,9 +152,11 @@ | @@ -150,9 +152,11 @@ | ||
150 | <list> | 152 | <list> |
151 | <option value="$PROJECT_DIR$/data/bases.py" /> | 153 | <option value="$PROJECT_DIR$/data/bases.py" /> |
152 | <option value="$PROJECT_DIR$/data/co_registration.py" /> | 154 | <option value="$PROJECT_DIR$/data/co_registration.py" /> |
153 | - <option value="$PROJECT_DIR$/gui/task_navigator.py" /> | ||
154 | <option value="$PROJECT_DIR$/constants.py" /> | 155 | <option value="$PROJECT_DIR$/constants.py" /> |
156 | + <option value="$PROJECT_DIR$/gui/task_navigator.py" /> | ||
155 | <option value="$PROJECT_DIR$/data/coordinates.py" /> | 157 | <option value="$PROJECT_DIR$/data/coordinates.py" /> |
158 | + <option value="$PROJECT_DIR$/gui/dialogs.py" /> | ||
159 | + <option value="$PROJECT_DIR$/data/trackers.py" /> | ||
156 | </list> | 160 | </list> |
157 | </option> | 161 | </option> |
158 | </component> | 162 | </component> |
@@ -160,10 +164,8 @@ | @@ -160,10 +164,8 @@ | ||
160 | <detection-done>true</detection-done> | 164 | <detection-done>true</detection-done> |
161 | </component> | 165 | </component> |
162 | <component name="ProjectFrameBounds"> | 166 | <component name="ProjectFrameBounds"> |
163 | - <option name="x" value="-8" /> | ||
164 | - <option name="y" value="-8" /> | ||
165 | - <option name="width" value="1936" /> | ||
166 | - <option name="height" value="1056" /> | 167 | + <option name="width" value="960" /> |
168 | + <option name="height" value="1040" /> | ||
167 | </component> | 169 | </component> |
168 | <component name="ProjectLevelVcsManager" settingsEditedManually="true"> | 170 | <component name="ProjectLevelVcsManager" settingsEditedManually="true"> |
169 | <OptionsSetting value="true" id="Add" /> | 171 | <OptionsSetting value="true" id="Add" /> |
@@ -207,13 +209,27 @@ | @@ -207,13 +209,27 @@ | ||
207 | <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> | 209 | <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> |
208 | </PATH_ELEMENT> | 210 | </PATH_ELEMENT> |
209 | </PATH> | 211 | </PATH> |
212 | + <PATH> | ||
213 | + <PATH_ELEMENT> | ||
214 | + <option name="myItemId" value="invesalius" /> | ||
215 | + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> | ||
216 | + </PATH_ELEMENT> | ||
217 | + <PATH_ELEMENT> | ||
218 | + <option name="myItemId" value="invesalius" /> | ||
219 | + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> | ||
220 | + </PATH_ELEMENT> | ||
221 | + <PATH_ELEMENT> | ||
222 | + <option name="myItemId" value="gui" /> | ||
223 | + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> | ||
224 | + </PATH_ELEMENT> | ||
225 | + </PATH> | ||
210 | </subPane> | 226 | </subPane> |
211 | </pane> | 227 | </pane> |
212 | </panes> | 228 | </panes> |
213 | </component> | 229 | </component> |
214 | <component name="PropertiesComponent"> | 230 | <component name="PropertiesComponent"> |
215 | <property name="WebServerToolWindowFactoryState" value="false" /> | 231 | <property name="WebServerToolWindowFactoryState" value="false" /> |
216 | - <property name="options.lastSelected" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" /> | 232 | + <property name="options.lastSelected" value="preferences.keymap" /> |
217 | <property name="options.splitter.main.proportions" value="0.3" /> | 233 | <property name="options.splitter.main.proportions" value="0.3" /> |
218 | <property name="options.splitter.details.proportions" value="0.2" /> | 234 | <property name="options.splitter.details.proportions" value="0.2" /> |
219 | <property name="FullScreen" value="false" /> | 235 | <property name="FullScreen" value="false" /> |
@@ -449,19 +465,19 @@ | @@ -449,19 +465,19 @@ | ||
449 | </todo-panel> | 465 | </todo-panel> |
450 | </component> | 466 | </component> |
451 | <component name="ToolWindowManager"> | 467 | <component name="ToolWindowManager"> |
452 | - <frame x="-8" y="-8" width="1936" height="1056" extended-state="7" /> | 468 | + <frame x="0" y="0" width="960" height="1040" extended-state="0" /> |
453 | <editor active="false" /> | 469 | <editor active="false" /> |
454 | <layout> | 470 | <layout> |
455 | <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33553356" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | 471 | <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33553356" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |
456 | - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.1359275" sideWeight="0.49945945" order="0" side_tool="false" content_ui="combo" /> | 472 | + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2822222" sideWeight="0.49945945" order="0" side_tool="false" content_ui="combo" /> |
457 | <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20352036" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> | 473 | <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20352036" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> |
458 | <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> | 474 | <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> |
459 | <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | 475 | <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |
460 | <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> | 476 | <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> |
461 | - <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2882288" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | 477 | + <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.29262927" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |
462 | <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | 478 | <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |
463 | <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> | 479 | <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> |
464 | - <window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32864866" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | 480 | + <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3278328" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |
465 | <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25586355" sideWeight="0.50054055" order="2" side_tool="true" content_ui="tabs" /> | 481 | <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25586355" sideWeight="0.50054055" order="2" side_tool="true" content_ui="tabs" /> |
466 | <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> | 482 | <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> |
467 | <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> | 483 | <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> |
@@ -498,8 +514,18 @@ | @@ -498,8 +514,18 @@ | ||
498 | <line>19</line> | 514 | <line>19</line> |
499 | <option name="timeStamp" value="1" /> | 515 | <option name="timeStamp" value="1" /> |
500 | </line-breakpoint> | 516 | </line-breakpoint> |
517 | + <line-breakpoint enabled="true" type="python-line"> | ||
518 | + <url>file://$PROJECT_DIR$/data/coordinates.py</url> | ||
519 | + <line>253</line> | ||
520 | + <option name="timeStamp" value="2" /> | ||
521 | + </line-breakpoint> | ||
522 | + <line-breakpoint enabled="true" type="python-line"> | ||
523 | + <url>file://$PROJECT_DIR$/data/coordinates.py</url> | ||
524 | + <line>85</line> | ||
525 | + <option name="timeStamp" value="3" /> | ||
526 | + </line-breakpoint> | ||
501 | </breakpoints> | 527 | </breakpoints> |
502 | - <option name="time" value="2" /> | 528 | + <option name="time" value="4" /> |
503 | </breakpoint-manager> | 529 | </breakpoint-manager> |
504 | <watches-manager /> | 530 | <watches-manager /> |
505 | </component> | 531 | </component> |
@@ -509,7 +535,8 @@ | @@ -509,7 +535,8 @@ | ||
509 | <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="5423"> | 535 | <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="5423"> |
510 | <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | 536 | <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> |
511 | <folding> | 537 | <folding> |
512 | - <element signature="e#0#10#0" expanded="true" /> | 538 | + <element signature="e#2#20#0" expanded="true" /> |
539 | + <element signature="e#7877#9444#0" expanded="false" /> | ||
513 | </folding> | 540 | </folding> |
514 | </state> | 541 | </state> |
515 | </provider> | 542 | </provider> |
@@ -588,8 +615,8 @@ | @@ -588,8 +615,8 @@ | ||
588 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> | 615 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> |
589 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> | 616 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> |
590 | <folding> | 617 | <folding> |
591 | - <element signature="e#1054#1070#0" expanded="true" /> | ||
592 | - <marker date="1425490600613" expanded="true" signature="46428:46559" placeholder=""""..."""" /> | 618 | + <element signature="e#1054#1070#0" expanded="false" /> |
619 | + <marker date="1425490600613" expanded="true" signature="-1:-1" placeholder=""""..."""" /> | ||
593 | </folding> | 620 | </folding> |
594 | </state> | 621 | </state> |
595 | </provider> | 622 | </provider> |
@@ -599,7 +626,8 @@ | @@ -599,7 +626,8 @@ | ||
599 | <state vertical-scroll-proportion="0.0" vertical-offset="289" max-vertical-offset="4743"> | 626 | <state vertical-scroll-proportion="0.0" vertical-offset="289" max-vertical-offset="4743"> |
600 | <caret line="17" column="12" selection-start-line="17" selection-start-column="12" selection-end-line="17" selection-end-column="12" /> | 627 | <caret line="17" column="12" selection-start-line="17" selection-start-column="12" selection-end-line="17" selection-end-column="12" /> |
601 | <folding> | 628 | <folding> |
602 | - <element signature="e#0#10#0" expanded="true" /> | 629 | + <element signature="e#2#20#0" expanded="true" /> |
630 | + <element signature="e#7877#9444#0" expanded="false" /> | ||
603 | </folding> | 631 | </folding> |
604 | </state> | 632 | </state> |
605 | </provider> | 633 | </provider> |
@@ -644,8 +672,8 @@ | @@ -644,8 +672,8 @@ | ||
644 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> | 672 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> |
645 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> | 673 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> |
646 | <folding> | 674 | <folding> |
647 | - <element signature="e#1054#1070#0" expanded="true" /> | ||
648 | - <marker date="1425490600613" expanded="true" signature="46428:46559" placeholder=""""..."""" /> | 675 | + <element signature="e#1054#1070#0" expanded="false" /> |
676 | + <marker date="1425490600613" expanded="true" signature="-1:-1" placeholder=""""..."""" /> | ||
649 | </folding> | 677 | </folding> |
650 | </state> | 678 | </state> |
651 | </provider> | 679 | </provider> |
@@ -655,7 +683,8 @@ | @@ -655,7 +683,8 @@ | ||
655 | <state vertical-scroll-proportion="0.0" vertical-offset="289" max-vertical-offset="4743"> | 683 | <state vertical-scroll-proportion="0.0" vertical-offset="289" max-vertical-offset="4743"> |
656 | <caret line="17" column="12" selection-start-line="17" selection-start-column="12" selection-end-line="17" selection-end-column="12" /> | 684 | <caret line="17" column="12" selection-start-line="17" selection-start-column="12" selection-end-line="17" selection-end-column="12" /> |
657 | <folding> | 685 | <folding> |
658 | - <element signature="e#0#10#0" expanded="true" /> | 686 | + <element signature="e#2#20#0" expanded="true" /> |
687 | + <element signature="e#7877#9444#0" expanded="false" /> | ||
659 | </folding> | 688 | </folding> |
660 | </state> | 689 | </state> |
661 | </provider> | 690 | </provider> |
@@ -689,8 +718,8 @@ | @@ -689,8 +718,8 @@ | ||
689 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> | 718 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> |
690 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> | 719 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> |
691 | <folding> | 720 | <folding> |
692 | - <element signature="e#1054#1070#0" expanded="true" /> | ||
693 | - <marker date="1425490600613" expanded="true" signature="46428:46559" placeholder=""""..."""" /> | 721 | + <element signature="e#1054#1070#0" expanded="false" /> |
722 | + <marker date="1425490600613" expanded="true" signature="-1:-1" placeholder=""""..."""" /> | ||
694 | </folding> | 723 | </folding> |
695 | </state> | 724 | </state> |
696 | </provider> | 725 | </provider> |
@@ -700,7 +729,8 @@ | @@ -700,7 +729,8 @@ | ||
700 | <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="4743"> | 729 | <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="4743"> |
701 | <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | 730 | <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> |
702 | <folding> | 731 | <folding> |
703 | - <element signature="e#0#10#0" expanded="true" /> | 732 | + <element signature="e#2#20#0" expanded="true" /> |
733 | + <element signature="e#7877#9444#0" expanded="false" /> | ||
704 | </folding> | 734 | </folding> |
705 | </state> | 735 | </state> |
706 | </provider> | 736 | </provider> |
@@ -718,8 +748,8 @@ | @@ -718,8 +748,8 @@ | ||
718 | <state vertical-scroll-proportion="0.0" vertical-offset="149" max-vertical-offset="22423"> | 748 | <state vertical-scroll-proportion="0.0" vertical-offset="149" max-vertical-offset="22423"> |
719 | <caret line="31" column="9" selection-start-line="34" selection-start-column="0" selection-end-line="37" selection-end-column="37" /> | 749 | <caret line="31" column="9" selection-start-line="34" selection-start-column="0" selection-end-line="37" selection-end-column="37" /> |
720 | <folding> | 750 | <folding> |
721 | - <element signature="e#1054#1070#0" expanded="true" /> | ||
722 | - <marker date="1425490600613" expanded="true" signature="46428:46559" placeholder=""""..."""" /> | 751 | + <element signature="e#1054#1070#0" expanded="false" /> |
752 | + <marker date="1425490600613" expanded="true" signature="-1:-1" placeholder=""""..."""" /> | ||
723 | </folding> | 753 | </folding> |
724 | </state> | 754 | </state> |
725 | </provider> | 755 | </provider> |
@@ -729,7 +759,8 @@ | @@ -729,7 +759,8 @@ | ||
729 | <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="4743"> | 759 | <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="4743"> |
730 | <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | 760 | <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> |
731 | <folding> | 761 | <folding> |
732 | - <element signature="e#0#10#0" expanded="true" /> | 762 | + <element signature="e#2#20#0" expanded="true" /> |
763 | + <element signature="e#7877#9444#0" expanded="false" /> | ||
733 | </folding> | 764 | </folding> |
734 | </state> | 765 | </state> |
735 | </provider> | 766 | </provider> |
@@ -747,8 +778,8 @@ | @@ -747,8 +778,8 @@ | ||
747 | <state vertical-scroll-proportion="0.0" vertical-offset="251" max-vertical-offset="23817"> | 778 | <state vertical-scroll-proportion="0.0" vertical-offset="251" max-vertical-offset="23817"> |
748 | <caret line="37" column="37" selection-start-line="34" selection-start-column="0" selection-end-line="37" selection-end-column="37" /> | 779 | <caret line="37" column="37" selection-start-line="34" selection-start-column="0" selection-end-line="37" selection-end-column="37" /> |
749 | <folding> | 780 | <folding> |
750 | - <element signature="e#1054#1070#0" expanded="true" /> | ||
751 | - <marker date="1425490600613" expanded="true" signature="46428:46559" placeholder=""""..."""" /> | 781 | + <element signature="e#1054#1070#0" expanded="false" /> |
782 | + <marker date="1425490600613" expanded="true" signature="-1:-1" placeholder=""""..."""" /> | ||
752 | </folding> | 783 | </folding> |
753 | </state> | 784 | </state> |
754 | </provider> | 785 | </provider> |
@@ -794,8 +825,8 @@ | @@ -794,8 +825,8 @@ | ||
794 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> | 825 | <state vertical-scroll-proportion="0.0" vertical-offset="11012" max-vertical-offset="22423"> |
795 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> | 826 | <caret line="676" column="27" selection-start-line="676" selection-start-column="27" selection-end-line="676" selection-end-column="27" /> |
796 | <folding> | 827 | <folding> |
797 | - <element signature="e#1054#1070#0" expanded="true" /> | ||
798 | - <marker date="1425490600613" expanded="true" signature="46428:46559" placeholder=""""..."""" /> | 828 | + <element signature="e#1054#1070#0" expanded="false" /> |
829 | + <marker date="1425490600613" expanded="true" signature="-1:-1" placeholder=""""..."""" /> | ||
799 | </folding> | 830 | </folding> |
800 | </state> | 831 | </state> |
801 | </provider> | 832 | </provider> |
@@ -854,8 +885,8 @@ | @@ -854,8 +885,8 @@ | ||
854 | </entry> | 885 | </entry> |
855 | <entry file="file://$PROJECT_DIR$/gui/task_navigator.py"> | 886 | <entry file="file://$PROJECT_DIR$/gui/task_navigator.py"> |
856 | <provider selected="true" editor-type-id="text-editor"> | 887 | <provider selected="true" editor-type-id="text-editor"> |
857 | - <state vertical-scroll-proportion="0.0" vertical-offset="7890" max-vertical-offset="14637"> | ||
858 | - <caret line="494" column="28" selection-start-line="494" selection-start-column="28" selection-end-line="494" selection-end-column="28" /> | 888 | + <state vertical-scroll-proportion="0.0" vertical-offset="7839" max-vertical-offset="14671"> |
889 | + <caret line="495" column="43" selection-start-line="495" selection-start-column="43" selection-end-line="495" selection-end-column="43" /> | ||
859 | <folding /> | 890 | <folding /> |
860 | </state> | 891 | </state> |
861 | </provider> | 892 | </provider> |
@@ -870,10 +901,31 @@ | @@ -870,10 +901,31 @@ | ||
870 | </entry> | 901 | </entry> |
871 | <entry file="file://$PROJECT_DIR$/data/coordinates.py"> | 902 | <entry file="file://$PROJECT_DIR$/data/coordinates.py"> |
872 | <provider selected="true" editor-type-id="text-editor"> | 903 | <provider selected="true" editor-type-id="text-editor"> |
873 | - <state vertical-scroll-proportion="0.0" vertical-offset="612" max-vertical-offset="5423"> | ||
874 | - <caret line="36" column="28" selection-start-line="36" selection-start-column="28" selection-end-line="36" selection-end-column="28" /> | 904 | + <state vertical-scroll-proportion="0.0" vertical-offset="102" max-vertical-offset="4964"> |
905 | + <caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" /> | ||
906 | + <folding> | ||
907 | + <element signature="e#2#20#0" expanded="true" /> | ||
908 | + <element signature="e#7877#9444#0" expanded="false" /> | ||
909 | + </folding> | ||
910 | + </state> | ||
911 | + </provider> | ||
912 | + </entry> | ||
913 | + <entry file="file://$PROJECT_DIR$/gui/dialogs.py"> | ||
914 | + <provider selected="true" editor-type-id="text-editor"> | ||
915 | + <state vertical-scroll-proportion="0.0" vertical-offset="10846" max-vertical-offset="45050"> | ||
916 | + <caret line="663" column="54" selection-start-line="663" selection-start-column="54" selection-end-line="663" selection-end-column="54" /> | ||
917 | + <folding> | ||
918 | + <element signature="e#1053#1062#0" expanded="true" /> | ||
919 | + </folding> | ||
920 | + </state> | ||
921 | + </provider> | ||
922 | + </entry> | ||
923 | + <entry file="file://$PROJECT_DIR$/data/trackers.py"> | ||
924 | + <provider selected="true" editor-type-id="text-editor"> | ||
925 | + <state vertical-scroll-proportion="0.18106312" vertical-offset="894" max-vertical-offset="3128"> | ||
926 | + <caret line="59" column="24" selection-start-line="59" selection-start-column="24" selection-end-line="59" selection-end-column="24" /> | ||
875 | <folding> | 927 | <folding> |
876 | - <element signature="e#0#10#0" expanded="true" /> | 928 | + <element signature="e#0#20#0" expanded="true" /> |
877 | </folding> | 929 | </folding> |
878 | </state> | 930 | </state> |
879 | </provider> | 931 | </provider> |
invesalius/data/coordinates.py
1 | -import sys | ||
2 | 1 | ||
3 | -import serial | ||
4 | -import usb.core | ||
5 | -import usb.util | ||
6 | -import wx | 2 | + |
7 | import numpy as np | 3 | import numpy as np |
8 | from wx.lib.pubsub import pub as Publisher | 4 | from wx.lib.pubsub import pub as Publisher |
9 | 5 | ||
10 | import gui.dialogs as dlg | 6 | import gui.dialogs as dlg |
11 | 7 | ||
12 | -try: | ||
13 | - import ClaronTracker as mct | ||
14 | -except ImportError: | ||
15 | - print 'The ClaronTracker library is not installed' | ||
16 | - | ||
17 | 8 | ||
18 | class Tracker: | 9 | class Tracker: |
19 | def __init__(self, trck_id): | 10 | def __init__(self, trck_id): |
20 | 11 | ||
21 | - self.trck_init = None | ||
22 | - print "This is the tracker selected!" | 12 | + trck = {0 : self.ClaronTracker, |
13 | + 1 : self.PlhFastrak, | ||
14 | + 2 : self.PlhIsotrakII, | ||
15 | + 3 : self.PlhPatriot, | ||
16 | + 4 : self.ZebrisCMS20} | ||
23 | 17 | ||
24 | - if trck_id == 0: | ||
25 | - trck_init = self.ClaronTracker() | ||
26 | - elif trck_id == 1: | ||
27 | - trck_init = self.PlhFastrak() | ||
28 | - elif trck_id == 2: | ||
29 | - trck_init = self.PlhIsotrakII() | ||
30 | - elif trck_id == 3: | ||
31 | - trck_init = self.PlhPatriot() | ||
32 | - elif trck_id == 4: | ||
33 | - trck_init = self.ZebrisCMS20() | ||
34 | - | ||
35 | - self.trck_init = trck_init | 18 | + self.ReturnTracker(trck, trck_id) |
36 | 19 | ||
37 | def ClaronTracker(self): | 20 | def ClaronTracker(self): |
38 | - print "CLARON" | 21 | + try: |
22 | + import ClaronTracker as mct | ||
23 | + except ImportError: | ||
24 | + print 'The ClaronTracker library is not installed' | ||
25 | + | ||
26 | + print "CLARON func" | ||
39 | return 0 | 27 | return 0 |
40 | 28 | ||
41 | def PlhFastrak(self): | 29 | def PlhFastrak(self): |
42 | - print "FASTRAK" | 30 | + import serial |
31 | + print "FASTRAK func" | ||
43 | return 1 | 32 | return 1 |
44 | 33 | ||
45 | def PlhIsotrakII(self): | 34 | def PlhIsotrakII(self): |
46 | - print "ISOTRAKII" | 35 | + import serial |
36 | + print "ISOTRAKII func" | ||
47 | return 2 | 37 | return 2 |
48 | 38 | ||
49 | def PlhPatriot(self): | 39 | def PlhPatriot(self): |
50 | - print "PATRIOT" | 40 | + import sys |
41 | + | ||
42 | + import serial | ||
43 | + import usb.core | ||
44 | + import usb.util | ||
45 | + | ||
46 | + print "PATRIOT func" | ||
51 | return 3 | 47 | return 3 |
52 | 48 | ||
53 | def ZebrisCMS20(self): | 49 | def ZebrisCMS20(self): |
54 | - print "ZEBRIS" | 50 | + print "ZEBRIS func" |
55 | return 4 | 51 | return 4 |
56 | 52 | ||
53 | + def ReturnTracker(self, trck, trck_id): | ||
54 | + print "Returning" | ||
55 | + print "This is the tracker selected!", trck_id | ||
56 | + return trck[trck_id]() | ||
57 | + | ||
57 | 58 | ||
58 | class Coordinates: | 59 | class Coordinates: |
59 | def __init__(self, trck_init, trck, ref_mode): | 60 | def __init__(self, trck_init, trck, ref_mode): |
@@ -83,7 +84,7 @@ class Coordinates: | @@ -83,7 +84,7 @@ class Coordinates: | ||
83 | 84 | ||
84 | 85 | ||
85 | def __update_status_MTC(self, pubsub_evt): | 86 | def __update_status_MTC(self, pubsub_evt): |
86 | - self.MTC_status = pubsub_evt.data | 87 | + self.MTC_status = pubsub_evt.data |
87 | 88 | ||
88 | def __update_points_MTC(self, pubsub_evt): | 89 | def __update_points_MTC(self, pubsub_evt): |
89 | self.coordTT = pubsub_evt.data | 90 | self.coordTT = pubsub_evt.data |
invesalius/data/trackers.py
@@ -6,6 +6,128 @@ import sys | @@ -6,6 +6,128 @@ import sys | ||
6 | import gui.dialogs as dlg | 6 | import gui.dialogs as dlg |
7 | 7 | ||
8 | 8 | ||
9 | +class Tracker: | ||
10 | + def __init__(self, trck_id): | ||
11 | + """Initialize spatial trackers for neuronavigation | ||
12 | + | ||
13 | + :param trck_id: identifier of spatial tracker | ||
14 | + :return: initialization variable | ||
15 | + """ | ||
16 | + | ||
17 | + trck = {0 : self.ClaronTracker, | ||
18 | + 1 : self.PlhFastrak, | ||
19 | + 2 : self.PlhIsotrakII, | ||
20 | + 3 : self.PlhPatriot, | ||
21 | + 4 : self.ZebrisCMS20} | ||
22 | + | ||
23 | + self.ReturnTracker(trck, trck_id) | ||
24 | + | ||
25 | + def ClaronTracker(self): | ||
26 | + trck_init = None | ||
27 | + | ||
28 | + try: | ||
29 | + import ClaronTracker | ||
30 | + | ||
31 | + trck_init = ClaronTracker.ClaronTracker() | ||
32 | + trck_init.CalibrationDir = "C:\CalibrationFiles" | ||
33 | + trck_init.MarkerDir = "C:\Markers" | ||
34 | + trck_init.NumberFramesProcessed = 10 | ||
35 | + trck_init.FramesExtrapolated = 0 | ||
36 | + trck_init.Initialize() | ||
37 | + | ||
38 | + if trck_init.GetIdentifyingCamera(): | ||
39 | + print "MicronTracker camera identified." | ||
40 | + trck_init.Run() | ||
41 | + else: | ||
42 | + dlg.TrackerNotConnected(0) | ||
43 | + | ||
44 | + except ImportError: | ||
45 | + dlg.TrackerNotConnected(5) | ||
46 | + | ||
47 | + return trck_init | ||
48 | + | ||
49 | + def PlhFastrak(self): | ||
50 | + trck_init = self.polhemus_serial(1) | ||
51 | + | ||
52 | + return trck_init | ||
53 | + | ||
54 | + def PlhIsotrakII(self): | ||
55 | + trck_init = self.polhemus_serial(2) | ||
56 | + | ||
57 | + return trck_init | ||
58 | + | ||
59 | + def PlhPatriot(self): | ||
60 | + trck_init = None | ||
61 | + | ||
62 | + try: | ||
63 | + import sys | ||
64 | + | ||
65 | + import usb.core as uc | ||
66 | + # import usb.util as uu | ||
67 | + | ||
68 | + trck_init = uc.find(idVendor=0x0F44, idProduct=0xEF12) | ||
69 | + | ||
70 | + if not trck_init: | ||
71 | + print 'Could not find Polhemus PATRIOT USB. Trying Polhemus ' \ | ||
72 | + 'serial connection...' | ||
73 | + | ||
74 | + trck_init = self.polhemus_serial(3) | ||
75 | + | ||
76 | + else: | ||
77 | + try: | ||
78 | + cfg = trck_init.get_active_configuration() | ||
79 | + for i in cfg: | ||
80 | + for x in i: | ||
81 | + # TODO: try better code | ||
82 | + x = x | ||
83 | + trck_init.set_configuration() | ||
84 | + | ||
85 | + except uc.USBError as err: | ||
86 | + dlg.TrackerNotConnected(3) | ||
87 | + print 'Could not set configuration %s' % err | ||
88 | + | ||
89 | + except ImportError: | ||
90 | + print 'Import Error for Polhemus PATRIOT USB.' | ||
91 | + trck_init = self.polhemus_serial(3) | ||
92 | + | ||
93 | + return trck_init | ||
94 | + | ||
95 | + def ZebrisCMS20(self): | ||
96 | + | ||
97 | + dlg.TrackerNotConnected(4) | ||
98 | + print 'Zebris device not found.' | ||
99 | + | ||
100 | + return None | ||
101 | + | ||
102 | + def polhemus_serial(self, plh_id): | ||
103 | + trck_init = None | ||
104 | + | ||
105 | + try: | ||
106 | + import serial | ||
107 | + | ||
108 | + try: | ||
109 | + trck_init = serial.Serial(0, baudrate=115200, timeout=0.2) | ||
110 | + trck_init.write('P') | ||
111 | + data = trck_init.readlines() | ||
112 | + | ||
113 | + if not data: | ||
114 | + dlg.TrackerNotConnected(plh_id) | ||
115 | + | ||
116 | + except serial.SerialException: | ||
117 | + dlg.TrackerNotConnected(6) | ||
118 | + | ||
119 | + except ImportError: | ||
120 | + dlg.TrackerNotConnected(5) | ||
121 | + | ||
122 | + return trck_init | ||
123 | + | ||
124 | + def ReturnTracker(self, trck, trck_id): | ||
125 | + | ||
126 | + print "Returning" | ||
127 | + print "This is the tracker selected!", trck_id | ||
128 | + | ||
129 | + return trck[trck_id]() | ||
130 | + | ||
9 | class Tracker_Init: | 131 | class Tracker_Init: |
10 | def PolhemusISO_init(self): | 132 | def PolhemusISO_init(self): |
11 | try: | 133 | try: |
@@ -14,7 +136,7 @@ class Tracker_Init: | @@ -14,7 +136,7 @@ class Tracker_Init: | ||
14 | 136 | ||
15 | except: | 137 | except: |
16 | dlg.TrackerNotConnected(1) | 138 | dlg.TrackerNotConnected(1) |
17 | - raise ValueError('Device not found') | 139 | + raise ValueError('Device not found') |
18 | 140 | ||
19 | def Polhemus_init(self): | 141 | def Polhemus_init(self): |
20 | dev = usb.core.find(idVendor=0x0F44, idProduct=0xEF12) | 142 | dev = usb.core.find(idVendor=0x0F44, idProduct=0xEF12) |
invesalius/gui/dialogs.py
@@ -106,7 +106,7 @@ class ResizeImageDialog(wx.Dialog): | @@ -106,7 +106,7 @@ class ResizeImageDialog(wx.Dialog): | ||
106 | pos=wx.DefaultPosition, | 106 | pos=wx.DefaultPosition, |
107 | style=wx.DEFAULT_DIALOG_STYLE) | 107 | style=wx.DEFAULT_DIALOG_STYLE) |
108 | self.PostCreate(pre) | 108 | self.PostCreate(pre) |
109 | - | 109 | + |
110 | lbl_message = wx.StaticText(self, -1, _("InVesalius is running on a 32-bit operating system or has insufficient memory. \nIf you want to work with 3D surfaces or volume rendering, \nit is recommended to reduce the medical images resolution.")) | 110 | lbl_message = wx.StaticText(self, -1, _("InVesalius is running on a 32-bit operating system or has insufficient memory. \nIf you want to work with 3D surfaces or volume rendering, \nit is recommended to reduce the medical images resolution.")) |
111 | icon = wx.ArtProvider.GetBitmap(wx.ART_WARNING, wx.ART_MESSAGE_BOX, (32,32)) | 111 | icon = wx.ArtProvider.GetBitmap(wx.ART_WARNING, wx.ART_MESSAGE_BOX, (32,32)) |
112 | bmp = wx.StaticBitmap(self, -1, icon) | 112 | bmp = wx.StaticBitmap(self, -1, icon) |
@@ -145,7 +145,7 @@ class ResizeImageDialog(wx.Dialog): | @@ -145,7 +145,7 @@ class ResizeImageDialog(wx.Dialog): | ||
145 | sizer_general.Fit(self) | 145 | sizer_general.Fit(self) |
146 | self.Layout() | 146 | self.Layout() |
147 | self.Centre() | 147 | self.Centre() |
148 | - | 148 | + |
149 | def SetValue(self, value): | 149 | def SetValue(self, value): |
150 | self.num_ctrl_porcent.SetValue(value) | 150 | self.num_ctrl_porcent.SetValue(value) |
151 | 151 | ||
@@ -406,7 +406,7 @@ def ShowLoadMarkersDialog(): | @@ -406,7 +406,7 @@ def ShowLoadMarkersDialog(): | ||
406 | 406 | ||
407 | dlg = wx.FileDialog(None, message=_("Load markers"), | 407 | dlg = wx.FileDialog(None, message=_("Load markers"), |
408 | defaultDir="", | 408 | defaultDir="", |
409 | - defaultFile="", | 409 | + defaultFile="", |
410 | style=wx.OPEN|wx.CHANGE_DIR) | 410 | style=wx.OPEN|wx.CHANGE_DIR) |
411 | 411 | ||
412 | # inv3 filter is default | 412 | # inv3 filter is default |
@@ -632,7 +632,7 @@ def SurfaceSelectionRequiredForDuplication(): | @@ -632,7 +632,7 @@ def SurfaceSelectionRequiredForDuplication(): | ||
632 | wx.ICON_INFORMATION | wx.OK) | 632 | wx.ICON_INFORMATION | wx.OK) |
633 | dlg.ShowModal() | 633 | dlg.ShowModal() |
634 | dlg.Destroy() | 634 | dlg.Destroy() |
635 | - | 635 | + |
636 | #=========aji====================================================================== | 636 | #=========aji====================================================================== |
637 | def InvalidReferences(): | 637 | def InvalidReferences(): |
638 | msg = _("The references are not set.") | 638 | msg = _("The references are not set.") |
@@ -644,28 +644,35 @@ def InvalidReferences(): | @@ -644,28 +644,35 @@ def InvalidReferences(): | ||
644 | wx.ICON_INFORMATION | wx.OK) | 644 | wx.ICON_INFORMATION | wx.OK) |
645 | dlg.ShowModal() | 645 | dlg.ShowModal() |
646 | dlg.Destroy() | 646 | dlg.Destroy() |
647 | - | ||
648 | -#Dialog for advertising if the tracker is not connetcted | ||
649 | -def TrackerNotConnected(tracker): | ||
650 | - msg = None | ||
651 | - if tracker == 0: | ||
652 | - msg = _("The PolhemusISO selected is not connected.") | ||
653 | - elif tracker == 1: | ||
654 | - msg = _("The Polhemus selected is not connected.") | ||
655 | - elif tracker == 2: | ||
656 | - msg = _("The Claron MTC is not connected.") | ||
657 | - elif tracker == 3: | ||
658 | - msg = _("The Zebris is not connected.") | ||
659 | - | 647 | + |
648 | + | ||
649 | +def TrackerNotConnected(trck_id): | ||
650 | + """Spatial Tracker connection error | ||
651 | + | ||
652 | + """ | ||
653 | + trck = {0 : 'Claron MicronTracker', | ||
654 | + 1 : 'Polhemus FASTRAK', | ||
655 | + 2 : 'Polhemus ISOTRAK II', | ||
656 | + 3 : 'Polhemus PATRIOT', | ||
657 | + 4 : 'Zebris CMS20'} | ||
658 | + | ||
659 | + if trck_id < 5: | ||
660 | + msg = trck[trck_id] + ' is not connected.' | ||
661 | + elif trck_id == 5: | ||
662 | + msg = 'The library for specified tracker is not installed.' | ||
663 | + elif trck_id == 6: | ||
664 | + msg = 'The tracker connection is already set.' | ||
665 | + | ||
660 | if sys.platform == 'darwin': | 666 | if sys.platform == 'darwin': |
661 | dlg = wx.MessageDialog(None, "", msg, | 667 | dlg = wx.MessageDialog(None, "", msg, |
662 | wx.ICON_INFORMATION | wx.OK) | 668 | wx.ICON_INFORMATION | wx.OK) |
663 | else: | 669 | else: |
664 | dlg = wx.MessageDialog(None, msg, "InVesalius 3 - Neuronavigator", | 670 | dlg = wx.MessageDialog(None, msg, "InVesalius 3 - Neuronavigator", |
665 | wx.ICON_INFORMATION | wx.OK) | 671 | wx.ICON_INFORMATION | wx.OK) |
672 | + | ||
666 | dlg.ShowModal() | 673 | dlg.ShowModal() |
667 | dlg.Destroy() | 674 | dlg.Destroy() |
668 | - | 675 | + |
669 | def InvalidTxt(): | 676 | def InvalidTxt(): |
670 | msg = _("The TXT file is invalid.") | 677 | msg = _("The TXT file is invalid.") |
671 | if sys.platform == 'darwin': | 678 | if sys.platform == 'darwin': |
@@ -676,7 +683,7 @@ def InvalidTxt(): | @@ -676,7 +683,7 @@ def InvalidTxt(): | ||
676 | wx.ICON_INFORMATION | wx.OK) | 683 | wx.ICON_INFORMATION | wx.OK) |
677 | dlg.ShowModal() | 684 | dlg.ShowModal() |
678 | dlg.Destroy() | 685 | dlg.Destroy() |
679 | - | 686 | + |
680 | def error_correg_fine(): | 687 | def error_correg_fine(): |
681 | msg = _("There aren't any created surface.") | 688 | msg = _("There aren't any created surface.") |
682 | if sys.platform == 'darwin': | 689 | if sys.platform == 'darwin': |
@@ -686,9 +693,9 @@ def error_correg_fine(): | @@ -686,9 +693,9 @@ def error_correg_fine(): | ||
686 | dlg = wx.MessageDialog(None, msg, "InVesalius 3", | 693 | dlg = wx.MessageDialog(None, msg, "InVesalius 3", |
687 | wx.ICON_INFORMATION | wx.OK) | 694 | wx.ICON_INFORMATION | wx.OK) |
688 | dlg.ShowModal() | 695 | dlg.ShowModal() |
689 | - dlg.Destroy() | 696 | + dlg.Destroy() |
690 | #=============================================================================== | 697 | #=============================================================================== |
691 | - | 698 | + |
692 | class NewMask(wx.Dialog): | 699 | class NewMask(wx.Dialog): |
693 | def __init__(self, | 700 | def __init__(self, |
694 | parent=None, | 701 | parent=None, |
@@ -758,7 +765,7 @@ class NewMask(wx.Dialog): | @@ -758,7 +765,7 @@ class NewMask(wx.Dialog): | ||
758 | thresh_min, thresh_max = project.threshold_modes[_("Bone")] | 765 | thresh_min, thresh_max = project.threshold_modes[_("Bone")] |
759 | original_colour = random.choice(const.MASK_COLOUR) | 766 | original_colour = random.choice(const.MASK_COLOUR) |
760 | self.colour = original_colour | 767 | self.colour = original_colour |
761 | - colour = [255*i for i in original_colour] | 768 | + colour = [255*i for i in original_colour] |
762 | colour.append(100) | 769 | colour.append(100) |
763 | gradient = grad.GradientSlider(self, -1, int(bound_min), | 770 | gradient = grad.GradientSlider(self, -1, int(bound_min), |
764 | int(bound_max), | 771 | int(bound_max), |
@@ -820,7 +827,7 @@ class NewMask(wx.Dialog): | @@ -820,7 +827,7 @@ class NewMask(wx.Dialog): | ||
820 | proj = prj.Project() | 827 | proj = prj.Project() |
821 | if thresh in proj.threshold_modes.values(): | 828 | if thresh in proj.threshold_modes.values(): |
822 | preset_name = proj.threshold_modes.get_key(thresh)[0] | 829 | preset_name = proj.threshold_modes.get_key(thresh)[0] |
823 | - index = self.thresh_list.index(preset_name) | 830 | + index = self.thresh_list.index(preset_name) |
824 | self.combo_thresh.SetSelection(index) | 831 | self.combo_thresh.SetSelection(index) |
825 | else: | 832 | else: |
826 | index = self.thresh_list.index(_("Custom")) | 833 | index = self.thresh_list.index(_("Custom")) |
@@ -1134,14 +1141,14 @@ def ExportPicture(type_=""): | @@ -1134,14 +1141,14 @@ def ExportPicture(type_=""): | ||
1134 | return filename, filetype | 1141 | return filename, filetype |
1135 | else: | 1142 | else: |
1136 | return () | 1143 | return () |
1137 | - | 1144 | + |
1138 | #=======aji======================================================================== | 1145 | #=======aji======================================================================== |
1139 | #=============================================================================== | 1146 | #=============================================================================== |
1140 | class FineCalibration(wx.Window): | 1147 | class FineCalibration(wx.Window): |
1141 | def __init__(self, parent=None, ID=-1, title="Fine Calibration", size=wx.DefaultSize, | 1148 | def __init__(self, parent=None, ID=-1, title="Fine Calibration", size=wx.DefaultSize, |
1142 | pos=wx.DefaultPosition, | 1149 | pos=wx.DefaultPosition, |
1143 | useMetal=False): | 1150 | useMetal=False): |
1144 | - | 1151 | + |
1145 | self.correg = None | 1152 | self.correg = None |
1146 | self.staticballs = [] | 1153 | self.staticballs = [] |
1147 | self.ball_id = 0 | 1154 | self.ball_id = 0 |
@@ -1153,7 +1160,7 @@ class FineCalibration(wx.Window): | @@ -1153,7 +1160,7 @@ class FineCalibration(wx.Window): | ||
1153 | # initial parameters | 1160 | # initial parameters |
1154 | self.actor_head_init = None | 1161 | self.actor_head_init = None |
1155 | self.actor_cloud = None | 1162 | self.actor_cloud = None |
1156 | - | 1163 | + |
1157 | # actors parameters | 1164 | # actors parameters |
1158 | self.color_head_init = 1.0, 0.0, 0.0 | 1165 | self.color_head_init = 1.0, 0.0, 0.0 |
1159 | self.color_cloud = 0.0, 1.0, 0.0 | 1166 | self.color_cloud = 0.0, 1.0, 0.0 |
@@ -1162,7 +1169,7 @@ class FineCalibration(wx.Window): | @@ -1162,7 +1169,7 @@ class FineCalibration(wx.Window): | ||
1162 | self.opacity_cloud = 0.7 | 1169 | self.opacity_cloud = 0.7 |
1163 | self.opacity_head_icp = 1.0 | 1170 | self.opacity_head_icp = 1.0 |
1164 | ################ | 1171 | ################ |
1165 | - | 1172 | + |
1166 | # Instead of calling wx.Dialog.__init__ we precreate the dialog | 1173 | # Instead of calling wx.Dialog.__init__ we precreate the dialog |
1167 | # so we can set an extra style that must be set before | 1174 | # so we can set an extra style that must be set before |
1168 | # creation, and then we create the GUI object using the Create | 1175 | # creation, and then we create the GUI object using the Create |
@@ -1173,46 +1180,46 @@ class FineCalibration(wx.Window): | @@ -1173,46 +1180,46 @@ class FineCalibration(wx.Window): | ||
1173 | self.pre.SetBackgroundColour('LIGHT GRAY') | 1180 | self.pre.SetBackgroundColour('LIGHT GRAY') |
1174 | self.pre.CenterOnScreen() | 1181 | self.pre.CenterOnScreen() |
1175 | self.pre.Show() | 1182 | self.pre.Show() |
1176 | - | ||
1177 | - | 1183 | + |
1184 | + | ||
1178 | #pre.Create(parent, ID, title, pos, (500,300)) | 1185 | #pre.Create(parent, ID, title, pos, (500,300)) |
1179 | - | 1186 | + |
1180 | # This next step is the most important, it turns this Python | 1187 | # This next step is the most important, it turns this Python |
1181 | # object into the real wrapper of the dialog (instead of pre) | 1188 | # object into the real wrapper of the dialog (instead of pre) |
1182 | # as far as the wxPython extension is concerned. | 1189 | # as far as the wxPython extension is concerned. |
1183 | self.PostCreate(self.pre) | 1190 | self.PostCreate(self.pre) |
1184 | - | ||
1185 | - | ||
1186 | - | 1191 | + |
1192 | + | ||
1193 | + | ||
1187 | # This extra style can be set after the UI object has been created. | 1194 | # This extra style can be set after the UI object has been created. |
1188 | if 'wxMac' in wx.PlatformInfo and useMetal: | 1195 | if 'wxMac' in wx.PlatformInfo and useMetal: |
1189 | self.SetExtraStyle(wx.DIALOG_EX_METAL) | 1196 | self.SetExtraStyle(wx.DIALOG_EX_METAL) |
1190 | - | 1197 | + |
1191 | self.Center() | 1198 | self.Center() |
1192 | self.__bind_events() | 1199 | self.__bind_events() |
1193 | self.draw_gui() | 1200 | self.draw_gui() |
1194 | - | ||
1195 | - | 1201 | + |
1202 | + | ||
1196 | # try: | 1203 | # try: |
1197 | Publisher.sendMessage('Load surface into DLG') | 1204 | Publisher.sendMessage('Load surface into DLG') |
1198 | # except: | 1205 | # except: |
1199 | # try: | 1206 | # try: |
1200 | # Publisher.sendMessage('Load volume DLG') | 1207 | # Publisher.sendMessage('Load volume DLG') |
1201 | # except: | 1208 | # except: |
1202 | -# error_correg_fine() | ||
1203 | - | 1209 | +# error_correg_fine() |
1210 | + | ||
1204 | #self.LoadData() | 1211 | #self.LoadData() |
1205 | def ShowLoadSurfaceDialog(self): | 1212 | def ShowLoadSurfaceDialog(self): |
1206 | current_dir = os.path.abspath(".") | 1213 | current_dir = os.path.abspath(".") |
1207 | - | 1214 | + |
1208 | dlg = wx.FileDialog(None, message=_("Load surface"), | 1215 | dlg = wx.FileDialog(None, message=_("Load surface"), |
1209 | defaultDir="", | 1216 | defaultDir="", |
1210 | - defaultFile="", | 1217 | + defaultFile="", |
1211 | style=wx.OPEN|wx.CHANGE_DIR) | 1218 | style=wx.OPEN|wx.CHANGE_DIR) |
1212 | - | 1219 | + |
1213 | # inv3 filter is default | 1220 | # inv3 filter is default |
1214 | dlg.SetFilterIndex(0) | 1221 | dlg.SetFilterIndex(0) |
1215 | - | 1222 | + |
1216 | # Show the dialog and retrieve the user response. If it is the OK response, | 1223 | # Show the dialog and retrieve the user response. If it is the OK response, |
1217 | # process the data. | 1224 | # process the data. |
1218 | filepath = None | 1225 | filepath = None |
@@ -1222,21 +1229,21 @@ class FineCalibration(wx.Window): | @@ -1222,21 +1229,21 @@ class FineCalibration(wx.Window): | ||
1222 | filepath = dlg.GetPath() | 1229 | filepath = dlg.GetPath() |
1223 | except(wx._core.PyAssertionError): #FIX: win64 | 1230 | except(wx._core.PyAssertionError): #FIX: win64 |
1224 | filepath = dlg.GetPath() | 1231 | filepath = dlg.GetPath() |
1225 | - | 1232 | + |
1226 | # Destroy the dialog. Don't do this until you are done with it! | 1233 | # Destroy the dialog. Don't do this until you are done with it! |
1227 | # BAD things can happen otherwise! | 1234 | # BAD things can happen otherwise! |
1228 | dlg.Destroy() | 1235 | dlg.Destroy() |
1229 | os.chdir(current_dir) | 1236 | os.chdir(current_dir) |
1230 | return filepath | 1237 | return filepath |
1231 | - | 1238 | + |
1232 | def __bind_events(self): | 1239 | def __bind_events(self): |
1233 | Publisher.subscribe(self.LoadVolumeDLG, | 1240 | Publisher.subscribe(self.LoadVolumeDLG, |
1234 | 'Load Raycasting into DLG') | 1241 | 'Load Raycasting into DLG') |
1235 | Publisher.subscribe(self.LoadActorDLG, | 1242 | Publisher.subscribe(self.LoadActorDLG, |
1236 | 'Load surface actor into DLG') | 1243 | 'Load surface actor into DLG') |
1237 | # LINE 1: Janela | 1244 | # LINE 1: Janela |
1238 | - | ||
1239 | - def draw_gui(self): | 1245 | + |
1246 | + def draw_gui(self): | ||
1240 | #style = vtk.vtkInteractorStyleTrackballActor() | 1247 | #style = vtk.vtkInteractorStyleTrackballActor() |
1241 | self.panel=wx.Panel(self) | 1248 | self.panel=wx.Panel(self) |
1242 | self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) | 1249 | self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) |
@@ -1244,140 +1251,140 @@ class FineCalibration(wx.Window): | @@ -1244,140 +1251,140 @@ class FineCalibration(wx.Window): | ||
1244 | self.interactor.Enable(1) | 1251 | self.interactor.Enable(1) |
1245 | self.ren = vtk.vtkRenderer() | 1252 | self.ren = vtk.vtkRenderer() |
1246 | self.interactor.GetRenderWindow().AddRenderer(self.ren) | 1253 | self.interactor.GetRenderWindow().AddRenderer(self.ren) |
1247 | - | 1254 | + |
1248 | # LINE 2: Botoes | 1255 | # LINE 2: Botoes |
1249 | - | 1256 | + |
1250 | marker = wx.Button(self.panel, -1, "Create Marker",size = wx.Size(85,23)) | 1257 | marker = wx.Button(self.panel, -1, "Create Marker",size = wx.Size(85,23)) |
1251 | marker.Bind(wx.EVT_BUTTON, self.OnCalibrationMarkers) | 1258 | marker.Bind(wx.EVT_BUTTON, self.OnCalibrationMarkers) |
1252 | - | 1259 | + |
1253 | marker_load = wx.Button(self.panel, -1, "Load Marker",size = wx.Size(85,23)) | 1260 | marker_load = wx.Button(self.panel, -1, "Load Marker",size = wx.Size(85,23)) |
1254 | marker_load.Bind(wx.EVT_BUTTON, self.OnLoadMarkers) | 1261 | marker_load.Bind(wx.EVT_BUTTON, self.OnLoadMarkers) |
1255 | - | 1262 | + |
1256 | apply_ICP = wx.Button(self.panel, -1, "Apply ICP",size = wx.Size(85,23)) | 1263 | apply_ICP = wx.Button(self.panel, -1, "Apply ICP",size = wx.Size(85,23)) |
1257 | apply_ICP.Bind(wx.EVT_BUTTON, self.OnApplyICP) | 1264 | apply_ICP.Bind(wx.EVT_BUTTON, self.OnApplyICP) |
1258 | - | 1265 | + |
1259 | self.showObjICP = wx.CheckBox(self.panel, -1, 'Show ICP Surface', (100, 10)) | 1266 | self.showObjICP = wx.CheckBox(self.panel, -1, 'Show ICP Surface', (100, 10)) |
1260 | self.showObjICP.SetValue(False) | 1267 | self.showObjICP.SetValue(False) |
1261 | - wx.EVT_CHECKBOX(self, self.showObjICP.GetId(), self.ShowObjectICP) | ||
1262 | - | 1268 | + wx.EVT_CHECKBOX(self, self.showObjICP.GetId(), self.ShowObjectICP) |
1269 | + | ||
1263 | self.showObjCloud = wx.CheckBox(self.panel, -1, 'Show Cloud of Points', (100, 10)) | 1270 | self.showObjCloud = wx.CheckBox(self.panel, -1, 'Show Cloud of Points', (100, 10)) |
1264 | self.showObjCloud.SetValue(True) | 1271 | self.showObjCloud.SetValue(True) |
1265 | - wx.EVT_CHECKBOX(self, self.showObjCloud.GetId(), self.ShowObjectCloud) | ||
1266 | - | 1272 | + wx.EVT_CHECKBOX(self, self.showObjCloud.GetId(), self.ShowObjectCloud) |
1273 | + | ||
1267 | self.showObjHead = wx.CheckBox(self.panel, -1, 'Show Head Surface', (100, 10)) | 1274 | self.showObjHead = wx.CheckBox(self.panel, -1, 'Show Head Surface', (100, 10)) |
1268 | self.showObjHead.SetValue(True) | 1275 | self.showObjHead.SetValue(True) |
1269 | - wx.EVT_CHECKBOX(self, self.showObjHead.GetId(), self.ShowObjectHead) | ||
1270 | - | ||
1271 | - text_X = wx.StaticText(self.panel, -1, _("X:")) | 1276 | + wx.EVT_CHECKBOX(self, self.showObjHead.GetId(), self.ShowObjectHead) |
1277 | + | ||
1278 | + text_X = wx.StaticText(self.panel, -1, _("X:")) | ||
1272 | spin_X = wx.SpinCtrl(self.panel, -1, "X", size = wx.Size(67,23)) | 1279 | spin_X = wx.SpinCtrl(self.panel, -1, "X", size = wx.Size(67,23)) |
1273 | spin_X .SetValue(0) | 1280 | spin_X .SetValue(0) |
1274 | spin_X.Bind(wx.EVT_SPINCTRL, self.translate_rotate) | 1281 | spin_X.Bind(wx.EVT_SPINCTRL, self.translate_rotate) |
1275 | spin_X.Bind(wx.EVT_TEXT, self.translate_rotate) | 1282 | spin_X.Bind(wx.EVT_TEXT, self.translate_rotate) |
1276 | spin_X .SetRange(-500,500) | 1283 | spin_X .SetRange(-500,500) |
1277 | - | ||
1278 | - self.spin_X = spin_X | ||
1279 | - | ||
1280 | - text_Y = wx.StaticText(self.panel, -1, _("Y:")) | 1284 | + |
1285 | + self.spin_X = spin_X | ||
1286 | + | ||
1287 | + text_Y = wx.StaticText(self.panel, -1, _("Y:")) | ||
1281 | spin_Y = wx.SpinCtrl(self.panel, -1, "Y", size = wx.Size(67,23)) | 1288 | spin_Y = wx.SpinCtrl(self.panel, -1, "Y", size = wx.Size(67,23)) |
1282 | spin_Y .SetValue(0) | 1289 | spin_Y .SetValue(0) |
1283 | spin_Y.Bind(wx.EVT_SPINCTRL, self.translate_rotate) | 1290 | spin_Y.Bind(wx.EVT_SPINCTRL, self.translate_rotate) |
1284 | spin_Y.Bind(wx.EVT_TEXT, self.translate_rotate) | 1291 | spin_Y.Bind(wx.EVT_TEXT, self.translate_rotate) |
1285 | spin_Y .SetRange(-500,500) | 1292 | spin_Y .SetRange(-500,500) |
1286 | - | ||
1287 | - self.spin_Y = spin_Y | ||
1288 | - | ||
1289 | - text_Z = wx.StaticText(self.panel, -1, _("Z:")) | 1293 | + |
1294 | + self.spin_Y = spin_Y | ||
1295 | + | ||
1296 | + text_Z = wx.StaticText(self.panel, -1, _("Z:")) | ||
1290 | spin_Z = wx.SpinCtrl(self.panel, -1, "Z", size = wx.Size(67,23)) | 1297 | spin_Z = wx.SpinCtrl(self.panel, -1, "Z", size = wx.Size(67,23)) |
1291 | spin_Z .SetValue(0) | 1298 | spin_Z .SetValue(0) |
1292 | spin_Z.Bind(wx.EVT_SPINCTRL, self.translate_rotate) | 1299 | spin_Z.Bind(wx.EVT_SPINCTRL, self.translate_rotate) |
1293 | spin_Z.Bind(wx.EVT_TEXT, self.translate_rotate) | 1300 | spin_Z.Bind(wx.EVT_TEXT, self.translate_rotate) |
1294 | spin_Z .SetRange(-500,500) | 1301 | spin_Z .SetRange(-500,500) |
1295 | - | ||
1296 | - self.spin_Z = spin_Z | ||
1297 | - | ||
1298 | - text_A = wx.StaticText(self.panel,-1, _("Alfa:")) | 1302 | + |
1303 | + self.spin_Z = spin_Z | ||
1304 | + | ||
1305 | + text_A = wx.StaticText(self.panel,-1, _("Alfa:")) | ||
1299 | spin_A = wx.SpinCtrl(self.panel, -1, "Alfa", size = wx.Size(67,23)) | 1306 | spin_A = wx.SpinCtrl(self.panel, -1, "Alfa", size = wx.Size(67,23)) |
1300 | spin_A .SetValue(0) | 1307 | spin_A .SetValue(0) |
1301 | spin_A .SetRange(-500,500) | 1308 | spin_A .SetRange(-500,500) |
1302 | spin_A.Bind(wx.EVT_SPINCTRL, self.translate_rotate) | 1309 | spin_A.Bind(wx.EVT_SPINCTRL, self.translate_rotate) |
1303 | spin_A.Bind(wx.EVT_TEXT, self.translate_rotate) | 1310 | spin_A.Bind(wx.EVT_TEXT, self.translate_rotate) |
1304 | - | ||
1305 | - self.spin_A = spin_A | ||
1306 | - | ||
1307 | - text_B = wx.StaticText(self.panel, -1, _("Beta:")) | 1311 | + |
1312 | + self.spin_A = spin_A | ||
1313 | + | ||
1314 | + text_B = wx.StaticText(self.panel, -1, _("Beta:")) | ||
1308 | spin_B = wx.SpinCtrl(self.panel, -1, "Beta", size = wx.Size(67,23)) | 1315 | spin_B = wx.SpinCtrl(self.panel, -1, "Beta", size = wx.Size(67,23)) |
1309 | spin_B .SetValue(0) | 1316 | spin_B .SetValue(0) |
1310 | spin_B .SetRange(-500,500) | 1317 | spin_B .SetRange(-500,500) |
1311 | spin_B.Bind(wx.EVT_SPINCTRL, self.translate_rotate) | 1318 | spin_B.Bind(wx.EVT_SPINCTRL, self.translate_rotate) |
1312 | spin_B.Bind(wx.EVT_TEXT, self.translate_rotate) | 1319 | spin_B.Bind(wx.EVT_TEXT, self.translate_rotate) |
1313 | - | ||
1314 | - self.spin_B = spin_B | ||
1315 | - | ||
1316 | - text_G = wx.StaticText(self.panel, -1, _("Gama:")) | 1320 | + |
1321 | + self.spin_B = spin_B | ||
1322 | + | ||
1323 | + text_G = wx.StaticText(self.panel, -1, _("Gama:")) | ||
1317 | spin_G = wx.SpinCtrl(self.panel, -1, "Gama", size = wx.Size(67,23)) | 1324 | spin_G = wx.SpinCtrl(self.panel, -1, "Gama", size = wx.Size(67,23)) |
1318 | spin_G .SetValue(0) | 1325 | spin_G .SetValue(0) |
1319 | spin_G .SetRange(-500,500) | 1326 | spin_G .SetRange(-500,500) |
1320 | spin_G.Bind(wx.EVT_SPINCTRL, self.translate_rotate) | 1327 | spin_G.Bind(wx.EVT_SPINCTRL, self.translate_rotate) |
1321 | spin_G.Bind(wx.EVT_TEXT, self.translate_rotate) | 1328 | spin_G.Bind(wx.EVT_TEXT, self.translate_rotate) |
1322 | - | 1329 | + |
1323 | self.spin_G = spin_G | 1330 | self.spin_G = spin_G |
1324 | - | ||
1325 | - text_inter = wx.StaticText(self.panel, -1, _("Number of Iterations:")) | 1331 | + |
1332 | + text_inter = wx.StaticText(self.panel, -1, _("Number of Iterations:")) | ||
1326 | spin_inter = wx.SpinCtrl(self.panel, -1, "Numb Inter", size = wx.Size(95,23)) | 1333 | spin_inter = wx.SpinCtrl(self.panel, -1, "Numb Inter", size = wx.Size(95,23)) |
1327 | spin_inter.SetValue(1000) | 1334 | spin_inter.SetValue(1000) |
1328 | spin_inter.SetRange(0,5000) | 1335 | spin_inter.SetRange(0,5000) |
1329 | # spin_X .SetValue() | 1336 | # spin_X .SetValue() |
1330 | self.spin_inter = spin_inter | 1337 | self.spin_inter = spin_inter |
1331 | - | ||
1332 | - text_land = wx.StaticText(self.panel, -1, _("Number of Landmarks:")) | 1338 | + |
1339 | + text_land = wx.StaticText(self.panel, -1, _("Number of Landmarks:")) | ||
1333 | spin_land = wx.SpinCtrl(self.panel, -1, "Landmarks", size = wx.Size(95,23)) | 1340 | spin_land = wx.SpinCtrl(self.panel, -1, "Landmarks", size = wx.Size(95,23)) |
1334 | spin_land.SetValue(1000) | 1341 | spin_land.SetValue(1000) |
1335 | spin_land .SetRange(0,5000) | 1342 | spin_land .SetRange(0,5000) |
1336 | - | 1343 | + |
1337 | # spin_Y .SetValue() | 1344 | # spin_Y .SetValue() |
1338 | - self.spin_land = spin_land | ||
1339 | - | ||
1340 | - text_mean = wx.StaticText(self.panel, -1, _("Max Mean Distance:")) | 1345 | + self.spin_land = spin_land |
1346 | + | ||
1347 | + text_mean = wx.StaticText(self.panel, -1, _("Max Mean Distance:")) | ||
1341 | #spin_mean= wx.SpinCtrl(self.panel, 1, "mean", size = wx.Size(107,23)) | 1348 | #spin_mean= wx.SpinCtrl(self.panel, 1, "mean", size = wx.Size(107,23)) |
1342 | spin_mean = floatspin.FloatSpin(self.panel,-1,value=0.01, min_val=0.0,max_val=10.0, increment=0.01, digits=2) | 1349 | spin_mean = floatspin.FloatSpin(self.panel,-1,value=0.01, min_val=0.0,max_val=10.0, increment=0.01, digits=2) |
1343 | - | 1350 | + |
1344 | #spin_mean.SetValue(0.01) | 1351 | #spin_mean.SetValue(0.01) |
1345 | #spin_mean .SetRange(0,10) | 1352 | #spin_mean .SetRange(0,10) |
1346 | -# spin_Z .SetValue() | ||
1347 | - self.spin_mean = spin_mean | ||
1348 | - | 1353 | +# spin_Z .SetValue() |
1354 | + self.spin_mean = spin_mean | ||
1355 | + | ||
1349 | spinicp = wx.FlexGridSizer(rows=3, cols=2, hgap=1, vgap=1) | 1356 | spinicp = wx.FlexGridSizer(rows=3, cols=2, hgap=1, vgap=1) |
1350 | spinicp.AddMany([(text_inter,0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_inter, 1), | 1357 | spinicp.AddMany([(text_inter,0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_inter, 1), |
1351 | (text_land,0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_land, 1), | 1358 | (text_land,0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_land, 1), |
1352 | - (text_mean,0, wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_mean, 1)]) | ||
1353 | - | 1359 | + (text_mean,0, wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_mean, 1)]) |
1360 | + | ||
1354 | spin = wx.FlexGridSizer(rows=3, cols=4, hgap=1, vgap=1) | 1361 | spin = wx.FlexGridSizer(rows=3, cols=4, hgap=1, vgap=1) |
1355 | spin.AddMany([(text_X, 0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_X, 1),(text_A, 0,wx.ALIGN_TOP|wx.EXPAND|wx.LEFT| wx.TOP|wx.BOTTOM,5),(spin_A, 1), | 1362 | spin.AddMany([(text_X, 0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_X, 1),(text_A, 0,wx.ALIGN_TOP|wx.EXPAND|wx.LEFT| wx.TOP|wx.BOTTOM,5),(spin_A, 1), |
1356 | (text_Y, 0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_Y, 1),(text_B, 0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND|wx.LEFT| wx.TOP|wx.BOTTOM,5),(spin_B, 1), | 1363 | (text_Y, 0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_Y, 1),(text_B, 0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND|wx.LEFT| wx.TOP|wx.BOTTOM,5),(spin_B, 1), |
1357 | - (text_Z, 0,wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_Z, 1),(text_G, 0,wx.ALIGN_BOTTOM|wx.EXPAND|wx.LEFT| wx.TOP|wx.BOTTOM,5),(spin_G, 1)]) | ||
1358 | - | 1364 | + (text_Z, 0,wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_Z, 1),(text_G, 0,wx.ALIGN_BOTTOM|wx.EXPAND|wx.LEFT| wx.TOP|wx.BOTTOM,5),(spin_G, 1)]) |
1365 | + | ||
1359 | ok = wx.Button(self.panel, wx.ID_OK) | 1366 | ok = wx.Button(self.panel, wx.ID_OK) |
1360 | ok.Bind(wx.EVT_BUTTON, self.OK) | 1367 | ok.Bind(wx.EVT_BUTTON, self.OK) |
1361 | cancel = wx.Button(self.panel,wx.ID_CANCEL) | 1368 | cancel = wx.Button(self.panel,wx.ID_CANCEL) |
1362 | cancel.Bind(wx.EVT_BUTTON, self.CANCEL) | 1369 | cancel.Bind(wx.EVT_BUTTON, self.CANCEL) |
1363 | - | 1370 | + |
1364 | checkb = wx.FlexGridSizer(rows=3, cols=1, hgap=1, vgap=1) | 1371 | checkb = wx.FlexGridSizer(rows=3, cols=1, hgap=1, vgap=1) |
1365 | checkb.AddMany([(self.showObjICP , 0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5), | 1372 | checkb.AddMany([(self.showObjICP , 0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5), |
1366 | (self.showObjHead , 0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5), | 1373 | (self.showObjHead , 0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5), |
1367 | (self.showObjCloud , 0,wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5)]) | 1374 | (self.showObjCloud , 0,wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5)]) |
1368 | - | 1375 | + |
1369 | col1 = wx.FlexGridSizer(rows=3, cols=1, hgap=1, vgap=1) | 1376 | col1 = wx.FlexGridSizer(rows=3, cols=1, hgap=1, vgap=1) |
1370 | col1.AddMany([(marker, 1), | 1377 | col1.AddMany([(marker, 1), |
1371 | (marker_load, 1), | 1378 | (marker_load, 1), |
1372 | (apply_ICP, 1)]) | 1379 | (apply_ICP, 1)]) |
1373 | - | 1380 | + |
1374 | # col2 = wx.FlexGridSizer(rows=1, cols=1, hgap=1, vgap=1) | 1381 | # col2 = wx.FlexGridSizer(rows=1, cols=1, hgap=1, vgap=1) |
1375 | # col2.AddMany([(param_ICP, 1)]) | 1382 | # col2.AddMany([(param_ICP, 1)]) |
1376 | -# | 1383 | +# |
1377 | col4 = wx.FlexGridSizer(rows=2, cols=1, hgap=1, vgap=1) | 1384 | col4 = wx.FlexGridSizer(rows=2, cols=1, hgap=1, vgap=1) |
1378 | col4.AddMany([(ok, 1), | 1385 | col4.AddMany([(ok, 1), |
1379 | (cancel, 1)]) | 1386 | (cancel, 1)]) |
1380 | - | 1387 | + |
1381 | button_sizer = wx.BoxSizer(wx.HORIZONTAL) | 1388 | button_sizer = wx.BoxSizer(wx.HORIZONTAL) |
1382 | button_sizer.Add(col1,0,wx.EXPAND | wx.ALL,10) | 1389 | button_sizer.Add(col1,0,wx.EXPAND | wx.ALL,10) |
1383 | button_sizer.Add(checkb,0,wx.EXPAND | wx.ALL,10) | 1390 | button_sizer.Add(checkb,0,wx.EXPAND | wx.ALL,10) |
@@ -1390,83 +1397,83 @@ class FineCalibration(wx.Window): | @@ -1390,83 +1397,83 @@ class FineCalibration(wx.Window): | ||
1390 | sizer = wx.BoxSizer(wx.VERTICAL) | 1397 | sizer = wx.BoxSizer(wx.VERTICAL) |
1391 | sizer.Add(self.interactor, 5, wx.EXPAND,10) | 1398 | sizer.Add(self.interactor, 5, wx.EXPAND,10) |
1392 | sizer.Add(self.panel, 1,wx.ALIGN_CENTER,1) | 1399 | sizer.Add(self.panel, 1,wx.ALIGN_CENTER,1) |
1393 | - | 1400 | + |
1394 | self.SetSizerAndFit(sizer) | 1401 | self.SetSizerAndFit(sizer) |
1395 | self.Show() | 1402 | self.Show() |
1396 | sizer.Fit(self) | 1403 | sizer.Fit(self) |
1397 | - | ||
1398 | - def GetValue(self): | 1404 | + |
1405 | + def GetValue(self): | ||
1399 | return self.actor_icp,self.icp_matrix | 1406 | return self.actor_icp,self.icp_matrix |
1400 | - def OK(self,evt): | ||
1401 | - self.Close() | ||
1402 | - def CANCEL(self,evt): | ||
1403 | - self.Destroy() | 1407 | + def OK(self,evt): |
1408 | + self.Close() | ||
1409 | + def CANCEL(self,evt): | ||
1410 | + self.Destroy() | ||
1404 | def ShowObjectICP(self, evt): | 1411 | def ShowObjectICP(self, evt): |
1405 | objectbin = self.showObjICP.GetValue() | 1412 | objectbin = self.showObjICP.GetValue() |
1406 | if objectbin == True: | 1413 | if objectbin == True: |
1407 | self.actor_icp.SetVisibility(1) | 1414 | self.actor_icp.SetVisibility(1) |
1408 | - self.interactor.Render() | 1415 | + self.interactor.Render() |
1409 | if objectbin == False: | 1416 | if objectbin == False: |
1410 | self.actor_icp.SetVisibility(0) | 1417 | self.actor_icp.SetVisibility(0) |
1411 | - self.interactor.Render() | ||
1412 | - | 1418 | + self.interactor.Render() |
1419 | + | ||
1413 | def ShowObjectCloud(self, evt): | 1420 | def ShowObjectCloud(self, evt): |
1414 | objectbin = self.showObjCloud.GetValue() | 1421 | objectbin = self.showObjCloud.GetValue() |
1415 | if objectbin == True: | 1422 | if objectbin == True: |
1416 | self.actor_cloud.SetVisibility(1) | 1423 | self.actor_cloud.SetVisibility(1) |
1417 | - self.interactor.Render() | 1424 | + self.interactor.Render() |
1418 | if objectbin == False: | 1425 | if objectbin == False: |
1419 | self.actor_cloud.SetVisibility(0) | 1426 | self.actor_cloud.SetVisibility(0) |
1420 | - self.interactor.Render() | ||
1421 | - | 1427 | + self.interactor.Render() |
1428 | + | ||
1422 | def ShowObjectHead(self, evt): | 1429 | def ShowObjectHead(self, evt): |
1423 | objectbin = self.showObjHead.GetValue() | 1430 | objectbin = self.showObjHead.GetValue() |
1424 | if objectbin == True: | 1431 | if objectbin == True: |
1425 | self.actor.SetVisibility(1) | 1432 | self.actor.SetVisibility(1) |
1426 | - self.interactor.Render() | 1433 | + self.interactor.Render() |
1427 | if objectbin == False: | 1434 | if objectbin == False: |
1428 | self.actor.SetVisibility(0) | 1435 | self.actor.SetVisibility(0) |
1429 | - self.interactor.Render() | ||
1430 | - | 1436 | + self.interactor.Render() |
1437 | + | ||
1431 | def translate_rotate(self,evt): | 1438 | def translate_rotate(self,evt): |
1432 | self.transform = vtk.vtkTransform() | 1439 | self.transform = vtk.vtkTransform() |
1433 | self.transform.Identity() | 1440 | self.transform.Identity() |
1434 | self.transform.PostMultiply() | 1441 | self.transform.PostMultiply() |
1435 | - | 1442 | + |
1436 | # try2=vtk.vtkImageChangeInformation.SetInput(self.cloud) | 1443 | # try2=vtk.vtkImageChangeInformation.SetInput(self.cloud) |
1437 | # self.cloud.vtk.vtkImageData.SetOrigin(self.actor_cloud.GetCenter()) | 1444 | # self.cloud.vtk.vtkImageData.SetOrigin(self.actor_cloud.GetCenter()) |
1438 | # try1=vtk.vtkImageData(self.reader_cloud) | 1445 | # try1=vtk.vtkImageData(self.reader_cloud) |
1439 | # try1.SetOrigin(self.actor_cloud.GetCenter()) | 1446 | # try1.SetOrigin(self.actor_cloud.GetCenter()) |
1440 | - | 1447 | + |
1441 | self.transform.Translate(self.spin_X.GetValue(), 0, 0) | 1448 | self.transform.Translate(self.spin_X.GetValue(), 0, 0) |
1442 | self.transform.Translate(0,self.spin_Y.GetValue(), 0) | 1449 | self.transform.Translate(0,self.spin_Y.GetValue(), 0) |
1443 | self.transform.Translate(0, 0, self.spin_Z.GetValue()) | 1450 | self.transform.Translate(0, 0, self.spin_Z.GetValue()) |
1444 | - | 1451 | + |
1445 | #self.actor_cloud.SetOrientation(self.spin_A.GetValue(),xyz[1],xyz[2]) | 1452 | #self.actor_cloud.SetOrientation(self.spin_A.GetValue(),xyz[1],xyz[2]) |
1446 | #transform.RotateWXYZ(self.spin_A.GetValue(),1,0,0) | 1453 | #transform.RotateWXYZ(self.spin_A.GetValue(),1,0,0) |
1447 | - | 1454 | + |
1448 | # transform.RotateX(self.spin_A.GetValue()) | 1455 | # transform.RotateX(self.spin_A.GetValue()) |
1449 | # transform.RotateY(self.spin_B.GetValue()) | 1456 | # transform.RotateY(self.spin_B.GetValue()) |
1450 | # transform.RotateZ(self.spin_G.GetValue()) | 1457 | # transform.RotateZ(self.spin_G.GetValue()) |
1451 | # transform.RotateWXYZ(self.spin_B.GetValue(),xyz[0],1,xyz[2]) | 1458 | # transform.RotateWXYZ(self.spin_B.GetValue(),xyz[0],1,xyz[2]) |
1452 | # transform.RotateWXYZ(self.spin_G.GetValue(),xyz[0],xyz[1],1) | 1459 | # transform.RotateWXYZ(self.spin_G.GetValue(),xyz[0],xyz[1],1) |
1453 | self.actor_cloud.SetOrigin(self.actor_cloud.GetCenter()) | 1460 | self.actor_cloud.SetOrigin(self.actor_cloud.GetCenter()) |
1454 | - self.actor_cloud.SetOrientation(0,0,0) | 1461 | + self.actor_cloud.SetOrientation(0,0,0) |
1455 | #self.transform.SetInput(self.actor_cloud) | 1462 | #self.transform.SetInput(self.actor_cloud) |
1456 | self.transform.RotateX(self.spin_A.GetValue()) | 1463 | self.transform.RotateX(self.spin_A.GetValue()) |
1457 | self.transform.RotateY(self.spin_B.GetValue()) | 1464 | self.transform.RotateY(self.spin_B.GetValue()) |
1458 | self.transform.RotateZ(self.spin_G.GetValue()) | 1465 | self.transform.RotateZ(self.spin_G.GetValue()) |
1459 | - | 1466 | + |
1460 | # self.transform.RotateX(self.spin_A.GetValue()) | 1467 | # self.transform.RotateX(self.spin_A.GetValue()) |
1461 | # self.transform.RotateY(self.spin_B.GetValue()) | 1468 | # self.transform.RotateY(self.spin_B.GetValue()) |
1462 | # self.transform.RotateZ(self.spin_G.GetValue()) | 1469 | # self.transform.RotateZ(self.spin_G.GetValue()) |
1463 | self.transform.Update() | 1470 | self.transform.Update() |
1464 | - | 1471 | + |
1465 | self.transf = vtk.vtkTransformPolyDataFilter() | 1472 | self.transf = vtk.vtkTransformPolyDataFilter() |
1466 | - | 1473 | + |
1467 | self.transf.SetInput(self.cloud) | 1474 | self.transf.SetInput(self.cloud) |
1468 | self.transf.SetTransform(self.transform) | 1475 | self.transf.SetTransform(self.transform) |
1469 | - self.transf.Update() | 1476 | + self.transf.Update() |
1470 | self.ren.RemoveActor(self.actor_cloud) | 1477 | self.ren.RemoveActor(self.actor_cloud) |
1471 | self.mapper_cloud = vtk.vtkPolyDataMapper() | 1478 | self.mapper_cloud = vtk.vtkPolyDataMapper() |
1472 | self.mapper_cloud.SetInput(self.transf.GetOutput()) | 1479 | self.mapper_cloud.SetInput(self.transf.GetOutput()) |
@@ -1477,17 +1484,17 @@ class FineCalibration(wx.Window): | @@ -1477,17 +1484,17 @@ class FineCalibration(wx.Window): | ||
1477 | self.actor_cloud.GetProperty().SetColor(self.color_cloud) | 1484 | self.actor_cloud.GetProperty().SetColor(self.color_cloud) |
1478 | self.actor_cloud.GetProperty().SetOpacity(self.opacity_cloud) | 1485 | self.actor_cloud.GetProperty().SetOpacity(self.opacity_cloud) |
1479 | self.ren.AddActor(self.actor_cloud) | 1486 | self.ren.AddActor(self.actor_cloud) |
1480 | - | 1487 | + |
1481 | #self.actor_cloud.SetOrigin(self.actor_cloud.GetCenter()) | 1488 | #self.actor_cloud.SetOrigin(self.actor_cloud.GetCenter()) |
1482 | - #self.actor_cloud.SetOrientation(0,0,0) | 1489 | + #self.actor_cloud.SetOrientation(0,0,0) |
1483 | #self.actor_cloud.RotateX(self.spin_A.GetValue()) | 1490 | #self.actor_cloud.RotateX(self.spin_A.GetValue()) |
1484 | #self.actor_cloud.RotateY(self.spin_B.GetValue()) | 1491 | #self.actor_cloud.RotateY(self.spin_B.GetValue()) |
1485 | #self.actor_cloud.RotateZ(self.spin_G.GetValue()) | 1492 | #self.actor_cloud.RotateZ(self.spin_G.GetValue()) |
1486 | - self.interactor.Render() | ||
1487 | - | 1493 | + self.interactor.Render() |
1494 | + | ||
1488 | def OnLoadMarkers(self, evt): | 1495 | def OnLoadMarkers(self, evt): |
1489 | print "Reading the points!" | 1496 | print "Reading the points!" |
1490 | - | 1497 | + |
1491 | filepath = ShowLoadMarkersDialog() | 1498 | filepath = ShowLoadMarkersDialog() |
1492 | text_file = open(filepath, "r") | 1499 | text_file = open(filepath, "r") |
1493 | #reading all lines and splitting into a float vector | 1500 | #reading all lines and splitting into a float vector |
@@ -1497,12 +1504,12 @@ class FineCalibration(wx.Window): | @@ -1497,12 +1504,12 @@ class FineCalibration(wx.Window): | ||
1497 | break | 1504 | break |
1498 | try: | 1505 | try: |
1499 | line1 = [float(s) for s in line.split()] | 1506 | line1 = [float(s) for s in line.split()] |
1500 | - coord = float(line1[1] - 1.0), float(line1[0] - 1.0), float(line1[2] - 1.0) | 1507 | + coord = float(line1[1] - 1.0), float(line1[0] - 1.0), float(line1[2] - 1.0) |
1501 | colour = line1[3], line1[4], line1[5] | 1508 | colour = line1[3], line1[4], line1[5] |
1502 | size = line1[6] | 1509 | size = line1[6] |
1503 | - | 1510 | + |
1504 | CreateSphereMarkers(self,size,colour,coord) | 1511 | CreateSphereMarkers(self,size,colour,coord) |
1505 | - | 1512 | + |
1506 | #sum 1 for each coordinate to matlab comprehension | 1513 | #sum 1 for each coordinate to matlab comprehension |
1507 | #coord = coord[0] + 1.0, coord[1] + 1.0, coord[2] + 1.0 | 1514 | #coord = coord[0] + 1.0, coord[1] + 1.0, coord[2] + 1.0 |
1508 | #line with coordinates and properties of a marker | 1515 | #line with coordinates and properties of a marker |
@@ -1516,57 +1523,57 @@ class FineCalibration(wx.Window): | @@ -1516,57 +1523,57 @@ class FineCalibration(wx.Window): | ||
1516 | except: | 1523 | except: |
1517 | InvalidTxt() | 1524 | InvalidTxt() |
1518 | raise ValueError('Invalid Txt') | 1525 | raise ValueError('Invalid Txt') |
1519 | - | 1526 | + |
1520 | def OnCalibrationMarkers(self, evt): | 1527 | def OnCalibrationMarkers(self, evt): |
1521 | None | 1528 | None |
1522 | - | 1529 | + |
1523 | def OnParamICP(self, evt): | 1530 | def OnParamICP(self, evt): |
1524 | - None | ||
1525 | - | 1531 | + None |
1532 | + | ||
1526 | def OnApplyICP(self, evt): | 1533 | def OnApplyICP(self, evt): |
1527 | self.showObjICP.SetValue(True) | 1534 | self.showObjICP.SetValue(True) |
1528 | - self.icp_number_iterations= self.spin_inter.GetValue() | ||
1529 | - self.icp_number_landmarks= self.spin_land.GetValue() | 1535 | + self.icp_number_iterations= self.spin_inter.GetValue() |
1536 | + self.icp_number_landmarks= self.spin_land.GetValue() | ||
1530 | self.icp_max_mean_distance = self.spin_mean.GetValue() | 1537 | self.icp_max_mean_distance = self.spin_mean.GetValue() |
1531 | self.Transformation() | 1538 | self.Transformation() |
1532 | - self.interactor.Render() | ||
1533 | - self.Show() | ||
1534 | - | 1539 | + self.interactor.Render() |
1540 | + self.Show() | ||
1541 | + | ||
1535 | def CreateCloudPointsSurface(self, filename_cloud): | 1542 | def CreateCloudPointsSurface(self, filename_cloud): |
1536 | # Reconstruct the surface from the cloud of points | 1543 | # Reconstruct the surface from the cloud of points |
1537 | self.reader_cloud = vtk.vtkPLYReader() | 1544 | self.reader_cloud = vtk.vtkPLYReader() |
1538 | - | 1545 | + |
1539 | self.reader_cloud.SetFileName(filename_cloud) | 1546 | self.reader_cloud.SetFileName(filename_cloud) |
1540 | self.reader_cloud.Update() | 1547 | self.reader_cloud.Update() |
1541 | - | 1548 | + |
1542 | print "Creating cloud surface..." | 1549 | print "Creating cloud surface..." |
1543 | - | 1550 | + |
1544 | self.mapper_cloud = vtk.vtkPolyDataMapper() | 1551 | self.mapper_cloud = vtk.vtkPolyDataMapper() |
1545 | self.mapper_cloud.SetInput(self.reader_cloud.GetOutput()) | 1552 | self.mapper_cloud.SetInput(self.reader_cloud.GetOutput()) |
1546 | self.mapper_cloud.ScalarVisibilityOff() | 1553 | self.mapper_cloud.ScalarVisibilityOff() |
1547 | self.mapper_cloud.ImmediateModeRenderingOn() | 1554 | self.mapper_cloud.ImmediateModeRenderingOn() |
1548 | - | 1555 | + |
1549 | self.actor_cloud = vtk.vtkActor() | 1556 | self.actor_cloud = vtk.vtkActor() |
1550 | self.actor_cloud.SetMapper(self.mapper_cloud) | 1557 | self.actor_cloud.SetMapper(self.mapper_cloud) |
1551 | self.actor_cloud.GetProperty().SetColor(self.color_cloud) | 1558 | self.actor_cloud.GetProperty().SetColor(self.color_cloud) |
1552 | self.actor_cloud.GetProperty().SetOpacity(self.opacity_cloud) | 1559 | self.actor_cloud.GetProperty().SetOpacity(self.opacity_cloud) |
1553 | - | 1560 | + |
1554 | return self.reader_cloud.GetOutput() | 1561 | return self.reader_cloud.GetOutput() |
1555 | - | ||
1556 | - def Transformation(self): | 1562 | + |
1563 | + def Transformation(self): | ||
1557 | # Apply IterativeClosestPoint Method | 1564 | # Apply IterativeClosestPoint Method |
1558 | - | 1565 | + |
1559 | #self.filename_cloud=self.ShowLoadSurfaceDialog() | 1566 | #self.filename_cloud=self.ShowLoadSurfaceDialog() |
1560 | try: | 1567 | try: |
1561 | self.ren.RemoveActor(self.actor_icp) | 1568 | self.ren.RemoveActor(self.actor_icp) |
1562 | - self.interactor.Render() | 1569 | + self.interactor.Render() |
1563 | except: | 1570 | except: |
1564 | None | 1571 | None |
1565 | filename_head = self.head | 1572 | filename_head = self.head |
1566 | #filename_cloud = sys.argv[2] | 1573 | #filename_cloud = sys.argv[2] |
1567 | #head_init = self.CreateHeadSurface(filename_head) | 1574 | #head_init = self.CreateHeadSurface(filename_head) |
1568 | #cloud = self.CreateCloudPointsSurface(self.filename_cloud) | 1575 | #cloud = self.CreateCloudPointsSurface(self.filename_cloud) |
1569 | - | 1576 | + |
1570 | print "Applying ICP method..." | 1577 | print "Applying ICP method..." |
1571 | icp = vtk.vtkIterativeClosestPointTransform() | 1578 | icp = vtk.vtkIterativeClosestPointTransform() |
1572 | icp.SetSource(filename_head) | 1579 | icp.SetSource(filename_head) |
@@ -1574,7 +1581,7 @@ class FineCalibration(wx.Window): | @@ -1574,7 +1581,7 @@ class FineCalibration(wx.Window): | ||
1574 | icp.SetTarget(self.transf.GetOutput()) | 1581 | icp.SetTarget(self.transf.GetOutput()) |
1575 | except: | 1582 | except: |
1576 | icp.SetTarget(self.cloud) | 1583 | icp.SetTarget(self.cloud) |
1577 | - | 1584 | + |
1578 | icp.StartByMatchingCentroidsOn() | 1585 | icp.StartByMatchingCentroidsOn() |
1579 | icp.SetMaximumNumberOfIterations(self.icp_number_iterations) | 1586 | icp.SetMaximumNumberOfIterations(self.icp_number_iterations) |
1580 | icp.SetMaximumNumberOfLandmarks(self.icp_number_landmarks) | 1587 | icp.SetMaximumNumberOfLandmarks(self.icp_number_landmarks) |
@@ -1582,26 +1589,26 @@ class FineCalibration(wx.Window): | @@ -1582,26 +1589,26 @@ class FineCalibration(wx.Window): | ||
1582 | icp.GetLandmarkTransform().SetModeToRigidBody() | 1589 | icp.GetLandmarkTransform().SetModeToRigidBody() |
1583 | icp.SetMeanDistanceModeToRMS() | 1590 | icp.SetMeanDistanceModeToRMS() |
1584 | icp.Update() | 1591 | icp.Update() |
1585 | - | 1592 | + |
1586 | icp_transf = vtk.vtkTransformPolyDataFilter() | 1593 | icp_transf = vtk.vtkTransformPolyDataFilter() |
1587 | icp_transf.SetInput(filename_head) | 1594 | icp_transf.SetInput(filename_head) |
1588 | icp_transf.SetTransform(icp) | 1595 | icp_transf.SetTransform(icp) |
1589 | - icp_transf.Update() | ||
1590 | - | 1596 | + icp_transf.Update() |
1597 | + | ||
1591 | mapper_head_icp = vtk.vtkPolyDataMapper() | 1598 | mapper_head_icp = vtk.vtkPolyDataMapper() |
1592 | mapper_head_icp.SetInput(icp_transf.GetOutput()) | 1599 | mapper_head_icp.SetInput(icp_transf.GetOutput()) |
1593 | mapper_head_icp.ScalarVisibilityOff() | 1600 | mapper_head_icp.ScalarVisibilityOff() |
1594 | mapper_head_icp.ImmediateModeRenderingOn() | 1601 | mapper_head_icp.ImmediateModeRenderingOn() |
1595 | - | 1602 | + |
1596 | self.actor_icp = vtk.vtkActor() | 1603 | self.actor_icp = vtk.vtkActor() |
1597 | self.actor_icp.SetMapper(mapper_head_icp) | 1604 | self.actor_icp.SetMapper(mapper_head_icp) |
1598 | self.actor_icp.GetProperty().SetColor(self.color_head_icp) | 1605 | self.actor_icp.GetProperty().SetColor(self.color_head_icp) |
1599 | self.actor_icp.GetProperty().SetOpacity(self.opacity_head_icp) | 1606 | self.actor_icp.GetProperty().SetOpacity(self.opacity_head_icp) |
1600 | - | 1607 | + |
1601 | self.icp_matrix = vtk.vtkMatrix4x4() | 1608 | self.icp_matrix = vtk.vtkMatrix4x4() |
1602 | self.icp_matrix = icp.GetMatrix() | 1609 | self.icp_matrix = icp.GetMatrix() |
1603 | print self.icp_matrix | 1610 | print self.icp_matrix |
1604 | - | 1611 | + |
1605 | #Eixos para facilitar visualizacao ----------------- | 1612 | #Eixos para facilitar visualizacao ----------------- |
1606 | # axes = vtk.vtkAxesActor() | 1613 | # axes = vtk.vtkAxesActor() |
1607 | # axes.SetShaftTypeToCylinder() | 1614 | # axes.SetShaftTypeToCylinder() |
@@ -1610,57 +1617,57 @@ class FineCalibration(wx.Window): | @@ -1610,57 +1617,57 @@ class FineCalibration(wx.Window): | ||
1610 | # axes.SetZAxisLabelText("z") | 1617 | # axes.SetZAxisLabelText("z") |
1611 | # axes.SetTotalLength(25, 25, 25) | 1618 | # axes.SetTotalLength(25, 25, 25) |
1612 | #--------------------------------------------------- | 1619 | #--------------------------------------------------- |
1613 | - | ||
1614 | - | 1620 | + |
1621 | + | ||
1615 | #renderer.AddActor(axes) | 1622 | #renderer.AddActor(axes) |
1616 | - | 1623 | + |
1617 | self.ren.AddActor(self.actor_icp) | 1624 | self.ren.AddActor(self.actor_icp) |
1618 | #self.outlineF(icp_transf.GetOutput()) | 1625 | #self.outlineF(icp_transf.GetOutput()) |
1619 | - #self.ren.AddActor(self.outline) | 1626 | + #self.ren.AddActor(self.outline) |
1620 | self.ren.SetBackground(0, 0, 0) | 1627 | self.ren.SetBackground(0, 0, 0) |
1621 | self.ren.ResetCamera() | 1628 | self.ren.ResetCamera() |
1622 | - | 1629 | + |
1623 | def LoadData(self): | 1630 | def LoadData(self): |
1624 | coil_reference = vtk.vtkOBJReader() | 1631 | coil_reference = vtk.vtkOBJReader() |
1625 | #coil_reference.SetFileName(os.path.realpath(os.path.join('..', | 1632 | #coil_reference.SetFileName(os.path.realpath(os.path.join('..', |
1626 | # 'models', | 1633 | # 'models', |
1627 | # 'coil_cti_2_scale10.obj'))) | 1634 | # 'coil_cti_2_scale10.obj'))) |
1628 | - | 1635 | + |
1629 | coil_reference.SetFileName('C:\Users\Administrator\Dropbox\Biomag\Renan\coil\coil_cti_2_scale10.obj') | 1636 | coil_reference.SetFileName('C:\Users\Administrator\Dropbox\Biomag\Renan\coil\coil_cti_2_scale10.obj') |
1630 | coilMapper = vtk.vtkPolyDataMapper() | 1637 | coilMapper = vtk.vtkPolyDataMapper() |
1631 | coilMapper.SetInputConnection(coil_reference.GetOutputPort()) | 1638 | coilMapper.SetInputConnection(coil_reference.GetOutputPort()) |
1632 | self.coilActor = vtk.vtkActor() | 1639 | self.coilActor = vtk.vtkActor() |
1633 | #self.coilActor.Scale(10.0, 10.0, 10.0) | 1640 | #self.coilActor.Scale(10.0, 10.0, 10.0) |
1634 | self.coilActor.SetMapper(coilMapper) | 1641 | self.coilActor.SetMapper(coilMapper) |
1635 | - | 1642 | + |
1636 | axes = vtk.vtkAxesActor() | 1643 | axes = vtk.vtkAxesActor() |
1637 | axes.SetShaftTypeToCylinder() | 1644 | axes.SetShaftTypeToCylinder() |
1638 | axes.SetXAxisLabelText("x") | 1645 | axes.SetXAxisLabelText("x") |
1639 | axes.SetYAxisLabelText("y") | 1646 | axes.SetYAxisLabelText("y") |
1640 | axes.SetZAxisLabelText("z") | 1647 | axes.SetZAxisLabelText("z") |
1641 | axes.SetTotalLength(50.0, 50.0, 50.0) | 1648 | axes.SetTotalLength(50.0, 50.0, 50.0) |
1642 | - | 1649 | + |
1643 | self.ren.AddActor(self.coilActor) | 1650 | self.ren.AddActor(self.coilActor) |
1644 | self.ren.AddActor(axes) | 1651 | self.ren.AddActor(axes) |
1645 | - | 1652 | + |
1646 | def LoadActorDLG(self, pubsub_evt): | 1653 | def LoadActorDLG(self, pubsub_evt): |
1647 | self.actor = pubsub_evt.data[0] | 1654 | self.actor = pubsub_evt.data[0] |
1648 | #self.head=actor | 1655 | #self.head=actor |
1649 | self.head=pubsub_evt.data[1] | 1656 | self.head=pubsub_evt.data[1] |
1650 | - | 1657 | + |
1651 | self.outlineF(self.head) | 1658 | self.outlineF(self.head) |
1652 | - self.ren.AddActor(self.outline) | ||
1653 | - | 1659 | + self.ren.AddActor(self.outline) |
1660 | + | ||
1654 | self.filename_cloud=self.ShowLoadSurfaceDialog() | 1661 | self.filename_cloud=self.ShowLoadSurfaceDialog() |
1655 | self.cloud = self.CreateCloudPointsSurface(self.filename_cloud) | 1662 | self.cloud = self.CreateCloudPointsSurface(self.filename_cloud) |
1656 | print self.cloud | 1663 | print self.cloud |
1657 | - | 1664 | + |
1658 | self.outlineF(self.cloud) | 1665 | self.outlineF(self.cloud) |
1659 | - self.ren.AddActor(self.outline) | ||
1660 | - | ||
1661 | - self.ren.AddActor(self.actor) | ||
1662 | - self.ren.AddActor(self.actor_cloud) | ||
1663 | - | 1666 | + self.ren.AddActor(self.outline) |
1667 | + | ||
1668 | + self.ren.AddActor(self.actor) | ||
1669 | + self.ren.AddActor(self.actor_cloud) | ||
1670 | + | ||
1664 | axes = vtk.vtkAxesActor() | 1671 | axes = vtk.vtkAxesActor() |
1665 | axes.SetShaftTypeToCylinder() | 1672 | axes.SetShaftTypeToCylinder() |
1666 | axes.SetXAxisLabelText("x") | 1673 | axes.SetXAxisLabelText("x") |
@@ -1668,67 +1675,67 @@ class FineCalibration(wx.Window): | @@ -1668,67 +1675,67 @@ class FineCalibration(wx.Window): | ||
1668 | axes.SetZAxisLabelText("z") | 1675 | axes.SetZAxisLabelText("z") |
1669 | axes.SetTotalLength(25, 25, 25) | 1676 | axes.SetTotalLength(25, 25, 25) |
1670 | self.ren.AddActor(axes) | 1677 | self.ren.AddActor(axes) |
1671 | - | 1678 | + |
1672 | self.ren.ResetCamera() | 1679 | self.ren.ResetCamera() |
1673 | #self.ren.ResetCameraClippingRange() | 1680 | #self.ren.ResetCameraClippingRange() |
1674 | - | 1681 | + |
1675 | #self.ShowOrientationCube() | 1682 | #self.ShowOrientationCube() |
1676 | - self.interactor.Render() | ||
1677 | - | 1683 | + self.interactor.Render() |
1684 | + | ||
1678 | def LoadVolumeDLG(self, pubsub_evt): | 1685 | def LoadVolumeDLG(self, pubsub_evt): |
1679 | self.raycasting_volume = True | 1686 | self.raycasting_volume = True |
1680 | #self._to_show_ball += 1 | 1687 | #self._to_show_ball += 1 |
1681 | #print "to show ball", self._to_show_ball | 1688 | #print "to show ball", self._to_show_ball |
1682 | - | 1689 | + |
1683 | volume = pubsub_evt.data[0] | 1690 | volume = pubsub_evt.data[0] |
1684 | colour = pubsub_evt.data[1] | 1691 | colour = pubsub_evt.data[1] |
1685 | self.light = self.ren.GetLights().GetNextItem() | 1692 | self.light = self.ren.GetLights().GetNextItem() |
1686 | - | 1693 | + |
1687 | self.ren.AddVolume(volume) | 1694 | self.ren.AddVolume(volume) |
1688 | - | 1695 | + |
1689 | self.ren.SetBackground(colour) | 1696 | self.ren.SetBackground(colour) |
1690 | - | 1697 | + |
1691 | self.interactor.Render() | 1698 | self.interactor.Render() |
1692 | - | 1699 | + |
1693 | def outlineF(self,Actor): | 1700 | def outlineF(self,Actor): |
1694 | #filtro outline | 1701 | #filtro outline |
1695 | self.outline = vtk.vtkActor() | 1702 | self.outline = vtk.vtkActor() |
1696 | outlineData = vtk.vtkOutlineFilter() | 1703 | outlineData = vtk.vtkOutlineFilter() |
1697 | outlineData.SetInput(Actor) | 1704 | outlineData.SetInput(Actor) |
1698 | outlineData.Update() | 1705 | outlineData.Update() |
1699 | - | 1706 | + |
1700 | mapoutline = vtk.vtkPolyDataMapper() | 1707 | mapoutline = vtk.vtkPolyDataMapper() |
1701 | mapoutline.SetInputConnection(outlineData.GetOutputPort()) | 1708 | mapoutline.SetInputConnection(outlineData.GetOutputPort()) |
1702 | - | 1709 | + |
1703 | self.outline.SetMapper(mapoutline) | 1710 | self.outline.SetMapper(mapoutline) |
1704 | self.outline.GetProperty().SetColor(0.0, 0.0, 1.0) | 1711 | self.outline.GetProperty().SetColor(0.0, 0.0, 1.0) |
1705 | - | 1712 | + |
1706 | def CreateSphereMarkers(self,ballsize,ballcolour,coord): | 1713 | def CreateSphereMarkers(self,ballsize,ballcolour,coord): |
1707 | - | 1714 | + |
1708 | x, y, z = bases.flip_x(coord) | 1715 | x, y, z = bases.flip_x(coord) |
1709 | - | 1716 | + |
1710 | ball_ref = vtk.vtkSphereSource() | 1717 | ball_ref = vtk.vtkSphereSource() |
1711 | ball_ref.SetRadius(ballsize) | 1718 | ball_ref.SetRadius(ballsize) |
1712 | ball_ref.SetCenter(x, y, z) | 1719 | ball_ref.SetCenter(x, y, z) |
1713 | - | 1720 | + |
1714 | mapper = vtk.vtkPolyDataMapper() | 1721 | mapper = vtk.vtkPolyDataMapper() |
1715 | mapper.SetInput(ball_ref.GetOutput()) | 1722 | mapper.SetInput(ball_ref.GetOutput()) |
1716 | - | 1723 | + |
1717 | prop = vtk.vtkProperty() | 1724 | prop = vtk.vtkProperty() |
1718 | prop.SetColor(ballcolour) | 1725 | prop.SetColor(ballcolour) |
1719 | - | 1726 | + |
1720 | #adding a new actor for the present ball | 1727 | #adding a new actor for the present ball |
1721 | self.staticballs.append(vtk.vtkActor()) | 1728 | self.staticballs.append(vtk.vtkActor()) |
1722 | - | 1729 | + |
1723 | self.staticballs[self.ball_id].SetMapper(mapper) | 1730 | self.staticballs[self.ball_id].SetMapper(mapper) |
1724 | self.staticballs[self.ball_id].SetProperty(prop) | 1731 | self.staticballs[self.ball_id].SetProperty(prop) |
1725 | - | ||
1726 | - self.ren.AddActor(self.staticballs[self.ball_id]) | 1732 | + |
1733 | + self.ren.AddActor(self.staticballs[self.ball_id]) | ||
1727 | self.ball_id = self.ball_id + 1 | 1734 | self.ball_id = self.ball_id + 1 |
1728 | self.interactor.Render() | 1735 | self.interactor.Render() |
1729 | - | ||
1730 | - | ||
1731 | - | 1736 | + |
1737 | + | ||
1738 | + | ||
1732 | self.PostCreate(self.pre) | 1739 | self.PostCreate(self.pre) |
1733 | # # # class ObjectCalibration(wx.Window): | 1740 | # # # class ObjectCalibration(wx.Window): |
1734 | # # # def __init__(self, parent=None, ID=-1, title="Object Calibration", size=wx.DefaultSize, | 1741 | # # # def __init__(self, parent=None, ID=-1, title="Object Calibration", size=wx.DefaultSize, |
@@ -1967,7 +1974,7 @@ class ObjectCalibration(wx.Dialog): | @@ -1967,7 +1974,7 @@ class ObjectCalibration(wx.Dialog): | ||
1967 | def __init__(self, parent=None, ID=-1, title="Calibration Dialog", size=wx.DefaultSize, | 1974 | def __init__(self, parent=None, ID=-1, title="Calibration Dialog", size=wx.DefaultSize, |
1968 | pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, | 1975 | pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, |
1969 | useMetal=False, nav_prop=None): | 1976 | useMetal=False, nav_prop=None): |
1970 | - | 1977 | + |
1971 | self.nav_prop = nav_prop | 1978 | self.nav_prop = nav_prop |
1972 | self.correg = None | 1979 | self.correg = None |
1973 | self.staticballs = [] | 1980 | self.staticballs = [] |
@@ -1975,7 +1982,7 @@ class ObjectCalibration(wx.Dialog): | @@ -1975,7 +1982,7 @@ class ObjectCalibration(wx.Dialog): | ||
1975 | self.ball_centers = [] | 1982 | self.ball_centers = [] |
1976 | self.to_translate = 0 | 1983 | self.to_translate = 0 |
1977 | self.init_angle_plh = None | 1984 | self.init_angle_plh = None |
1978 | - | 1985 | + |
1979 | # Instead of calling wx.Dialog.__init__ we precreate the dialog | 1986 | # Instead of calling wx.Dialog.__init__ we precreate the dialog |
1980 | # so we can set an extra style that must be set before | 1987 | # so we can set an extra style that must be set before |
1981 | # creation, and then we create the GUI object using the Create | 1988 | # creation, and then we create the GUI object using the Create |
@@ -2000,40 +2007,40 @@ class ObjectCalibration(wx.Dialog): | @@ -2000,40 +2007,40 @@ class ObjectCalibration(wx.Dialog): | ||
2000 | self.LoadData() | 2007 | self.LoadData() |
2001 | 2008 | ||
2002 | # LINE 1: Janela | 2009 | # LINE 1: Janela |
2003 | - | ||
2004 | - def draw_gui(self): | 2010 | + |
2011 | + def draw_gui(self): | ||
2005 | #style = vtk.vtkInteractorStyleTrackballActor() | 2012 | #style = vtk.vtkInteractorStyleTrackballActor() |
2006 | - | 2013 | + |
2007 | self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) | 2014 | self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) |
2008 | #self.interactor.SetInteractorStyle(style) | 2015 | #self.interactor.SetInteractorStyle(style) |
2009 | self.interactor.Enable(1) | 2016 | self.interactor.Enable(1) |
2010 | self.ren = vtk.vtkRenderer() | 2017 | self.ren = vtk.vtkRenderer() |
2011 | self.interactor.GetRenderWindow().AddRenderer(self.ren) | 2018 | self.interactor.GetRenderWindow().AddRenderer(self.ren) |
2012 | - | 2019 | + |
2013 | # LINE 2: Botoes | 2020 | # LINE 2: Botoes |
2014 | - | 2021 | + |
2015 | marker = wx.Button(self, -1, "Create Marker") | 2022 | marker = wx.Button(self, -1, "Create Marker") |
2016 | marker.Bind(wx.EVT_BUTTON, self.OnCalibrationMarkers) | 2023 | marker.Bind(wx.EVT_BUTTON, self.OnCalibrationMarkers) |
2017 | 2024 | ||
2018 | dc_vtkMatrix = wx.Button(self, -1, "Matrix") | 2025 | dc_vtkMatrix = wx.Button(self, -1, "Matrix") |
2019 | dc_vtkMatrix.Bind(wx.EVT_BUTTON, self.DirectionCosinesTest_vtkmatrix) | 2026 | dc_vtkMatrix.Bind(wx.EVT_BUTTON, self.DirectionCosinesTest_vtkmatrix) |
2020 | - | 2027 | + |
2021 | dc_eulerangles = wx.Button(self, -1, "Euler") | 2028 | dc_eulerangles = wx.Button(self, -1, "Euler") |
2022 | dc_eulerangles.Bind(wx.EVT_BUTTON, self.DirectionCosinesTest_eulerangles) | 2029 | dc_eulerangles.Bind(wx.EVT_BUTTON, self.DirectionCosinesTest_eulerangles) |
2023 | 2030 | ||
2024 | rotate_button = wx.Button(self, -1, "Rotate") | 2031 | rotate_button = wx.Button(self, -1, "Rotate") |
2025 | rotate_button.Bind(wx.EVT_BUTTON, self.rotate) | 2032 | rotate_button.Bind(wx.EVT_BUTTON, self.rotate) |
2026 | - | 2033 | + |
2027 | reset = wx.Button(self, -1, "Reset") | 2034 | reset = wx.Button(self, -1, "Reset") |
2028 | reset.Bind(wx.EVT_BUTTON, self.Reset) | 2035 | reset.Bind(wx.EVT_BUTTON, self.Reset) |
2029 | - | 2036 | + |
2030 | button_neuronavigate = wx.Button(self, -1, "Neuronavigate") | 2037 | button_neuronavigate = wx.Button(self, -1, "Neuronavigate") |
2031 | button_neuronavigate.Bind(wx.EVT_BUTTON, self.Neuronavigate_ToggleButton) | 2038 | button_neuronavigate.Bind(wx.EVT_BUTTON, self.Neuronavigate_ToggleButton) |
2032 | - | 2039 | + |
2033 | ok = wx.Button(self, wx.ID_OK) | 2040 | ok = wx.Button(self, wx.ID_OK) |
2034 | - | 2041 | + |
2035 | cancel = wx.Button(self, wx.ID_CANCEL) | 2042 | cancel = wx.Button(self, wx.ID_CANCEL) |
2036 | - | 2043 | + |
2037 | button_sizer = wx.BoxSizer(wx.HORIZONTAL) | 2044 | button_sizer = wx.BoxSizer(wx.HORIZONTAL) |
2038 | button_sizer.Add(marker) | 2045 | button_sizer.Add(marker) |
2039 | button_sizer.Add(dc_vtkMatrix) | 2046 | button_sizer.Add(dc_vtkMatrix) |
@@ -2052,27 +2059,27 @@ class ObjectCalibration(wx.Dialog): | @@ -2052,27 +2059,27 @@ class ObjectCalibration(wx.Dialog): | ||
2052 | 2059 | ||
2053 | self.SetSizer(sizer) | 2060 | self.SetSizer(sizer) |
2054 | sizer.Fit(self) | 2061 | sizer.Fit(self) |
2055 | - | 2062 | + |
2056 | def LoadData(self): | 2063 | def LoadData(self): |
2057 | coil_reference = vtk.vtkOBJReader() | 2064 | coil_reference = vtk.vtkOBJReader() |
2058 | #coil_reference.SetFileName(os.path.realpath(os.path.join('..', | 2065 | #coil_reference.SetFileName(os.path.realpath(os.path.join('..', |
2059 | # 'models', | 2066 | # 'models', |
2060 | # 'coil_cti_2_scale10.obj'))) | 2067 | # 'coil_cti_2_scale10.obj'))) |
2061 | - | 2068 | + |
2062 | coil_reference.SetFileName('C:\Users\Administrator\Dropbox\Biomag\Renan\coil\coil_cti_2_scale10.obj') | 2069 | coil_reference.SetFileName('C:\Users\Administrator\Dropbox\Biomag\Renan\coil\coil_cti_2_scale10.obj') |
2063 | coilMapper = vtk.vtkPolyDataMapper() | 2070 | coilMapper = vtk.vtkPolyDataMapper() |
2064 | coilMapper.SetInputConnection(coil_reference.GetOutputPort()) | 2071 | coilMapper.SetInputConnection(coil_reference.GetOutputPort()) |
2065 | self.coilActor = vtk.vtkActor() | 2072 | self.coilActor = vtk.vtkActor() |
2066 | #self.coilActor.Scale(10.0, 10.0, 10.0) | 2073 | #self.coilActor.Scale(10.0, 10.0, 10.0) |
2067 | self.coilActor.SetMapper(coilMapper) | 2074 | self.coilActor.SetMapper(coilMapper) |
2068 | - | 2075 | + |
2069 | axes = vtk.vtkAxesActor() | 2076 | axes = vtk.vtkAxesActor() |
2070 | axes.SetShaftTypeToCylinder() | 2077 | axes.SetShaftTypeToCylinder() |
2071 | axes.SetXAxisLabelText("x") | 2078 | axes.SetXAxisLabelText("x") |
2072 | axes.SetYAxisLabelText("y") | 2079 | axes.SetYAxisLabelText("y") |
2073 | axes.SetZAxisLabelText("z") | 2080 | axes.SetZAxisLabelText("z") |
2074 | axes.SetTotalLength(50.0, 50.0, 50.0) | 2081 | axes.SetTotalLength(50.0, 50.0, 50.0) |
2075 | - | 2082 | + |
2076 | self.ren.AddActor(self.coilActor) | 2083 | self.ren.AddActor(self.coilActor) |
2077 | self.ren.AddActor(axes) | 2084 | self.ren.AddActor(axes) |
2078 | 2085 | ||
@@ -2080,8 +2087,8 @@ class ObjectCalibration(wx.Dialog): | @@ -2080,8 +2087,8 @@ class ObjectCalibration(wx.Dialog): | ||
2080 | self.coilActor.RotateX(90) | 2087 | self.coilActor.RotateX(90) |
2081 | self.interactor.Render() | 2088 | self.interactor.Render() |
2082 | print 'Coil orientation', self.coilActor.GetOrientation() | 2089 | print 'Coil orientation', self.coilActor.GetOrientation() |
2083 | - | ||
2084 | - def OnCalibrationMarkers(self, evt): | 2090 | + |
2091 | + def OnCalibrationMarkers(self, evt): | ||
2085 | import data.coordinates as co | 2092 | import data.coordinates as co |
2086 | from numpy import matrix | 2093 | from numpy import matrix |
2087 | Minv = self.nav_prop[0][0] | 2094 | Minv = self.nav_prop[0][0] |
@@ -2092,14 +2099,14 @@ class ObjectCalibration(wx.Dialog): | @@ -2092,14 +2099,14 @@ class ObjectCalibration(wx.Dialog): | ||
2092 | tracker_init = self.nav_prop[1][0] | 2099 | tracker_init = self.nav_prop[1][0] |
2093 | tracker = self.nav_prop[1][1] | 2100 | tracker = self.nav_prop[1][1] |
2094 | tracker_mode = self.nav_prop[1][2] | 2101 | tracker_mode = self.nav_prop[1][2] |
2095 | - | 2102 | + |
2096 | trck = co.Coordinates(tracker_init, tracker, tracker_mode).Returns() | 2103 | trck = co.Coordinates(tracker_init, tracker, tracker_mode).Returns() |
2097 | tracker = matrix([[trck[0]], [trck[1]], [trck[2]]]) | 2104 | tracker = matrix([[trck[0]], [trck[1]], [trck[2]]]) |
2098 | self.init_angle_plh = trck[3], trck[4], trck[5] | 2105 | self.init_angle_plh = trck[3], trck[4], trck[5] |
2099 | img = q1 + (Minv*N)*(tracker - q2) | 2106 | img = q1 + (Minv*N)*(tracker - q2) |
2100 | - coord = float(img[0]), float(img[1]), float(img[2]) | 2107 | + coord = float(img[0]), float(img[1]), float(img[2]) |
2101 | x, y, z = bases.flip_x(coord) | 2108 | x, y, z = bases.flip_x(coord) |
2102 | - | 2109 | + |
2103 | if not self.ball_centers: | 2110 | if not self.ball_centers: |
2104 | self.to_translate = -x, -y, -z | 2111 | self.to_translate = -x, -y, -z |
2105 | 2112 | ||
@@ -2118,46 +2125,46 @@ class ObjectCalibration(wx.Dialog): | @@ -2118,46 +2125,46 @@ class ObjectCalibration(wx.Dialog): | ||
2118 | 2125 | ||
2119 | prop = vtk.vtkProperty() | 2126 | prop = vtk.vtkProperty() |
2120 | prop.SetColor(0,1, 1) | 2127 | prop.SetColor(0,1, 1) |
2121 | - | 2128 | + |
2122 | #adding a new actor for the present ball | 2129 | #adding a new actor for the present ball |
2123 | self.staticballs.append(vtk.vtkActor()) | 2130 | self.staticballs.append(vtk.vtkActor()) |
2124 | - | 2131 | + |
2125 | self.staticballs[self.ball_id].SetMapper(mapper) | 2132 | self.staticballs[self.ball_id].SetMapper(mapper) |
2126 | self.staticballs[self.ball_id].SetProperty(prop) | 2133 | self.staticballs[self.ball_id].SetProperty(prop) |
2127 | - | ||
2128 | - self.ren.AddActor(self.staticballs[self.ball_id]) | 2134 | + |
2135 | + self.ren.AddActor(self.staticballs[self.ball_id]) | ||
2129 | self.ball_id += 1 | 2136 | self.ball_id += 1 |
2130 | - | 2137 | + |
2131 | self.interactor.Render() | 2138 | self.interactor.Render() |
2132 | 2139 | ||
2133 | def DirectionCosinesTest_vtkmatrix(self, evt): | 2140 | def DirectionCosinesTest_vtkmatrix(self, evt): |
2134 | p1, p2, p3 = self.ball_centers[:3] | 2141 | p1, p2, p3 = self.ball_centers[:3] |
2135 | dcm = self.base_creation(p1, p2, p3) | 2142 | dcm = self.base_creation(p1, p2, p3) |
2136 | - | 2143 | + |
2137 | mat4x4 = vtk.vtkMatrix4x4() | 2144 | mat4x4 = vtk.vtkMatrix4x4() |
2138 | mat4x4.DeepCopy(dcm[0][0], dcm[0][1], dcm[0][2], 0.0, | 2145 | mat4x4.DeepCopy(dcm[0][0], dcm[0][1], dcm[0][2], 0.0, |
2139 | dcm[1][0], dcm[1][1], dcm[1][2], 0.0, | 2146 | dcm[1][0], dcm[1][1], dcm[1][2], 0.0, |
2140 | dcm[2][0], dcm[2][1], dcm[2][2], 0.0, | 2147 | dcm[2][0], dcm[2][1], dcm[2][2], 0.0, |
2141 | 0.0, 0.0, 0.0, 1.0) | 2148 | 0.0, 0.0, 0.0, 1.0) |
2142 | - | 2149 | + |
2143 | self.coilActor.SetUserMatrix(mat4x4) | 2150 | self.coilActor.SetUserMatrix(mat4x4) |
2144 | print "\n====================================" | 2151 | print "\n====================================" |
2145 | print "orientation: ", self.coilActor.GetOrientation() | 2152 | print "orientation: ", self.coilActor.GetOrientation() |
2146 | print "====================================\n" | 2153 | print "====================================\n" |
2147 | 2154 | ||
2148 | - | 2155 | + |
2149 | def DirectionCosinesTest_eulerangles(self, evt): | 2156 | def DirectionCosinesTest_eulerangles(self, evt): |
2150 | #p1, p2, p3 = self.ball_centers[:3] | 2157 | #p1, p2, p3 = self.ball_centers[:3] |
2151 | #dcm = self.base_creation(p1, p2, p3) | 2158 | #dcm = self.base_creation(p1, p2, p3) |
2152 | 2159 | ||
2153 | dcm = self.nav_prop[0][1] | 2160 | dcm = self.nav_prop[0][1] |
2154 | - | 2161 | + |
2155 | # site http://met.fzu.edu.cn/cai/Matlab6.5/help/toolbox/aeroblks/directioncosinematrixtoeulerangles.html | 2162 | # site http://met.fzu.edu.cn/cai/Matlab6.5/help/toolbox/aeroblks/directioncosinematrixtoeulerangles.html |
2156 | theta = np.rad2deg(-np.arcsin(dcm[0][2])) | 2163 | theta = np.rad2deg(-np.arcsin(dcm[0][2])) |
2157 | phi = np.rad2deg(np.arctan(dcm[1][2]/dcm[2][2])) | 2164 | phi = np.rad2deg(np.arctan(dcm[1][2]/dcm[2][2])) |
2158 | psi = np.rad2deg(np.arctan(dcm[0][1]/dcm[0][0])) | 2165 | psi = np.rad2deg(np.arctan(dcm[0][1]/dcm[0][0])) |
2159 | 2166 | ||
2160 | - self.coilActor.RotateWXYZ(psi, 0, 0, 1) | 2167 | + self.coilActor.RotateWXYZ(psi, 0, 0, 1) |
2161 | self.coilActor.RotateWXYZ(phi, 1, 0, 0) | 2168 | self.coilActor.RotateWXYZ(phi, 1, 0, 0) |
2162 | self.coilActor.RotateWXYZ(theta, 0, 1, 0) | 2169 | self.coilActor.RotateWXYZ(theta, 0, 1, 0) |
2163 | self.interactor.Render() | 2170 | self.interactor.Render() |
@@ -2167,8 +2174,8 @@ class ObjectCalibration(wx.Dialog): | @@ -2167,8 +2174,8 @@ class ObjectCalibration(wx.Dialog): | ||
2167 | print "orientation: ", self.coilActor.GetOrientation() | 2174 | print "orientation: ", self.coilActor.GetOrientation() |
2168 | print "====================================\n" | 2175 | print "====================================\n" |
2169 | 2176 | ||
2170 | - | ||
2171 | - | 2177 | + |
2178 | + | ||
2172 | def Reset(self, evt): | 2179 | def Reset(self, evt): |
2173 | self.ball_centers = [] | 2180 | self.ball_centers = [] |
2174 | self.ball_id = 0 | 2181 | self.ball_id = 0 |
@@ -2178,7 +2185,7 @@ class ObjectCalibration(wx.Dialog): | @@ -2178,7 +2185,7 @@ class ObjectCalibration(wx.Dialog): | ||
2178 | for i in range(0, len(self.staticballs)): | 2185 | for i in range(0, len(self.staticballs)): |
2179 | self.ren.RemoveActor(self.staticballs[i]) | 2186 | self.ren.RemoveActor(self.staticballs[i]) |
2180 | self.staticballs = [] | 2187 | self.staticballs = [] |
2181 | - | 2188 | + |
2182 | def Neuronavigate_ToggleButton(self, evt): | 2189 | def Neuronavigate_ToggleButton(self, evt): |
2183 | p0, p1, p2 = self.ball_centers[:3] | 2190 | p0, p1, p2 = self.ball_centers[:3] |
2184 | m = self.base_creation(p0, p1, p2) | 2191 | m = self.base_creation(p0, p1, p2) |
@@ -2192,17 +2199,17 @@ class ObjectCalibration(wx.Dialog): | @@ -2192,17 +2199,17 @@ class ObjectCalibration(wx.Dialog): | ||
2192 | #vm.SetElement(0, 1, m[0, 1]) | 2199 | #vm.SetElement(0, 1, m[0, 1]) |
2193 | #vm.SetElement(0, 2, m[0, 2]) | 2200 | #vm.SetElement(0, 2, m[0, 2]) |
2194 | #vm.SetElement(0, 3, 0 ) | 2201 | #vm.SetElement(0, 3, 0 ) |
2195 | - | 2202 | + |
2196 | #vm.SetElement(1, 0, m[1, 0]) | 2203 | #vm.SetElement(1, 0, m[1, 0]) |
2197 | #vm.SetElement(1, 1, m[1, 1]) | 2204 | #vm.SetElement(1, 1, m[1, 1]) |
2198 | #vm.SetElement(1, 2, m[1, 2]) | 2205 | #vm.SetElement(1, 2, m[1, 2]) |
2199 | #vm.SetElement(1, 3, 0 ) | 2206 | #vm.SetElement(1, 3, 0 ) |
2200 | - | 2207 | + |
2201 | #vm.SetElement(2, 0, m[2, 0]) | 2208 | #vm.SetElement(2, 0, m[2, 0]) |
2202 | #vm.SetElement(2, 1, m[2, 1]) | 2209 | #vm.SetElement(2, 1, m[2, 1]) |
2203 | #vm.SetElement(2, 2, m[2, 2]) | 2210 | #vm.SetElement(2, 2, m[2, 2]) |
2204 | #vm.SetElement(2, 3, 0 ) | 2211 | #vm.SetElement(2, 3, 0 ) |
2205 | - | 2212 | + |
2206 | #vm.SetElement(3, 0, 0 ) | 2213 | #vm.SetElement(3, 0, 0 ) |
2207 | #vm.SetElement(3, 1, 0 ) | 2214 | #vm.SetElement(3, 1, 0 ) |
2208 | #vm.SetElement(3, 2, 0 ) | 2215 | #vm.SetElement(3, 2, 0 ) |
@@ -2219,7 +2226,7 @@ class ObjectCalibration(wx.Dialog): | @@ -2219,7 +2226,7 @@ class ObjectCalibration(wx.Dialog): | ||
2219 | print "Angulos", gama, beta, alpha | 2226 | print "Angulos", gama, beta, alpha |
2220 | 2227 | ||
2221 | self.coilActor.RotateWXYZ(alpha, 0, 1, 0) | 2228 | self.coilActor.RotateWXYZ(alpha, 0, 1, 0) |
2222 | - self.coilActor.RotateWXYZ(beta, 1, 0, 0) | 2229 | + self.coilActor.RotateWXYZ(beta, 1, 0, 0) |
2223 | self.coilActor.RotateWXYZ(gama, 0, 0, 1) | 2230 | self.coilActor.RotateWXYZ(gama, 0, 0, 1) |
2224 | self.interactor.Render() | 2231 | self.interactor.Render() |
2225 | 2232 | ||
@@ -2230,13 +2237,13 @@ class ObjectCalibration(wx.Dialog): | @@ -2230,13 +2237,13 @@ class ObjectCalibration(wx.Dialog): | ||
2230 | p1, p2, p3 = self.ball_centers[presize:size] | 2237 | p1, p2, p3 = self.ball_centers[presize:size] |
2231 | M, q1, Minv = db.base_creation(p1, p2, p3) | 2238 | M, q1, Minv = db.base_creation(p1, p2, p3) |
2232 | inits_angles = self.coilActor.GetOrientation(), self.init_angle_plh, M | 2239 | inits_angles = self.coilActor.GetOrientation(), self.init_angle_plh, M |
2233 | - | 2240 | + |
2234 | coil_top = self.ball_centers[len(self.ball_centers)-1] | 2241 | coil_top = self.ball_centers[len(self.ball_centers)-1] |
2235 | coil_bottom = self.ball_centers[len(self.ball_centers)-2] | 2242 | coil_bottom = self.ball_centers[len(self.ball_centers)-2] |
2236 | coil_axis = np.matrix(coil_bottom[0:3]).reshape(3, 1),np.matrix(coil_top[0:3]).reshape(3, 1) | 2243 | coil_axis = np.matrix(coil_bottom[0:3]).reshape(3, 1),np.matrix(coil_top[0:3]).reshape(3, 1) |
2237 | - | 2244 | + |
2238 | return inits_angles, coil_axis | 2245 | return inits_angles, coil_axis |
2239 | -#=============================================================================== | 2246 | +#=============================================================================== |
2240 | #=============================================================================== | 2247 | #=============================================================================== |
2241 | 2248 | ||
2242 | class SurfaceDialog(wx.Dialog): | 2249 | class SurfaceDialog(wx.Dialog): |
@@ -2349,7 +2356,7 @@ class SurfaceCreationOptionsPanel(wx.Panel): | @@ -2349,7 +2356,7 @@ class SurfaceCreationOptionsPanel(wx.Panel): | ||
2349 | import constants as const | 2356 | import constants as const |
2350 | import data.surface as surface | 2357 | import data.surface as surface |
2351 | import project as prj | 2358 | import project as prj |
2352 | - | 2359 | + |
2353 | wx.Panel.__init__(self, parent, ID) | 2360 | wx.Panel.__init__(self, parent, ID) |
2354 | 2361 | ||
2355 | # LINE 1: Surface name | 2362 | # LINE 1: Surface name |
@@ -2456,7 +2463,7 @@ class CAOptions(wx.Panel): | @@ -2456,7 +2463,7 @@ class CAOptions(wx.Panel): | ||
2456 | def __init__(self, parent): | 2463 | def __init__(self, parent): |
2457 | wx.Panel.__init__(self, parent, -1) | 2464 | wx.Panel.__init__(self, parent, -1) |
2458 | self._build_widgets() | 2465 | self._build_widgets() |
2459 | - | 2466 | + |
2460 | def _build_widgets(self): | 2467 | def _build_widgets(self): |
2461 | sb = wx.StaticBox(self, -1, _('Options')) | 2468 | sb = wx.StaticBox(self, -1, _('Options')) |
2462 | self.angle = floatspin.FloatSpin(self, -1, value=0.7, min_val=0.0, | 2469 | self.angle = floatspin.FloatSpin(self, -1, value=0.7, min_val=0.0, |
@@ -2470,7 +2477,7 @@ class CAOptions(wx.Panel): | @@ -2470,7 +2477,7 @@ class CAOptions(wx.Panel): | ||
2470 | self.min_weight = floatspin.FloatSpin(self, -1, value=0.2, min_val=0.0, | 2477 | self.min_weight = floatspin.FloatSpin(self, -1, value=0.2, min_val=0.0, |
2471 | max_val=1.0, increment=0.1, | 2478 | max_val=1.0, increment=0.1, |
2472 | digits=1) | 2479 | digits=1) |
2473 | - | 2480 | + |
2474 | self.steps = wx.SpinCtrl(self, -1, value='10', min=1, max=100) | 2481 | self.steps = wx.SpinCtrl(self, -1, value='10', min=1, max=100) |
2475 | 2482 | ||
2476 | layout_sizer = wx.FlexGridSizer(rows=4, cols=2, hgap=5, vgap=5) | 2483 | layout_sizer = wx.FlexGridSizer(rows=4, cols=2, hgap=5, vgap=5) |
@@ -2533,7 +2540,7 @@ class SurfaceMethodPanel(wx.Panel): | @@ -2533,7 +2540,7 @@ class SurfaceMethodPanel(wx.Panel): | ||
2533 | self.SetSizer(self.main_sizer) | 2540 | self.SetSizer(self.main_sizer) |
2534 | self.Layout() | 2541 | self.Layout() |
2535 | self.Fit() | 2542 | self.Fit() |
2536 | - | 2543 | + |
2537 | if self.mask_edited: | 2544 | if self.mask_edited: |
2538 | self.cb_types.SetValue(_(u'Context aware smoothing')) | 2545 | self.cb_types.SetValue(_(u'Context aware smoothing')) |
2539 | self.ca_options.Enable() | 2546 | self.ca_options.Enable() |
@@ -2572,9 +2579,9 @@ class SurfaceMethodPanel(wx.Panel): | @@ -2572,9 +2579,9 @@ class SurfaceMethodPanel(wx.Panel): | ||
2572 | algorithm = self.GetAlgorithmSelected() | 2579 | algorithm = self.GetAlgorithmSelected() |
2573 | options = self.GetOptions() | 2580 | options = self.GetOptions() |
2574 | 2581 | ||
2575 | - return {"algorithm": algorithm, | 2582 | + return {"algorithm": algorithm, |
2576 | "options": options} | 2583 | "options": options} |
2577 | - | 2584 | + |
2578 | def ReloadMethodsOptions(self): | 2585 | def ReloadMethodsOptions(self): |
2579 | self.cb_types.Clear() | 2586 | self.cb_types.Clear() |
2580 | self.cb_types.AppendItems([i for i in sorted(self.alg_types) | 2587 | self.cb_types.AppendItems([i for i in sorted(self.alg_types) |
invesalius/gui/task_navigator.py
@@ -492,25 +492,27 @@ class NeuronavigationTools(wx.Panel): | @@ -492,25 +492,27 @@ class NeuronavigationTools(wx.Panel): | ||
492 | def OnChoiceTracker(self, evt): | 492 | def OnChoiceTracker(self, evt): |
493 | trck_id = evt.GetSelection() | 493 | trck_id = evt.GetSelection() |
494 | 494 | ||
495 | - dco.Tracker(trck_id) | ||
496 | - if self.tracker_id == 0: | ||
497 | - self.trk_init = dtrk.Tracker_Init().PolhemusISO_init() | ||
498 | - print self.trk_init | ||
499 | - | ||
500 | - elif self.tracker_id == 1: | ||
501 | - self.trk_init = dtrk.Tracker_Init().Polhemus_init() | ||
502 | - print self.trk_init | ||
503 | - | ||
504 | - elif self.tracker_id == 2: | ||
505 | - #review this close command: when for example | ||
506 | - #you jump from MTC to Zebris, it will try | ||
507 | - #to close the MTC, but it doesnt have a close attribute | ||
508 | - #self.trk_init.close() | ||
509 | - self.trk_init = dtrk.Tracker_Init().Claron_init() | ||
510 | - print self.trk_init | ||
511 | - elif self.tracker_id == 3: | ||
512 | - self.trk_init = dtrk.Tracker_Init().Zebris_init() | ||
513 | - print self.trk_init | 495 | + # self.trk_init = dco.Tracker().ReturnTracker(trck_id) |
496 | + self.trk_init = dco.Tracker(trck_id) | ||
497 | + | ||
498 | + # if self.tracker_id == 0: | ||
499 | + # self.trk_init = dtrk.Tracker_Init().PolhemusISO_init() | ||
500 | + # print self.trk_init | ||
501 | + # | ||
502 | + # elif self.tracker_id == 1: | ||
503 | + # self.trk_init = dtrk.Tracker_Init().Polhemus_init() | ||
504 | + # print self.trk_init | ||
505 | + # | ||
506 | + # elif self.tracker_id == 2: | ||
507 | + # #review this close command: when for example | ||
508 | + # #you jump from MTC to Zebris, it will try | ||
509 | + # #to close the MTC, but it doesnt have a close attribute | ||
510 | + # #self.trk_init.close() | ||
511 | + # self.trk_init = dtrk.Tracker_Init().Claron_init() | ||
512 | + # print self.trk_init | ||
513 | + # elif self.tracker_id == 3: | ||
514 | + # self.trk_init = dtrk.Tracker_Init().Zebris_init() | ||
515 | + # print self.trk_init | ||
514 | 516 | ||
515 | print "Tracker changed!" | 517 | print "Tracker changed!" |
516 | 518 |