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