diff --git a/invesalius/.idea/workspace.xml b/invesalius/.idea/workspace.xml index 943b14d..64ebd29 100644 --- a/invesalius/.idea/workspace.xml +++ b/invesalius/.idea/workspace.xml @@ -2,10 +2,10 @@ - + - + @@ -30,13 +30,38 @@ - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -45,8 +70,8 @@ - - + + @@ -55,7 +80,7 @@ - + @@ -117,29 +142,6 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -150,9 +152,11 @@ @@ -160,10 +164,8 @@ true - @@ -207,13 +209,27 @@ - + @@ -449,19 +465,19 @@ - + - + - + - + @@ -498,8 +514,18 @@ 19 @@ -509,7 +535,8 @@ - + + @@ -588,8 +615,8 @@ - - + + @@ -599,7 +626,8 @@ - + + @@ -644,8 +672,8 @@ - - + + @@ -655,7 +683,8 @@ - + + @@ -689,8 +718,8 @@ - - + + @@ -700,7 +729,8 @@ - + + @@ -718,8 +748,8 @@ - - + + @@ -729,7 +759,8 @@ - + + @@ -747,8 +778,8 @@ - - + + @@ -794,8 +825,8 @@ - - + + @@ -854,8 +885,8 @@ - - + + @@ -870,10 +901,31 @@ - - + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/invesalius/data/coordinates.py b/invesalius/data/coordinates.py index 156319f..7b82da2 100644 --- a/invesalius/data/coordinates.py +++ b/invesalius/data/coordinates.py @@ -1,59 +1,60 @@ -import sys -import serial -import usb.core -import usb.util -import wx + import numpy as np from wx.lib.pubsub import pub as Publisher import gui.dialogs as dlg -try: - import ClaronTracker as mct -except ImportError: - print 'The ClaronTracker library is not installed' - class Tracker: def __init__(self, trck_id): - self.trck_init = None - print "This is the tracker selected!" + trck = {0 : self.ClaronTracker, + 1 : self.PlhFastrak, + 2 : self.PlhIsotrakII, + 3 : self.PlhPatriot, + 4 : self.ZebrisCMS20} - if trck_id == 0: - trck_init = self.ClaronTracker() - elif trck_id == 1: - trck_init = self.PlhFastrak() - elif trck_id == 2: - trck_init = self.PlhIsotrakII() - elif trck_id == 3: - trck_init = self.PlhPatriot() - elif trck_id == 4: - trck_init = self.ZebrisCMS20() - - self.trck_init = trck_init + self.ReturnTracker(trck, trck_id) def ClaronTracker(self): - print "CLARON" + try: + import ClaronTracker as mct + except ImportError: + print 'The ClaronTracker library is not installed' + + print "CLARON func" return 0 def PlhFastrak(self): - print "FASTRAK" + import serial + print "FASTRAK func" return 1 def PlhIsotrakII(self): - print "ISOTRAKII" + import serial + print "ISOTRAKII func" return 2 def PlhPatriot(self): - print "PATRIOT" + import sys + + import serial + import usb.core + import usb.util + + print "PATRIOT func" return 3 def ZebrisCMS20(self): - print "ZEBRIS" + print "ZEBRIS func" return 4 + def ReturnTracker(self, trck, trck_id): + print "Returning" + print "This is the tracker selected!", trck_id + return trck[trck_id]() + class Coordinates: def __init__(self, trck_init, trck, ref_mode): @@ -83,7 +84,7 @@ class Coordinates: def __update_status_MTC(self, pubsub_evt): - self.MTC_status = pubsub_evt.data + self.MTC_status = pubsub_evt.data def __update_points_MTC(self, pubsub_evt): self.coordTT = pubsub_evt.data diff --git a/invesalius/data/trackers.py b/invesalius/data/trackers.py index 3d2a2da..6b5d0fd 100644 --- a/invesalius/data/trackers.py +++ b/invesalius/data/trackers.py @@ -6,6 +6,128 @@ import sys import gui.dialogs as dlg +class Tracker: + def __init__(self, trck_id): + """Initialize spatial trackers for neuronavigation + + :param trck_id: identifier of spatial tracker + :return: initialization variable + """ + + trck = {0 : self.ClaronTracker, + 1 : self.PlhFastrak, + 2 : self.PlhIsotrakII, + 3 : self.PlhPatriot, + 4 : self.ZebrisCMS20} + + self.ReturnTracker(trck, trck_id) + + def ClaronTracker(self): + trck_init = None + + try: + import ClaronTracker + + trck_init = ClaronTracker.ClaronTracker() + trck_init.CalibrationDir = "C:\CalibrationFiles" + trck_init.MarkerDir = "C:\Markers" + trck_init.NumberFramesProcessed = 10 + trck_init.FramesExtrapolated = 0 + trck_init.Initialize() + + if trck_init.GetIdentifyingCamera(): + print "MicronTracker camera identified." + trck_init.Run() + else: + dlg.TrackerNotConnected(0) + + except ImportError: + dlg.TrackerNotConnected(5) + + return trck_init + + def PlhFastrak(self): + trck_init = self.polhemus_serial(1) + + return trck_init + + def PlhIsotrakII(self): + trck_init = self.polhemus_serial(2) + + return trck_init + + def PlhPatriot(self): + trck_init = None + + try: + import sys + + import usb.core as uc + # import usb.util as uu + + trck_init = uc.find(idVendor=0x0F44, idProduct=0xEF12) + + if not trck_init: + print 'Could not find Polhemus PATRIOT USB. Trying Polhemus ' \ + 'serial connection...' + + trck_init = self.polhemus_serial(3) + + else: + try: + cfg = trck_init.get_active_configuration() + for i in cfg: + for x in i: + # TODO: try better code + x = x + trck_init.set_configuration() + + except uc.USBError as err: + dlg.TrackerNotConnected(3) + print 'Could not set configuration %s' % err + + except ImportError: + print 'Import Error for Polhemus PATRIOT USB.' + trck_init = self.polhemus_serial(3) + + return trck_init + + def ZebrisCMS20(self): + + dlg.TrackerNotConnected(4) + print 'Zebris device not found.' + + return None + + def polhemus_serial(self, plh_id): + trck_init = None + + try: + import serial + + try: + trck_init = serial.Serial(0, baudrate=115200, timeout=0.2) + trck_init.write('P') + data = trck_init.readlines() + + if not data: + dlg.TrackerNotConnected(plh_id) + + except serial.SerialException: + dlg.TrackerNotConnected(6) + + except ImportError: + dlg.TrackerNotConnected(5) + + return trck_init + + def ReturnTracker(self, trck, trck_id): + + print "Returning" + print "This is the tracker selected!", trck_id + + return trck[trck_id]() + class Tracker_Init: def PolhemusISO_init(self): try: @@ -14,7 +136,7 @@ class Tracker_Init: except: dlg.TrackerNotConnected(1) - raise ValueError('Device not found') + raise ValueError('Device not found') def Polhemus_init(self): dev = usb.core.find(idVendor=0x0F44, idProduct=0xEF12) diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index ea83afe..2efb8e3 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -106,7 +106,7 @@ class ResizeImageDialog(wx.Dialog): pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE) self.PostCreate(pre) - + 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.")) icon = wx.ArtProvider.GetBitmap(wx.ART_WARNING, wx.ART_MESSAGE_BOX, (32,32)) bmp = wx.StaticBitmap(self, -1, icon) @@ -145,7 +145,7 @@ class ResizeImageDialog(wx.Dialog): sizer_general.Fit(self) self.Layout() self.Centre() - + def SetValue(self, value): self.num_ctrl_porcent.SetValue(value) @@ -406,7 +406,7 @@ def ShowLoadMarkersDialog(): dlg = wx.FileDialog(None, message=_("Load markers"), defaultDir="", - defaultFile="", + defaultFile="", style=wx.OPEN|wx.CHANGE_DIR) # inv3 filter is default @@ -632,7 +632,7 @@ def SurfaceSelectionRequiredForDuplication(): wx.ICON_INFORMATION | wx.OK) dlg.ShowModal() dlg.Destroy() - + #=========aji====================================================================== def InvalidReferences(): msg = _("The references are not set.") @@ -644,28 +644,35 @@ def InvalidReferences(): wx.ICON_INFORMATION | wx.OK) dlg.ShowModal() dlg.Destroy() - -#Dialog for advertising if the tracker is not connetcted -def TrackerNotConnected(tracker): - msg = None - if tracker == 0: - msg = _("The PolhemusISO selected is not connected.") - elif tracker == 1: - msg = _("The Polhemus selected is not connected.") - elif tracker == 2: - msg = _("The Claron MTC is not connected.") - elif tracker == 3: - msg = _("The Zebris is not connected.") - + + +def TrackerNotConnected(trck_id): + """Spatial Tracker connection error + + """ + trck = {0 : 'Claron MicronTracker', + 1 : 'Polhemus FASTRAK', + 2 : 'Polhemus ISOTRAK II', + 3 : 'Polhemus PATRIOT', + 4 : 'Zebris CMS20'} + + if trck_id < 5: + msg = trck[trck_id] + ' is not connected.' + elif trck_id == 5: + msg = 'The library for specified tracker is not installed.' + elif trck_id == 6: + msg = 'The tracker connection is already set.' + if sys.platform == 'darwin': dlg = wx.MessageDialog(None, "", msg, wx.ICON_INFORMATION | wx.OK) else: dlg = wx.MessageDialog(None, msg, "InVesalius 3 - Neuronavigator", wx.ICON_INFORMATION | wx.OK) + dlg.ShowModal() dlg.Destroy() - + def InvalidTxt(): msg = _("The TXT file is invalid.") if sys.platform == 'darwin': @@ -676,7 +683,7 @@ def InvalidTxt(): wx.ICON_INFORMATION | wx.OK) dlg.ShowModal() dlg.Destroy() - + def error_correg_fine(): msg = _("There aren't any created surface.") if sys.platform == 'darwin': @@ -686,9 +693,9 @@ def error_correg_fine(): dlg = wx.MessageDialog(None, msg, "InVesalius 3", wx.ICON_INFORMATION | wx.OK) dlg.ShowModal() - dlg.Destroy() + dlg.Destroy() #=============================================================================== - + class NewMask(wx.Dialog): def __init__(self, parent=None, @@ -758,7 +765,7 @@ class NewMask(wx.Dialog): thresh_min, thresh_max = project.threshold_modes[_("Bone")] original_colour = random.choice(const.MASK_COLOUR) self.colour = original_colour - colour = [255*i for i in original_colour] + colour = [255*i for i in original_colour] colour.append(100) gradient = grad.GradientSlider(self, -1, int(bound_min), int(bound_max), @@ -820,7 +827,7 @@ class NewMask(wx.Dialog): proj = prj.Project() if thresh in proj.threshold_modes.values(): preset_name = proj.threshold_modes.get_key(thresh)[0] - index = self.thresh_list.index(preset_name) + index = self.thresh_list.index(preset_name) self.combo_thresh.SetSelection(index) else: index = self.thresh_list.index(_("Custom")) @@ -1134,14 +1141,14 @@ def ExportPicture(type_=""): return filename, filetype else: return () - + #=======aji======================================================================== #=============================================================================== class FineCalibration(wx.Window): def __init__(self, parent=None, ID=-1, title="Fine Calibration", size=wx.DefaultSize, pos=wx.DefaultPosition, useMetal=False): - + self.correg = None self.staticballs = [] self.ball_id = 0 @@ -1153,7 +1160,7 @@ class FineCalibration(wx.Window): # initial parameters self.actor_head_init = None self.actor_cloud = None - + # actors parameters self.color_head_init = 1.0, 0.0, 0.0 self.color_cloud = 0.0, 1.0, 0.0 @@ -1162,7 +1169,7 @@ class FineCalibration(wx.Window): self.opacity_cloud = 0.7 self.opacity_head_icp = 1.0 ################ - + # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI object using the Create @@ -1173,46 +1180,46 @@ class FineCalibration(wx.Window): self.pre.SetBackgroundColour('LIGHT GRAY') self.pre.CenterOnScreen() self.pre.Show() - - + + #pre.Create(parent, ID, title, pos, (500,300)) - + # This next step is the most important, it turns this Python # object into the real wrapper of the dialog (instead of pre) # as far as the wxPython extension is concerned. self.PostCreate(self.pre) - - - + + + # This extra style can be set after the UI object has been created. if 'wxMac' in wx.PlatformInfo and useMetal: self.SetExtraStyle(wx.DIALOG_EX_METAL) - + self.Center() self.__bind_events() self.draw_gui() - - + + # try: Publisher.sendMessage('Load surface into DLG') # except: # try: # Publisher.sendMessage('Load volume DLG') # except: -# error_correg_fine() - +# error_correg_fine() + #self.LoadData() def ShowLoadSurfaceDialog(self): current_dir = os.path.abspath(".") - + dlg = wx.FileDialog(None, message=_("Load surface"), defaultDir="", - defaultFile="", + defaultFile="", style=wx.OPEN|wx.CHANGE_DIR) - + # inv3 filter is default dlg.SetFilterIndex(0) - + # Show the dialog and retrieve the user response. If it is the OK response, # process the data. filepath = None @@ -1222,21 +1229,21 @@ class FineCalibration(wx.Window): filepath = dlg.GetPath() except(wx._core.PyAssertionError): #FIX: win64 filepath = dlg.GetPath() - + # Destroy the dialog. Don't do this until you are done with it! # BAD things can happen otherwise! dlg.Destroy() os.chdir(current_dir) return filepath - + def __bind_events(self): Publisher.subscribe(self.LoadVolumeDLG, 'Load Raycasting into DLG') Publisher.subscribe(self.LoadActorDLG, 'Load surface actor into DLG') # LINE 1: Janela - - def draw_gui(self): + + def draw_gui(self): #style = vtk.vtkInteractorStyleTrackballActor() self.panel=wx.Panel(self) self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) @@ -1244,140 +1251,140 @@ class FineCalibration(wx.Window): self.interactor.Enable(1) self.ren = vtk.vtkRenderer() self.interactor.GetRenderWindow().AddRenderer(self.ren) - + # LINE 2: Botoes - + marker = wx.Button(self.panel, -1, "Create Marker",size = wx.Size(85,23)) marker.Bind(wx.EVT_BUTTON, self.OnCalibrationMarkers) - + marker_load = wx.Button(self.panel, -1, "Load Marker",size = wx.Size(85,23)) marker_load.Bind(wx.EVT_BUTTON, self.OnLoadMarkers) - + apply_ICP = wx.Button(self.panel, -1, "Apply ICP",size = wx.Size(85,23)) apply_ICP.Bind(wx.EVT_BUTTON, self.OnApplyICP) - + self.showObjICP = wx.CheckBox(self.panel, -1, 'Show ICP Surface', (100, 10)) self.showObjICP.SetValue(False) - wx.EVT_CHECKBOX(self, self.showObjICP.GetId(), self.ShowObjectICP) - + wx.EVT_CHECKBOX(self, self.showObjICP.GetId(), self.ShowObjectICP) + self.showObjCloud = wx.CheckBox(self.panel, -1, 'Show Cloud of Points', (100, 10)) self.showObjCloud.SetValue(True) - wx.EVT_CHECKBOX(self, self.showObjCloud.GetId(), self.ShowObjectCloud) - + wx.EVT_CHECKBOX(self, self.showObjCloud.GetId(), self.ShowObjectCloud) + self.showObjHead = wx.CheckBox(self.panel, -1, 'Show Head Surface', (100, 10)) self.showObjHead.SetValue(True) - wx.EVT_CHECKBOX(self, self.showObjHead.GetId(), self.ShowObjectHead) - - text_X = wx.StaticText(self.panel, -1, _("X:")) + wx.EVT_CHECKBOX(self, self.showObjHead.GetId(), self.ShowObjectHead) + + text_X = wx.StaticText(self.panel, -1, _("X:")) spin_X = wx.SpinCtrl(self.panel, -1, "X", size = wx.Size(67,23)) spin_X .SetValue(0) spin_X.Bind(wx.EVT_SPINCTRL, self.translate_rotate) spin_X.Bind(wx.EVT_TEXT, self.translate_rotate) spin_X .SetRange(-500,500) - - self.spin_X = spin_X - - text_Y = wx.StaticText(self.panel, -1, _("Y:")) + + self.spin_X = spin_X + + text_Y = wx.StaticText(self.panel, -1, _("Y:")) spin_Y = wx.SpinCtrl(self.panel, -1, "Y", size = wx.Size(67,23)) spin_Y .SetValue(0) spin_Y.Bind(wx.EVT_SPINCTRL, self.translate_rotate) spin_Y.Bind(wx.EVT_TEXT, self.translate_rotate) spin_Y .SetRange(-500,500) - - self.spin_Y = spin_Y - - text_Z = wx.StaticText(self.panel, -1, _("Z:")) + + self.spin_Y = spin_Y + + text_Z = wx.StaticText(self.panel, -1, _("Z:")) spin_Z = wx.SpinCtrl(self.panel, -1, "Z", size = wx.Size(67,23)) spin_Z .SetValue(0) spin_Z.Bind(wx.EVT_SPINCTRL, self.translate_rotate) spin_Z.Bind(wx.EVT_TEXT, self.translate_rotate) spin_Z .SetRange(-500,500) - - self.spin_Z = spin_Z - - text_A = wx.StaticText(self.panel,-1, _("Alfa:")) + + self.spin_Z = spin_Z + + text_A = wx.StaticText(self.panel,-1, _("Alfa:")) spin_A = wx.SpinCtrl(self.panel, -1, "Alfa", size = wx.Size(67,23)) spin_A .SetValue(0) spin_A .SetRange(-500,500) spin_A.Bind(wx.EVT_SPINCTRL, self.translate_rotate) spin_A.Bind(wx.EVT_TEXT, self.translate_rotate) - - self.spin_A = spin_A - - text_B = wx.StaticText(self.panel, -1, _("Beta:")) + + self.spin_A = spin_A + + text_B = wx.StaticText(self.panel, -1, _("Beta:")) spin_B = wx.SpinCtrl(self.panel, -1, "Beta", size = wx.Size(67,23)) spin_B .SetValue(0) spin_B .SetRange(-500,500) spin_B.Bind(wx.EVT_SPINCTRL, self.translate_rotate) spin_B.Bind(wx.EVT_TEXT, self.translate_rotate) - - self.spin_B = spin_B - - text_G = wx.StaticText(self.panel, -1, _("Gama:")) + + self.spin_B = spin_B + + text_G = wx.StaticText(self.panel, -1, _("Gama:")) spin_G = wx.SpinCtrl(self.panel, -1, "Gama", size = wx.Size(67,23)) spin_G .SetValue(0) spin_G .SetRange(-500,500) spin_G.Bind(wx.EVT_SPINCTRL, self.translate_rotate) spin_G.Bind(wx.EVT_TEXT, self.translate_rotate) - + self.spin_G = spin_G - - text_inter = wx.StaticText(self.panel, -1, _("Number of Iterations:")) + + text_inter = wx.StaticText(self.panel, -1, _("Number of Iterations:")) spin_inter = wx.SpinCtrl(self.panel, -1, "Numb Inter", size = wx.Size(95,23)) spin_inter.SetValue(1000) spin_inter.SetRange(0,5000) # spin_X .SetValue() self.spin_inter = spin_inter - - text_land = wx.StaticText(self.panel, -1, _("Number of Landmarks:")) + + text_land = wx.StaticText(self.panel, -1, _("Number of Landmarks:")) spin_land = wx.SpinCtrl(self.panel, -1, "Landmarks", size = wx.Size(95,23)) spin_land.SetValue(1000) spin_land .SetRange(0,5000) - + # spin_Y .SetValue() - self.spin_land = spin_land - - text_mean = wx.StaticText(self.panel, -1, _("Max Mean Distance:")) + self.spin_land = spin_land + + text_mean = wx.StaticText(self.panel, -1, _("Max Mean Distance:")) #spin_mean= wx.SpinCtrl(self.panel, 1, "mean", size = wx.Size(107,23)) spin_mean = floatspin.FloatSpin(self.panel,-1,value=0.01, min_val=0.0,max_val=10.0, increment=0.01, digits=2) - + #spin_mean.SetValue(0.01) #spin_mean .SetRange(0,10) -# spin_Z .SetValue() - self.spin_mean = spin_mean - +# spin_Z .SetValue() + self.spin_mean = spin_mean + spinicp = wx.FlexGridSizer(rows=3, cols=2, hgap=1, vgap=1) spinicp.AddMany([(text_inter,0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_inter, 1), (text_land,0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_land, 1), - (text_mean,0, wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_mean, 1)]) - + (text_mean,0, wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5),(spin_mean, 1)]) + spin = wx.FlexGridSizer(rows=3, cols=4, hgap=1, vgap=1) 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), (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), - (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)]) - + (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)]) + ok = wx.Button(self.panel, wx.ID_OK) ok.Bind(wx.EVT_BUTTON, self.OK) cancel = wx.Button(self.panel,wx.ID_CANCEL) cancel.Bind(wx.EVT_BUTTON, self.CANCEL) - + checkb = wx.FlexGridSizer(rows=3, cols=1, hgap=1, vgap=1) checkb.AddMany([(self.showObjICP , 0,wx.ALIGN_TOP|wx.EXPAND | wx.TOP|wx.BOTTOM,5), (self.showObjHead , 0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND | wx.TOP|wx.BOTTOM,5), (self.showObjCloud , 0,wx.ALIGN_BOTTOM|wx.EXPAND | wx.TOP|wx.BOTTOM,5)]) - + col1 = wx.FlexGridSizer(rows=3, cols=1, hgap=1, vgap=1) col1.AddMany([(marker, 1), (marker_load, 1), (apply_ICP, 1)]) - + # col2 = wx.FlexGridSizer(rows=1, cols=1, hgap=1, vgap=1) # col2.AddMany([(param_ICP, 1)]) -# +# col4 = wx.FlexGridSizer(rows=2, cols=1, hgap=1, vgap=1) col4.AddMany([(ok, 1), (cancel, 1)]) - + button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer.Add(col1,0,wx.EXPAND | wx.ALL,10) button_sizer.Add(checkb,0,wx.EXPAND | wx.ALL,10) @@ -1390,83 +1397,83 @@ class FineCalibration(wx.Window): sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.interactor, 5, wx.EXPAND,10) sizer.Add(self.panel, 1,wx.ALIGN_CENTER,1) - + self.SetSizerAndFit(sizer) self.Show() sizer.Fit(self) - - def GetValue(self): + + def GetValue(self): return self.actor_icp,self.icp_matrix - def OK(self,evt): - self.Close() - def CANCEL(self,evt): - self.Destroy() + def OK(self,evt): + self.Close() + def CANCEL(self,evt): + self.Destroy() def ShowObjectICP(self, evt): objectbin = self.showObjICP.GetValue() if objectbin == True: self.actor_icp.SetVisibility(1) - self.interactor.Render() + self.interactor.Render() if objectbin == False: self.actor_icp.SetVisibility(0) - self.interactor.Render() - + self.interactor.Render() + def ShowObjectCloud(self, evt): objectbin = self.showObjCloud.GetValue() if objectbin == True: self.actor_cloud.SetVisibility(1) - self.interactor.Render() + self.interactor.Render() if objectbin == False: self.actor_cloud.SetVisibility(0) - self.interactor.Render() - + self.interactor.Render() + def ShowObjectHead(self, evt): objectbin = self.showObjHead.GetValue() if objectbin == True: self.actor.SetVisibility(1) - self.interactor.Render() + self.interactor.Render() if objectbin == False: self.actor.SetVisibility(0) - self.interactor.Render() - + self.interactor.Render() + def translate_rotate(self,evt): self.transform = vtk.vtkTransform() self.transform.Identity() self.transform.PostMultiply() - + # try2=vtk.vtkImageChangeInformation.SetInput(self.cloud) # self.cloud.vtk.vtkImageData.SetOrigin(self.actor_cloud.GetCenter()) # try1=vtk.vtkImageData(self.reader_cloud) # try1.SetOrigin(self.actor_cloud.GetCenter()) - + self.transform.Translate(self.spin_X.GetValue(), 0, 0) self.transform.Translate(0,self.spin_Y.GetValue(), 0) self.transform.Translate(0, 0, self.spin_Z.GetValue()) - + #self.actor_cloud.SetOrientation(self.spin_A.GetValue(),xyz[1],xyz[2]) #transform.RotateWXYZ(self.spin_A.GetValue(),1,0,0) - + # transform.RotateX(self.spin_A.GetValue()) # transform.RotateY(self.spin_B.GetValue()) # transform.RotateZ(self.spin_G.GetValue()) # transform.RotateWXYZ(self.spin_B.GetValue(),xyz[0],1,xyz[2]) # transform.RotateWXYZ(self.spin_G.GetValue(),xyz[0],xyz[1],1) self.actor_cloud.SetOrigin(self.actor_cloud.GetCenter()) - self.actor_cloud.SetOrientation(0,0,0) + self.actor_cloud.SetOrientation(0,0,0) #self.transform.SetInput(self.actor_cloud) self.transform.RotateX(self.spin_A.GetValue()) self.transform.RotateY(self.spin_B.GetValue()) self.transform.RotateZ(self.spin_G.GetValue()) - + # self.transform.RotateX(self.spin_A.GetValue()) # self.transform.RotateY(self.spin_B.GetValue()) # self.transform.RotateZ(self.spin_G.GetValue()) self.transform.Update() - + self.transf = vtk.vtkTransformPolyDataFilter() - + self.transf.SetInput(self.cloud) self.transf.SetTransform(self.transform) - self.transf.Update() + self.transf.Update() self.ren.RemoveActor(self.actor_cloud) self.mapper_cloud = vtk.vtkPolyDataMapper() self.mapper_cloud.SetInput(self.transf.GetOutput()) @@ -1477,17 +1484,17 @@ class FineCalibration(wx.Window): self.actor_cloud.GetProperty().SetColor(self.color_cloud) self.actor_cloud.GetProperty().SetOpacity(self.opacity_cloud) self.ren.AddActor(self.actor_cloud) - + #self.actor_cloud.SetOrigin(self.actor_cloud.GetCenter()) - #self.actor_cloud.SetOrientation(0,0,0) + #self.actor_cloud.SetOrientation(0,0,0) #self.actor_cloud.RotateX(self.spin_A.GetValue()) #self.actor_cloud.RotateY(self.spin_B.GetValue()) #self.actor_cloud.RotateZ(self.spin_G.GetValue()) - self.interactor.Render() - + self.interactor.Render() + def OnLoadMarkers(self, evt): print "Reading the points!" - + filepath = ShowLoadMarkersDialog() text_file = open(filepath, "r") #reading all lines and splitting into a float vector @@ -1497,12 +1504,12 @@ class FineCalibration(wx.Window): break try: line1 = [float(s) for s in line.split()] - coord = float(line1[1] - 1.0), float(line1[0] - 1.0), float(line1[2] - 1.0) + coord = float(line1[1] - 1.0), float(line1[0] - 1.0), float(line1[2] - 1.0) colour = line1[3], line1[4], line1[5] size = line1[6] - + CreateSphereMarkers(self,size,colour,coord) - + #sum 1 for each coordinate to matlab comprehension #coord = coord[0] + 1.0, coord[1] + 1.0, coord[2] + 1.0 #line with coordinates and properties of a marker @@ -1516,57 +1523,57 @@ class FineCalibration(wx.Window): except: InvalidTxt() raise ValueError('Invalid Txt') - + def OnCalibrationMarkers(self, evt): None - + def OnParamICP(self, evt): - None - + None + def OnApplyICP(self, evt): self.showObjICP.SetValue(True) - self.icp_number_iterations= self.spin_inter.GetValue() - self.icp_number_landmarks= self.spin_land.GetValue() + self.icp_number_iterations= self.spin_inter.GetValue() + self.icp_number_landmarks= self.spin_land.GetValue() self.icp_max_mean_distance = self.spin_mean.GetValue() self.Transformation() - self.interactor.Render() - self.Show() - + self.interactor.Render() + self.Show() + def CreateCloudPointsSurface(self, filename_cloud): # Reconstruct the surface from the cloud of points self.reader_cloud = vtk.vtkPLYReader() - + self.reader_cloud.SetFileName(filename_cloud) self.reader_cloud.Update() - + print "Creating cloud surface..." - + self.mapper_cloud = vtk.vtkPolyDataMapper() self.mapper_cloud.SetInput(self.reader_cloud.GetOutput()) self.mapper_cloud.ScalarVisibilityOff() self.mapper_cloud.ImmediateModeRenderingOn() - + self.actor_cloud = vtk.vtkActor() self.actor_cloud.SetMapper(self.mapper_cloud) self.actor_cloud.GetProperty().SetColor(self.color_cloud) self.actor_cloud.GetProperty().SetOpacity(self.opacity_cloud) - + return self.reader_cloud.GetOutput() - - def Transformation(self): + + def Transformation(self): # Apply IterativeClosestPoint Method - + #self.filename_cloud=self.ShowLoadSurfaceDialog() try: self.ren.RemoveActor(self.actor_icp) - self.interactor.Render() + self.interactor.Render() except: None filename_head = self.head #filename_cloud = sys.argv[2] #head_init = self.CreateHeadSurface(filename_head) #cloud = self.CreateCloudPointsSurface(self.filename_cloud) - + print "Applying ICP method..." icp = vtk.vtkIterativeClosestPointTransform() icp.SetSource(filename_head) @@ -1574,7 +1581,7 @@ class FineCalibration(wx.Window): icp.SetTarget(self.transf.GetOutput()) except: icp.SetTarget(self.cloud) - + icp.StartByMatchingCentroidsOn() icp.SetMaximumNumberOfIterations(self.icp_number_iterations) icp.SetMaximumNumberOfLandmarks(self.icp_number_landmarks) @@ -1582,26 +1589,26 @@ class FineCalibration(wx.Window): icp.GetLandmarkTransform().SetModeToRigidBody() icp.SetMeanDistanceModeToRMS() icp.Update() - + icp_transf = vtk.vtkTransformPolyDataFilter() icp_transf.SetInput(filename_head) icp_transf.SetTransform(icp) - icp_transf.Update() - + icp_transf.Update() + mapper_head_icp = vtk.vtkPolyDataMapper() mapper_head_icp.SetInput(icp_transf.GetOutput()) mapper_head_icp.ScalarVisibilityOff() mapper_head_icp.ImmediateModeRenderingOn() - + self.actor_icp = vtk.vtkActor() self.actor_icp.SetMapper(mapper_head_icp) self.actor_icp.GetProperty().SetColor(self.color_head_icp) self.actor_icp.GetProperty().SetOpacity(self.opacity_head_icp) - + self.icp_matrix = vtk.vtkMatrix4x4() self.icp_matrix = icp.GetMatrix() print self.icp_matrix - + #Eixos para facilitar visualizacao ----------------- # axes = vtk.vtkAxesActor() # axes.SetShaftTypeToCylinder() @@ -1610,57 +1617,57 @@ class FineCalibration(wx.Window): # axes.SetZAxisLabelText("z") # axes.SetTotalLength(25, 25, 25) #--------------------------------------------------- - - + + #renderer.AddActor(axes) - + self.ren.AddActor(self.actor_icp) #self.outlineF(icp_transf.GetOutput()) - #self.ren.AddActor(self.outline) + #self.ren.AddActor(self.outline) self.ren.SetBackground(0, 0, 0) self.ren.ResetCamera() - + def LoadData(self): coil_reference = vtk.vtkOBJReader() #coil_reference.SetFileName(os.path.realpath(os.path.join('..', # 'models', # 'coil_cti_2_scale10.obj'))) - + coil_reference.SetFileName('C:\Users\Administrator\Dropbox\Biomag\Renan\coil\coil_cti_2_scale10.obj') coilMapper = vtk.vtkPolyDataMapper() coilMapper.SetInputConnection(coil_reference.GetOutputPort()) self.coilActor = vtk.vtkActor() #self.coilActor.Scale(10.0, 10.0, 10.0) self.coilActor.SetMapper(coilMapper) - + axes = vtk.vtkAxesActor() axes.SetShaftTypeToCylinder() axes.SetXAxisLabelText("x") axes.SetYAxisLabelText("y") axes.SetZAxisLabelText("z") axes.SetTotalLength(50.0, 50.0, 50.0) - + self.ren.AddActor(self.coilActor) self.ren.AddActor(axes) - + def LoadActorDLG(self, pubsub_evt): self.actor = pubsub_evt.data[0] #self.head=actor self.head=pubsub_evt.data[1] - + self.outlineF(self.head) - self.ren.AddActor(self.outline) - + self.ren.AddActor(self.outline) + self.filename_cloud=self.ShowLoadSurfaceDialog() self.cloud = self.CreateCloudPointsSurface(self.filename_cloud) print self.cloud - + self.outlineF(self.cloud) - self.ren.AddActor(self.outline) - - self.ren.AddActor(self.actor) - self.ren.AddActor(self.actor_cloud) - + self.ren.AddActor(self.outline) + + self.ren.AddActor(self.actor) + self.ren.AddActor(self.actor_cloud) + axes = vtk.vtkAxesActor() axes.SetShaftTypeToCylinder() axes.SetXAxisLabelText("x") @@ -1668,67 +1675,67 @@ class FineCalibration(wx.Window): axes.SetZAxisLabelText("z") axes.SetTotalLength(25, 25, 25) self.ren.AddActor(axes) - + self.ren.ResetCamera() #self.ren.ResetCameraClippingRange() - + #self.ShowOrientationCube() - self.interactor.Render() - + self.interactor.Render() + def LoadVolumeDLG(self, pubsub_evt): self.raycasting_volume = True #self._to_show_ball += 1 #print "to show ball", self._to_show_ball - + volume = pubsub_evt.data[0] colour = pubsub_evt.data[1] self.light = self.ren.GetLights().GetNextItem() - + self.ren.AddVolume(volume) - + self.ren.SetBackground(colour) - + self.interactor.Render() - + def outlineF(self,Actor): #filtro outline self.outline = vtk.vtkActor() outlineData = vtk.vtkOutlineFilter() outlineData.SetInput(Actor) outlineData.Update() - + mapoutline = vtk.vtkPolyDataMapper() mapoutline.SetInputConnection(outlineData.GetOutputPort()) - + self.outline.SetMapper(mapoutline) self.outline.GetProperty().SetColor(0.0, 0.0, 1.0) - + def CreateSphereMarkers(self,ballsize,ballcolour,coord): - + x, y, z = bases.flip_x(coord) - + ball_ref = vtk.vtkSphereSource() ball_ref.SetRadius(ballsize) ball_ref.SetCenter(x, y, z) - + mapper = vtk.vtkPolyDataMapper() mapper.SetInput(ball_ref.GetOutput()) - + prop = vtk.vtkProperty() prop.SetColor(ballcolour) - + #adding a new actor for the present ball self.staticballs.append(vtk.vtkActor()) - + self.staticballs[self.ball_id].SetMapper(mapper) self.staticballs[self.ball_id].SetProperty(prop) - - self.ren.AddActor(self.staticballs[self.ball_id]) + + self.ren.AddActor(self.staticballs[self.ball_id]) self.ball_id = self.ball_id + 1 self.interactor.Render() - - - + + + self.PostCreate(self.pre) # # # class ObjectCalibration(wx.Window): # # # def __init__(self, parent=None, ID=-1, title="Object Calibration", size=wx.DefaultSize, @@ -1967,7 +1974,7 @@ class ObjectCalibration(wx.Dialog): def __init__(self, parent=None, ID=-1, title="Calibration Dialog", size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, useMetal=False, nav_prop=None): - + self.nav_prop = nav_prop self.correg = None self.staticballs = [] @@ -1975,7 +1982,7 @@ class ObjectCalibration(wx.Dialog): self.ball_centers = [] self.to_translate = 0 self.init_angle_plh = None - + # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI object using the Create @@ -2000,40 +2007,40 @@ class ObjectCalibration(wx.Dialog): self.LoadData() # LINE 1: Janela - - def draw_gui(self): + + def draw_gui(self): #style = vtk.vtkInteractorStyleTrackballActor() - + self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) #self.interactor.SetInteractorStyle(style) self.interactor.Enable(1) self.ren = vtk.vtkRenderer() self.interactor.GetRenderWindow().AddRenderer(self.ren) - + # LINE 2: Botoes - + marker = wx.Button(self, -1, "Create Marker") marker.Bind(wx.EVT_BUTTON, self.OnCalibrationMarkers) dc_vtkMatrix = wx.Button(self, -1, "Matrix") dc_vtkMatrix.Bind(wx.EVT_BUTTON, self.DirectionCosinesTest_vtkmatrix) - + dc_eulerangles = wx.Button(self, -1, "Euler") dc_eulerangles.Bind(wx.EVT_BUTTON, self.DirectionCosinesTest_eulerangles) rotate_button = wx.Button(self, -1, "Rotate") rotate_button.Bind(wx.EVT_BUTTON, self.rotate) - + reset = wx.Button(self, -1, "Reset") reset.Bind(wx.EVT_BUTTON, self.Reset) - + button_neuronavigate = wx.Button(self, -1, "Neuronavigate") button_neuronavigate.Bind(wx.EVT_BUTTON, self.Neuronavigate_ToggleButton) - + ok = wx.Button(self, wx.ID_OK) - + cancel = wx.Button(self, wx.ID_CANCEL) - + button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer.Add(marker) button_sizer.Add(dc_vtkMatrix) @@ -2052,27 +2059,27 @@ class ObjectCalibration(wx.Dialog): self.SetSizer(sizer) sizer.Fit(self) - + def LoadData(self): coil_reference = vtk.vtkOBJReader() #coil_reference.SetFileName(os.path.realpath(os.path.join('..', # 'models', # 'coil_cti_2_scale10.obj'))) - + coil_reference.SetFileName('C:\Users\Administrator\Dropbox\Biomag\Renan\coil\coil_cti_2_scale10.obj') coilMapper = vtk.vtkPolyDataMapper() coilMapper.SetInputConnection(coil_reference.GetOutputPort()) self.coilActor = vtk.vtkActor() #self.coilActor.Scale(10.0, 10.0, 10.0) self.coilActor.SetMapper(coilMapper) - + axes = vtk.vtkAxesActor() axes.SetShaftTypeToCylinder() axes.SetXAxisLabelText("x") axes.SetYAxisLabelText("y") axes.SetZAxisLabelText("z") axes.SetTotalLength(50.0, 50.0, 50.0) - + self.ren.AddActor(self.coilActor) self.ren.AddActor(axes) @@ -2080,8 +2087,8 @@ class ObjectCalibration(wx.Dialog): self.coilActor.RotateX(90) self.interactor.Render() print 'Coil orientation', self.coilActor.GetOrientation() - - def OnCalibrationMarkers(self, evt): + + def OnCalibrationMarkers(self, evt): import data.coordinates as co from numpy import matrix Minv = self.nav_prop[0][0] @@ -2092,14 +2099,14 @@ class ObjectCalibration(wx.Dialog): tracker_init = self.nav_prop[1][0] tracker = self.nav_prop[1][1] tracker_mode = self.nav_prop[1][2] - + trck = co.Coordinates(tracker_init, tracker, tracker_mode).Returns() tracker = matrix([[trck[0]], [trck[1]], [trck[2]]]) self.init_angle_plh = trck[3], trck[4], trck[5] img = q1 + (Minv*N)*(tracker - q2) - coord = float(img[0]), float(img[1]), float(img[2]) + coord = float(img[0]), float(img[1]), float(img[2]) x, y, z = bases.flip_x(coord) - + if not self.ball_centers: self.to_translate = -x, -y, -z @@ -2118,46 +2125,46 @@ class ObjectCalibration(wx.Dialog): prop = vtk.vtkProperty() prop.SetColor(0,1, 1) - + #adding a new actor for the present ball self.staticballs.append(vtk.vtkActor()) - + self.staticballs[self.ball_id].SetMapper(mapper) self.staticballs[self.ball_id].SetProperty(prop) - - self.ren.AddActor(self.staticballs[self.ball_id]) + + self.ren.AddActor(self.staticballs[self.ball_id]) self.ball_id += 1 - + self.interactor.Render() def DirectionCosinesTest_vtkmatrix(self, evt): p1, p2, p3 = self.ball_centers[:3] dcm = self.base_creation(p1, p2, p3) - + mat4x4 = vtk.vtkMatrix4x4() mat4x4.DeepCopy(dcm[0][0], dcm[0][1], dcm[0][2], 0.0, dcm[1][0], dcm[1][1], dcm[1][2], 0.0, dcm[2][0], dcm[2][1], dcm[2][2], 0.0, 0.0, 0.0, 0.0, 1.0) - + self.coilActor.SetUserMatrix(mat4x4) print "\n====================================" print "orientation: ", self.coilActor.GetOrientation() print "====================================\n" - + def DirectionCosinesTest_eulerangles(self, evt): #p1, p2, p3 = self.ball_centers[:3] #dcm = self.base_creation(p1, p2, p3) dcm = self.nav_prop[0][1] - + # site http://met.fzu.edu.cn/cai/Matlab6.5/help/toolbox/aeroblks/directioncosinematrixtoeulerangles.html theta = np.rad2deg(-np.arcsin(dcm[0][2])) phi = np.rad2deg(np.arctan(dcm[1][2]/dcm[2][2])) psi = np.rad2deg(np.arctan(dcm[0][1]/dcm[0][0])) - self.coilActor.RotateWXYZ(psi, 0, 0, 1) + self.coilActor.RotateWXYZ(psi, 0, 0, 1) self.coilActor.RotateWXYZ(phi, 1, 0, 0) self.coilActor.RotateWXYZ(theta, 0, 1, 0) self.interactor.Render() @@ -2167,8 +2174,8 @@ class ObjectCalibration(wx.Dialog): print "orientation: ", self.coilActor.GetOrientation() print "====================================\n" - - + + def Reset(self, evt): self.ball_centers = [] self.ball_id = 0 @@ -2178,7 +2185,7 @@ class ObjectCalibration(wx.Dialog): for i in range(0, len(self.staticballs)): self.ren.RemoveActor(self.staticballs[i]) self.staticballs = [] - + def Neuronavigate_ToggleButton(self, evt): p0, p1, p2 = self.ball_centers[:3] m = self.base_creation(p0, p1, p2) @@ -2192,17 +2199,17 @@ class ObjectCalibration(wx.Dialog): #vm.SetElement(0, 1, m[0, 1]) #vm.SetElement(0, 2, m[0, 2]) #vm.SetElement(0, 3, 0 ) - + #vm.SetElement(1, 0, m[1, 0]) #vm.SetElement(1, 1, m[1, 1]) #vm.SetElement(1, 2, m[1, 2]) #vm.SetElement(1, 3, 0 ) - + #vm.SetElement(2, 0, m[2, 0]) #vm.SetElement(2, 1, m[2, 1]) #vm.SetElement(2, 2, m[2, 2]) #vm.SetElement(2, 3, 0 ) - + #vm.SetElement(3, 0, 0 ) #vm.SetElement(3, 1, 0 ) #vm.SetElement(3, 2, 0 ) @@ -2219,7 +2226,7 @@ class ObjectCalibration(wx.Dialog): print "Angulos", gama, beta, alpha self.coilActor.RotateWXYZ(alpha, 0, 1, 0) - self.coilActor.RotateWXYZ(beta, 1, 0, 0) + self.coilActor.RotateWXYZ(beta, 1, 0, 0) self.coilActor.RotateWXYZ(gama, 0, 0, 1) self.interactor.Render() @@ -2230,13 +2237,13 @@ class ObjectCalibration(wx.Dialog): p1, p2, p3 = self.ball_centers[presize:size] M, q1, Minv = db.base_creation(p1, p2, p3) inits_angles = self.coilActor.GetOrientation(), self.init_angle_plh, M - + coil_top = self.ball_centers[len(self.ball_centers)-1] coil_bottom = self.ball_centers[len(self.ball_centers)-2] coil_axis = np.matrix(coil_bottom[0:3]).reshape(3, 1),np.matrix(coil_top[0:3]).reshape(3, 1) - + return inits_angles, coil_axis -#=============================================================================== +#=============================================================================== #=============================================================================== class SurfaceDialog(wx.Dialog): @@ -2349,7 +2356,7 @@ class SurfaceCreationOptionsPanel(wx.Panel): import constants as const import data.surface as surface import project as prj - + wx.Panel.__init__(self, parent, ID) # LINE 1: Surface name @@ -2456,7 +2463,7 @@ class CAOptions(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent, -1) self._build_widgets() - + def _build_widgets(self): sb = wx.StaticBox(self, -1, _('Options')) self.angle = floatspin.FloatSpin(self, -1, value=0.7, min_val=0.0, @@ -2470,7 +2477,7 @@ class CAOptions(wx.Panel): self.min_weight = floatspin.FloatSpin(self, -1, value=0.2, min_val=0.0, max_val=1.0, increment=0.1, digits=1) - + self.steps = wx.SpinCtrl(self, -1, value='10', min=1, max=100) layout_sizer = wx.FlexGridSizer(rows=4, cols=2, hgap=5, vgap=5) @@ -2533,7 +2540,7 @@ class SurfaceMethodPanel(wx.Panel): self.SetSizer(self.main_sizer) self.Layout() self.Fit() - + if self.mask_edited: self.cb_types.SetValue(_(u'Context aware smoothing')) self.ca_options.Enable() @@ -2572,9 +2579,9 @@ class SurfaceMethodPanel(wx.Panel): algorithm = self.GetAlgorithmSelected() options = self.GetOptions() - return {"algorithm": algorithm, + return {"algorithm": algorithm, "options": options} - + def ReloadMethodsOptions(self): self.cb_types.Clear() self.cb_types.AppendItems([i for i in sorted(self.alg_types) diff --git a/invesalius/gui/task_navigator.py b/invesalius/gui/task_navigator.py index 34e31e3..6bbb404 100644 --- a/invesalius/gui/task_navigator.py +++ b/invesalius/gui/task_navigator.py @@ -492,25 +492,27 @@ class NeuronavigationTools(wx.Panel): def OnChoiceTracker(self, evt): trck_id = evt.GetSelection() - dco.Tracker(trck_id) - if self.tracker_id == 0: - self.trk_init = dtrk.Tracker_Init().PolhemusISO_init() - print self.trk_init - - elif self.tracker_id == 1: - self.trk_init = dtrk.Tracker_Init().Polhemus_init() - print self.trk_init - - elif self.tracker_id == 2: - #review this close command: when for example - #you jump from MTC to Zebris, it will try - #to close the MTC, but it doesnt have a close attribute - #self.trk_init.close() - self.trk_init = dtrk.Tracker_Init().Claron_init() - print self.trk_init - elif self.tracker_id == 3: - self.trk_init = dtrk.Tracker_Init().Zebris_init() - print self.trk_init + # self.trk_init = dco.Tracker().ReturnTracker(trck_id) + self.trk_init = dco.Tracker(trck_id) + + # if self.tracker_id == 0: + # self.trk_init = dtrk.Tracker_Init().PolhemusISO_init() + # print self.trk_init + # + # elif self.tracker_id == 1: + # self.trk_init = dtrk.Tracker_Init().Polhemus_init() + # print self.trk_init + # + # elif self.tracker_id == 2: + # #review this close command: when for example + # #you jump from MTC to Zebris, it will try + # #to close the MTC, but it doesnt have a close attribute + # #self.trk_init.close() + # self.trk_init = dtrk.Tracker_Init().Claron_init() + # print self.trk_init + # elif self.tracker_id == 3: + # self.trk_init = dtrk.Tracker_Init().Zebris_init() + # print self.trk_init print "Tracker changed!" -- libgit2 0.21.2