[med-svn] [Git][med-team/invesalius][upstream] New upstream version 3.1.99994
Thiago Franco de Moraes
gitlab at salsa.debian.org
Sun Mar 1 22:35:09 GMT 2020
Thiago Franco de Moraes pushed to branch upstream at Debian Med / invesalius
Commits:
87652a61 by Thiago Franco de Moraes at 2020-03-01T18:04:22-03:00
New upstream version 3.1.99994
- - - - -
23 changed files:
- + icons/invesalius_64x64.ico
- invesalius/constants.py
- invesalius/data/coordinates.py
- invesalius/data/imagedata_utils.py
- invesalius/data/surface.py
- invesalius/data/trackers.py
- invesalius/data/viewer_volume.py
- invesalius/gui/default_viewers.py
- invesalius/gui/dialogs.py
- invesalius/gui/frame.py
- invesalius/gui/task_navigator.py
- invesalius/gui/task_tools.py
- invesalius/inv_paths.py
- + navigation/mtc_files/Markers/3Coil_big
- + navigation/ndi_files/Markers/8700338.rom
- + navigation/ndi_files/Markers/8700339.rom
- + navigation/ndi_files/Markers/8700340.rom
- + navigation/ndi_files/Markers/NBSprobe.rom
- + navigation/ndi_files/Markers/NBSref.rom
- + navigation/ndi_files/Markers/NT-103.rom
- + navigation/ndi_files/Markers/NT-112.rom
- + navigation/ndi_files/Markers/NT-115.rom
- + navigation/ndi_files/Markers/active-wireless.rom
Changes:
=====================================
icons/invesalius_64x64.ico
=====================================
Binary files /dev/null and b/icons/invesalius_64x64.ico differ
=====================================
invesalius/constants.py
=====================================
@@ -27,7 +27,7 @@ from invesalius import utils
from invesalius import inv_paths
#from invesalius.project import Project
-INVESALIUS_VERSION = "3.1.1"
+INVESALIUS_VERSION = "3.1.99994"
INVESALIUS_ACTUAL_FORMAT_VERSION = 1.1
@@ -62,6 +62,7 @@ TEXT_SIZE_SMALL = 11
TEXT_SIZE = 12
TEXT_SIZE_LARGE = 16
TEXT_SIZE_EXTRA_LARGE = 20
+TEXT_SIZE_DIST_NAV = 32
TEXT_COLOUR = (1,1,1)
(X,Y) = (0.03, 0.97)
@@ -650,14 +651,18 @@ MTC = 1
FASTRAK = 2
ISOTRAKII = 3
PATRIOT = 4
-DEBUGTRACK = 5
-DISCTRACK = 6
+CAMERA = 5
+POLARIS = 6
+DEBUGTRACK = 7
+DISCTRACK = 8
DEFAULT_TRACKER = SELECT
+NDICOMPORT = b'COM1'
+
TRACKER = [_("Select tracker:"), _("Claron MicronTracker"),
_("Polhemus FASTRAK"), _("Polhemus ISOTRAK II"),
- _("Polhemus PATRIOT"), _("Debug tracker"),
- _("Disconnect tracker")]
+ _("Polhemus PATRIOT"), _("Camera tracker"),
+ _("NDI Polaris"), _("Debug tracker"), _("Disconnect tracker")]
STATIC_REF = 0
DYNAMIC_REF = 1
@@ -715,13 +720,13 @@ TIPS_OBJ = [_("Select left object fiducial"),
_("Select object center"),
_("Attach sensor to object")]
-PROBE_NAME = "1Probe"
-REF_NAME = "2Ref"
-OBJ_NAME = "3Coil"
+MTC_PROBE_NAME = "1Probe"
+MTC_REF_NAME = "2Ref"
+MTC_OBJ_NAME = "3Coil"
#OBJECT TRACKING
-ARROW_SCALE = 3
-ARROW_UPPER_LIMIT = 30
+ARROW_SCALE = 6
+ARROW_UPPER_LIMIT = 15
#COIL_ANGLES_THRESHOLD = 3 * ARROW_SCALE
COIL_ANGLES_THRESHOLD = 3
COIL_COORD_THRESHOLD = 3
=====================================
invesalius/data/coordinates.py
=====================================
@@ -21,6 +21,7 @@ from math import sin, cos
import numpy as np
import invesalius.data.transformations as tr
+import invesalius.constants as const
from time import sleep
from random import uniform
@@ -40,17 +41,48 @@ def GetCoordinates(trck_init, trck_id, ref_mode):
coord = None
if trck_id:
- getcoord = {1: ClaronCoord,
- 2: PolhemusCoord,
- 3: PolhemusCoord,
- 4: PolhemusCoord,
- 5: DebugCoord}
+ getcoord = {const.MTC: ClaronCoord,
+ const.FASTRAK: PolhemusCoord,
+ const.ISOTRAKII: PolhemusCoord,
+ const.PATRIOT: PolhemusCoord,
+ const.CAMERA: CameraCoord,
+ const.POLARIS: PolarisCoord,
+ const.DEBUGTRACK: DebugCoord}
coord = getcoord[trck_id](trck_init, trck_id, ref_mode)
else:
print("Select Tracker")
return coord
+def PolarisCoord(trck_init, trck_id, ref_mode):
+ trck = trck_init[0]
+ trck.Run()
+
+ probe = trck.probe.decode(const.FS_ENCODE).split(',')
+ angles_probe = np.degrees(tr.euler_from_quaternion(probe[2:6], axes='rzyx'))
+ trans_probe = np.array(probe[6:9]).astype(float)
+ coord1 = np.hstack((trans_probe, angles_probe))
+
+ ref = trck.ref.decode(const.FS_ENCODE).split(',')
+ angles_ref = np.degrees(tr.euler_from_quaternion(ref[2:6], axes='rzyx'))
+ trans_ref = np.array(ref[6:9]).astype(float)
+ coord2 = np.hstack((trans_ref, angles_ref))
+
+ obj = trck.obj.decode(const.FS_ENCODE).split(',')
+ angles_obj = np.degrees(tr.euler_from_quaternion(obj[2:6], axes='rzyx'))
+ trans_obj = np.array(obj[6:9]).astype(float)
+ coord3 = np.hstack((trans_obj, angles_obj))
+
+ coord = np.vstack([coord1, coord2, coord3])
+ Publisher.sendMessage('Sensors ID', probe_id=trck.probeID, ref_id=trck.refID, obj_id=trck.objID)
+
+ return coord
+
+def CameraCoord(trck_init, trck_id, ref_mode):
+ trck = trck_init[0]
+ coord, probeID, refID = trck.Run()
+ Publisher.sendMessage('Sensors ID', probe_id=probeID, ref_id=refID)
+ return coord
def ClaronCoord(trck_init, trck_id, ref_mode):
trck = trck_init[0]
@@ -214,7 +246,7 @@ def DebugCoord(trk_init, trck_id, ref_mode):
coord4 = np.array([uniform(1, 200), uniform(1, 200), uniform(1, 200),
uniform(-180.0, 180.0), uniform(-180.0, 180.0), uniform(-180.0, 180.0)])
- Publisher.sendMessage('Sensors ID', probe_id=int(uniform(0, 5)), ref_id=int(uniform(0, 5)))
+ Publisher.sendMessage('Sensors ID', probe_id=int(uniform(0, 5)), ref_id=int(uniform(0, 5)), obj_id=int(uniform(0, 5)))
return np.vstack([coord1, coord2, coord3, coord4])
=====================================
invesalius/data/imagedata_utils.py
=====================================
@@ -101,7 +101,7 @@ def ResampleImage2D(imagedata, px=None, py=None, resolution_percentage = None,
resample.SetInputData(imagedata)
resample.SetAxisMagnificationFactor(0, factor_x)
resample.SetAxisMagnificationFactor(1, factor_y)
- resample.SetOutputSpacing(spacing[0] * factor_x, spacing[1] * factor_y, spacing[2])
+ # resample.SetOutputSpacing(spacing[0] * factor_x, spacing[1] * factor_y, spacing[2])
if (update_progress):
message = _("Generating multiplanar visualization...")
resample.AddObserver("ProgressEvent", lambda obj,
=====================================
invesalius/data/surface.py
=====================================
@@ -313,6 +313,7 @@ class SurfaceManager():
reader = vtk.vtkSTLReader()
elif filename.lower().endswith('.ply'):
reader = vtk.vtkPLYReader()
+ scalar = True
elif filename.lower().endswith('.obj'):
reader = vtk.vtkOBJReader()
elif filename.lower().endswith('.vtp'):
=====================================
invesalius/data/trackers.py
=====================================
@@ -16,7 +16,8 @@
# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais
# detalhes.
#--------------------------------------------------------------------------
-
+import invesalius.constants as const
+import invesalius.gui.dialogs as dlg
# TODO: Disconnect tracker when a new one is connected
# TODO: Test if there are too many prints when connection fails
@@ -32,11 +33,13 @@ def TrackerConnection(tracker_id, trck_init, action):
"""
if action == 'connect':
- trck_fcn = {1: ClaronTracker,
- 2: PolhemusTracker, # FASTRAK
- 3: PolhemusTracker, # ISOTRAK
- 4: PolhemusTracker, # PATRIOT
- 5: DebugTracker}
+ trck_fcn = {const.MTC: ClaronTracker,
+ const.FASTRAK: PolhemusTracker, # FASTRAK
+ const.ISOTRAKII: PolhemusTracker, # ISOTRAK
+ const.PATRIOT: PolhemusTracker, # PATRIOT
+ const.CAMERA: CameraTracker, # CAMERA
+ const.POLARIS: PolarisTracker, # POLARIS
+ const.DEBUGTRACK: DebugTracker}
trck_init = trck_fcn[tracker_id](tracker_id)
@@ -58,6 +61,48 @@ def DefaultTracker(tracker_id):
# return tracker initialization variable and type of connection
return trck_init, 'wrapper'
+def PolarisTracker(tracker_id):
+ from wx import ID_OK
+ trck_init = None
+ dlg_port = dlg.SetNDIconfigs()
+ if dlg_port.ShowModal() == ID_OK:
+ com_port, PROBE_DIR, REF_DIR, OBJ_DIR = dlg_port.GetValue()
+ try:
+ import pypolaris
+ lib_mode = 'wrapper'
+ trck_init = pypolaris.pypolaris()
+
+ if trck_init.Initialize(com_port, PROBE_DIR, REF_DIR, OBJ_DIR) != 0:
+ trck_init = None
+ lib_mode = None
+ print('Could not connect to default tracker.')
+ else:
+ print('Connect to polaris tracking device.')
+
+ except:
+ lib_mode = 'error'
+ trck_init = None
+ print('Could not connect to default tracker.')
+ else:
+ lib_mode = None
+ print('Could not connect to default tracker.')
+
+ # return tracker initialization variable and type of connection
+ return trck_init, lib_mode
+
+def CameraTracker(tracker_id):
+ trck_init = None
+ try:
+ import invesalius.data.camera_tracker as cam
+ trck_init = cam.camera()
+ trck_init.Initialize()
+ print('Connect to camera tracking device.')
+
+ except:
+ print('Could not connect to default tracker.')
+
+ # return tracker initialization variable and type of connection
+ return trck_init, 'wrapper'
def ClaronTracker(tracker_id):
import invesalius.constants as const
@@ -69,13 +114,13 @@ def ClaronTracker(tracker_id):
lib_mode = 'wrapper'
trck_init = pyclaron.pyclaron()
- trck_init.CalibrationDir = inv_paths.CAL_DIR.encode(const.FS_ENCODE)
- trck_init.MarkerDir = inv_paths.MAR_DIR.encode(const.FS_ENCODE)
+ trck_init.CalibrationDir = inv_paths.MTC_CAL_DIR.encode(const.FS_ENCODE)
+ trck_init.MarkerDir = inv_paths.MTC_MAR_DIR.encode(const.FS_ENCODE)
trck_init.NumberFramesProcessed = 1
trck_init.FramesExtrapolated = 0
- trck_init.PROBE_NAME = const.PROBE_NAME.encode(const.FS_ENCODE)
- trck_init.REF_NAME = const.REF_NAME.encode(const.FS_ENCODE)
- trck_init.OBJ_NAME = const.OBJ_NAME.encode(const.FS_ENCODE)
+ trck_init.PROBE_NAME = const.MTC_PROBE_NAME.encode(const.FS_ENCODE)
+ trck_init.REF_NAME = const.MTC_REF_NAME.encode(const.FS_ENCODE)
+ trck_init.OBJ_NAME = const.MTC_OBJ_NAME.encode(const.FS_ENCODE)
trck_init.Initialize()
if trck_init.GetIdentifyingCamera():
@@ -146,25 +191,38 @@ def PlhWrapperConnection(tracker_id):
def PlhSerialConnection(tracker_id):
import serial
+ from wx import ID_OK
+ trck_init = None
+ dlg_port = dlg.SetCOMport()
+ if dlg_port.ShowModal() == ID_OK:
+ com_port = dlg_port.GetValue()
+ try:
+ trck_init = serial.Serial(com_port, baudrate=115200, timeout=0.03)
+
+ if tracker_id == 2:
+ # Polhemus FASTRAK needs configurations first
+ trck_init.write(0x02, str.encode("u"))
+ trck_init.write(0x02, str.encode("F"))
+ elif tracker_id == 3:
+ # Polhemus ISOTRAK needs to set tracking point from
+ # center to tip.
+ trck_init.write(str.encode("u"))
+ trck_init.write(str.encode("F"))
+ trck_init.write(str.encode("Y"))
+
+ trck_init.write(str.encode("P"))
+ data = trck_init.readlines()
+ if not data:
+ trck_init = None
+ print('Could not connect to Polhemus serial without error.')
- trck_init = serial.Serial('COM3', baudrate=115200, timeout=0.03)
-
- if tracker_id == 2:
- # Polhemus FASTRAK needs configurations first
- trck_init.write(0x02, str.encode("u"))
- trck_init.write(0x02, str.encode("F"))
- elif tracker_id == 3:
- # Polhemus ISOTRAK needs to set tracking point from
- # center to tip.
- trck_init.write(str.encode("u"))
- trck_init.write(str.encode("F"))
- trck_init.write(str.encode("Y"))
-
- trck_init.write(str.encode("P"))
- data = trck_init.readlines()
- if not data:
- trck_init = None
- print('Could not connect to Polhemus serial without error.')
+ except:
+ lib_mode = 'error'
+ trck_init = None
+ print('Could not connect to default tracker.')
+ else:
+ lib_mode = None
+ print('Could not connect to default tracker.')
return trck_init
@@ -211,13 +269,13 @@ def DisconnectTracker(tracker_id, trck_init):
:param trck_init: Initialization variable of tracking device.
"""
- if tracker_id == 5:
+ if tracker_id == const.DEBUGTRACK:
trck_init = False
lib_mode = 'debug'
print('Debug tracker disconnected.')
else:
try:
- if tracker_id == 3:
+ if tracker_id == const.ISOTRAKII:
trck_init.close()
trck_init = False
lib_mode = 'serial'
=====================================
invesalius/data/viewer_volume.py
=====================================
@@ -165,6 +165,7 @@ class Viewer(wx.Panel):
self.obj_state = None
self.obj_actor_list = None
self.arrow_actor_list = None
+ #self.pTarget = [0., 0., 0.]
# self.obj_axes = None
@@ -172,8 +173,9 @@ class Viewer(wx.Panel):
self._to_show_ball = 0
self._ball_ref_visibility = False
- self.sen1 = False
- self.sen2 = False
+ self.probe = False
+ self.ref = False
+ self.obj = False
self.timer = False
self.index = False
@@ -325,8 +327,8 @@ class Viewer(wx.Panel):
self.RemoveBallReference()
self.interactor.Render()
- def OnSensors(self, probe_id, ref_id):
- if not self.sen1:
+ def OnSensors(self, probe_id, ref_id, obj_id=0):
+ if not self.probe:
self.CreateSensorID()
if probe_id:
@@ -337,35 +339,49 @@ class Viewer(wx.Panel):
colour2 = (0, 1, 0)
else:
colour2 = (1, 0, 0)
+ if obj_id:
+ colour3 = (0, 1, 0)
+ else:
+ colour3 = (1, 0, 0)
- self.sen1.SetColour(colour1)
- self.sen2.SetColour(colour2)
+ self.probe.SetColour(colour1)
+ self.ref.SetColour(colour2)
+ self.obj.SetColour(colour3)
self.Refresh()
def CreateSensorID(self):
- sen1 = vtku.Text()
- sen1.SetSize(const.TEXT_SIZE_LARGE)
- sen1.SetPosition((const.X, const.Y))
- sen1.ShadowOff()
- sen1.SetValue("O")
- self.sen1 = sen1
- self.ren.AddActor(sen1.actor)
-
- sen2 = vtku.Text()
- sen2.SetSize(const.TEXT_SIZE_LARGE)
- sen2.SetPosition((const.X+0.04, const.Y))
- sen2.ShadowOff()
- sen2.SetValue("O")
- self.sen2 = sen2
- self.ren.AddActor(sen2.actor)
+ probe = vtku.Text()
+ probe.SetSize(const.TEXT_SIZE_LARGE)
+ probe.SetPosition((const.X, const.Y))
+ probe.ShadowOff()
+ probe.SetValue("P")
+ self.probe = probe
+ self.ren.AddActor(probe.actor)
+
+ ref = vtku.Text()
+ ref.SetSize(const.TEXT_SIZE_LARGE)
+ ref.SetPosition((const.X+0.04, const.Y))
+ ref.ShadowOff()
+ ref.SetValue("R")
+ self.ref = ref
+ self.ren.AddActor(ref.actor)
+
+ obj = vtku.Text()
+ obj.SetSize(const.TEXT_SIZE_LARGE)
+ obj.SetPosition((const.X+0.08, const.Y))
+ obj.ShadowOff()
+ obj.SetValue("O")
+ self.obj = obj
+ self.ren.AddActor(obj.actor)
self.interactor.Render()
def OnRemoveSensorsID(self):
- if self.sen1:
- self.ren.RemoveActor(self.sen1.actor)
- self.ren.RemoveActor(self.sen2.actor)
- self.sen1 = self.sen2 = False
+ if self.probe:
+ self.ren.RemoveActor(self.probe.actor)
+ self.ren.RemoveActor(self.ref.actor)
+ self.ren.RemoveActor(self.obj.actor)
+ self.probe = self.ref = self.obj = False
self.interactor.Render()
def OnShowSurface(self, index, visibility):
@@ -608,6 +624,7 @@ class Viewer(wx.Panel):
self.distthreshold = dist_threshold
def ActivateTargetMode(self, evt=None, target_mode=None):
+ vtk_colors = vtk.vtkNamedColors()
self.target_mode = target_mode
if self.target_coord and self.target_mode:
self.CreateTargetAim()
@@ -631,21 +648,33 @@ class Viewer(wx.Panel):
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputData(normals.GetOutput())
mapper.ScalarVisibilityOff()
- mapper.ImmediateModeRenderingOn() # improve performance
+ #mapper.ImmediateModeRenderingOn() # improve performance
obj_roll = vtk.vtkActor()
obj_roll.SetMapper(mapper)
+ obj_roll.GetProperty().SetColor(1, 1, 1)
+ # obj_roll.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
+ # obj_roll.GetProperty().SetSpecular(30)
+ # obj_roll.GetProperty().SetSpecularPower(80)
obj_roll.SetPosition(0, 25, -30)
obj_roll.RotateX(-60)
obj_roll.RotateZ(180)
obj_yaw = vtk.vtkActor()
obj_yaw.SetMapper(mapper)
+ obj_yaw.GetProperty().SetColor(1, 1, 1)
+ # obj_yaw.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
+ # obj_yaw.GetProperty().SetSpecular(30)
+ # obj_yaw.GetProperty().SetSpecularPower(80)
obj_yaw.SetPosition(0, -115, 5)
obj_yaw.RotateZ(180)
obj_pitch = vtk.vtkActor()
obj_pitch.SetMapper(mapper)
+ obj_pitch.GetProperty().SetColor(1, 1, 1)
+ # obj_pitch.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
+ # obj_pitch.GetProperty().SetSpecular(30)
+ # obj_pitch.GetProperty().SetSpecularPower(80)
obj_pitch.SetPosition(5, -265, 5)
obj_pitch.RotateY(90)
obj_pitch.RotateZ(180)
@@ -702,13 +731,16 @@ class Viewer(wx.Panel):
self.DisableCoilTracker()
def OnUpdateObjectTargetGuide(self, m_img, coord):
+
+ vtk_colors = vtk.vtkNamedColors()
+
if self.target_coord and self.target_mode:
target_dist = distance.euclidean(coord[0:3],
(self.target_coord[0], -self.target_coord[1], self.target_coord[2]))
# self.txt.SetCoilDistanceValue(target_dist)
- self.textSource.SetText('Dist: ' + str("{:06.2f}".format(target_dist)) + ' mm')
+ self.tdist.SetValue('Distance: ' + str("{:06.2f}".format(target_dist)) + ' mm')
self.ren.ResetCamera()
self.SetCameraTarget()
if target_dist > 100:
@@ -719,10 +751,10 @@ class Viewer(wx.Panel):
if target_dist <= self.distthreshold:
thrdist = True
- self.aim_actor.GetProperty().SetColor(0, 1, 0)
+ self.aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
else:
thrdist = False
- self.aim_actor.GetProperty().SetColor(1, 1, 1)
+ self.aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Yellow'))
coordx = self.target_coord[3] - coord[3]
if coordx > const.ARROW_UPPER_LIMIT:
@@ -750,9 +782,11 @@ class Viewer(wx.Panel):
if self.anglethreshold * const.ARROW_SCALE > coordx > -self.anglethreshold * const.ARROW_SCALE:
thrcoordx = True
+ # self.obj_actor_list[0].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
self.obj_actor_list[0].GetProperty().SetColor(0, 1, 0)
else:
thrcoordx = False
+ # self.obj_actor_list[0].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
self.obj_actor_list[0].GetProperty().SetColor(1, 1, 1)
offset = 5
@@ -769,9 +803,11 @@ class Viewer(wx.Panel):
if self.anglethreshold * const.ARROW_SCALE > coordz > -self.anglethreshold * const.ARROW_SCALE:
thrcoordz = True
+ # self.obj_actor_list[1].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
self.obj_actor_list[1].GetProperty().SetColor(0, 1, 0)
else:
thrcoordz = False
+ # self.obj_actor_list[1].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
self.obj_actor_list[1].GetProperty().SetColor(1, 1, 1)
offset = -35
@@ -788,9 +824,11 @@ class Viewer(wx.Panel):
if self.anglethreshold * const.ARROW_SCALE > coordy > -self.anglethreshold * const.ARROW_SCALE:
thrcoordy = True
+ #self.obj_actor_list[2].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
self.obj_actor_list[2].GetProperty().SetColor(0, 1, 0)
else:
thrcoordy = False
+ #self.obj_actor_list[2].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite'))
self.obj_actor_list[2].GetProperty().SetColor(1, 1, 1)
offset = 38
@@ -808,9 +846,9 @@ class Viewer(wx.Panel):
arrow_pitch_y2.GetProperty().SetColor(1, 0, 0)
if thrdist and thrcoordx and thrcoordy and thrcoordz:
- self.dummy_coil_actor.GetProperty().SetColor(0, 1, 0)
+ self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green'))
else:
- self.dummy_coil_actor.GetProperty().SetColor(1, 1, 1)
+ self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('DarkOrange'))
self.arrow_actor_list = arrow_roll_x1, arrow_roll_x2, arrow_yaw_z1, arrow_yaw_z2, \
arrow_pitch_y1, arrow_pitch_y2
@@ -818,10 +856,6 @@ class Viewer(wx.Panel):
for ind in self.arrow_actor_list:
self.ren2.AddActor(ind)
-
- x, y, z = bases.flip_x(coord[0:3])
- self.tactor.SetPosition(x-20, y-30, z+20)
-
self.Refresh()
def OnUpdateTargetCoordinates(self, coord):
@@ -841,26 +875,7 @@ class Viewer(wx.Panel):
self.RemoveTargetAim()
self.aim_actor = None
- self.textSource = vtk.vtkVectorText()
- mapper = vtk.vtkPolyDataMapper()
- mapper.SetInputConnection(self.textSource.GetOutputPort())
- tactor = vtk.vtkFollower()
- tactor.SetMapper(mapper)
- tactor.GetProperty().SetColor(1.0, 0.25, 0.0)
- tactor.SetScale(5)
- #tactor.SetPosition(self.target_coord[0]+10, self.target_coord[1]+30, self.target_coord[2]+20)
- self.ren.AddActor(tactor)
- self.tactor = tactor
- tactor.SetCamera(self.ren.GetActiveCamera())
-
-
- # v3, M_plane_inv = self.Plane(self.target_coord[0:3], self.pTarget)
- # mat4x4 = vtk.vtkMatrix4x4()
- # for i in range(4):
- # mat4x4.SetElement(i, 0, M_plane_inv[i][0])
- # mat4x4.SetElement(i, 1, M_plane_inv[i][1])
- # mat4x4.SetElement(i, 2, M_plane_inv[i][2])
- # mat4x4.SetElement(i, 3, M_plane_inv[i][3])
+ vtk_colors = vtk.vtkNamedColors()
a, b, g = np.radians(self.target_coord[3:])
r_ref = tr.euler_matrix(a, b, g, 'sxyz')
@@ -885,7 +900,6 @@ class Viewer(wx.Panel):
# Transform the polydata
transform = vtk.vtkTransform()
transform.SetMatrix(m_img_vtk)
- #transform.SetMatrix(mat4x4)
transformPD = vtk.vtkTransformPolyDataFilter()
transformPD.SetTransform(transform)
transformPD.SetInputConnection(reader.GetOutputPort())
@@ -895,8 +909,10 @@ class Viewer(wx.Panel):
aim_actor = vtk.vtkActor()
aim_actor.SetMapper(mapper)
- aim_actor.GetProperty().SetColor(1, 1, 1)
- aim_actor.GetProperty().SetOpacity(0.6)
+ aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Yellow'))
+ aim_actor.GetProperty().SetSpecular(.2)
+ aim_actor.GetProperty().SetSpecularPower(100)
+ aim_actor.GetProperty().SetOpacity(1.)
self.aim_actor = aim_actor
self.ren.AddActor(aim_actor)
@@ -919,11 +935,14 @@ class Viewer(wx.Panel):
obj_mapper = vtk.vtkPolyDataMapper()
obj_mapper.SetInputData(normals.GetOutput())
obj_mapper.ScalarVisibilityOff()
- obj_mapper.ImmediateModeRenderingOn() # improve performance
+ #obj_mapper.ImmediateModeRenderingOn() # improve performance
self.dummy_coil_actor = vtk.vtkActor()
self.dummy_coil_actor.SetMapper(obj_mapper)
- self.dummy_coil_actor.GetProperty().SetOpacity(0.15)
+ self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('DarkOrange'))
+ self.dummy_coil_actor.GetProperty().SetSpecular(0.5)
+ self.dummy_coil_actor.GetProperty().SetSpecularPower(10)
+ self.dummy_coil_actor.GetProperty().SetOpacity(.3)
self.dummy_coil_actor.SetVisibility(1)
self.dummy_coil_actor.SetUserMatrix(m_img_vtk)
@@ -934,24 +953,24 @@ class Viewer(wx.Panel):
def RemoveTargetAim(self):
self.ren.RemoveActor(self.aim_actor)
self.ren.RemoveActor(self.dummy_coil_actor)
- self.ren.RemoveActor(self.tactor)
self.Refresh()
def CreateTextDistance(self):
- txt = vtku.Text()
- txt.SetSize(const.TEXT_SIZE_EXTRA_LARGE)
- txt.SetPosition((0.76, 0.05))
- txt.ShadowOff()
- txt.BoldOn()
- self.txt = txt
- self.ren2.AddActor(txt.actor)
+ tdist = vtku.Text()
+ tdist.SetSize(const.TEXT_SIZE_DIST_NAV)
+ tdist.SetPosition((const.X, 1.03-const.Y))
+ #tdist.ShadowOff()
+ tdist.BoldOn()
+
+ self.ren.AddActor(tdist.actor)
+ self.tdist = tdist
def DisableCoilTracker(self):
try:
self.ren.SetViewport(0, 0, 1, 1)
self.interactor.GetRenderWindow().RemoveRenderer(self.ren2)
self.SetViewAngle(const.VOL_FRONT)
- self.ren.RemoveActor(self.txt.actor)
+ self.ren.RemoveActor(self.tdist.actor)
self.CreateTargetAim()
self.interactor.Render()
except:
@@ -1172,7 +1191,7 @@ class Viewer(wx.Panel):
"""
Coil for navigation rendered in volume viewer.
"""
-
+ vtk_colors = vtk.vtkNamedColors()
obj_polydata = self.CreateObjectPolyData(obj_name)
transform = vtk.vtkTransform()
@@ -1192,11 +1211,14 @@ class Viewer(wx.Panel):
obj_mapper = vtk.vtkPolyDataMapper()
obj_mapper.SetInputData(normals.GetOutput())
obj_mapper.ScalarVisibilityOff()
- obj_mapper.ImmediateModeRenderingOn() # improve performance
+ #obj_mapper.ImmediateModeRenderingOn() # improve performance
self.obj_actor = vtk.vtkActor()
self.obj_actor.SetMapper(obj_mapper)
- self.obj_actor.GetProperty().SetOpacity(0.9)
+ self.obj_actor.GetProperty().SetAmbientColor(vtk_colors.GetColor3d('GhostWhite'))
+ self.obj_actor.GetProperty().SetSpecular(30)
+ self.obj_actor.GetProperty().SetSpecularPower(80)
+ self.obj_actor.GetProperty().SetOpacity(.4)
self.obj_actor.SetVisibility(0)
self.ren.AddActor(self.obj_actor)
=====================================
invesalius/gui/default_viewers.py
=====================================
@@ -488,9 +488,11 @@ class VolumeToolPanel(wx.Panel):
if not self.button_target.IsPressed() and evt is not False:
self.button_target._pressed = True
Publisher.sendMessage('Target navigation mode', target_mode=self.button_target._pressed)
+ Publisher.sendMessage('Change camera checkbox', status=self.button_target._pressed)
elif self.button_target.IsPressed() or evt is False:
self.button_target._pressed = False
Publisher.sendMessage('Target navigation mode', target_mode=self.button_target._pressed)
+ Publisher.sendMessage('Change camera checkbox', status=self.button_target._pressed)
def OnSavePreset(self, evt):
d = wx.TextEntryDialog(self, _("Preset name"))
=====================================
invesalius/gui/dialogs.py
=====================================
@@ -48,7 +48,6 @@ from wx.lib.agw import floatspin
from wx.lib.wordwrap import wordwrap
from wx.lib.pubsub import pub as Publisher
-
try:
from wx.adv import AboutDialogInfo, AboutBox
except ImportError:
@@ -923,11 +922,13 @@ def NavigationTrackerWarning(trck_id, lib_mode):
"""
Spatial Tracker connection error
"""
- trck = {1: 'Claron MicronTracker',
- 2: 'Polhemus FASTRAK',
- 3: 'Polhemus ISOTRAK',
- 4: 'Polhemus PATRIOT',
- 5: 'Debug tracker device'}
+ trck = {const.MTC: 'Claron MicronTracker',
+ const.FASTRAK: 'Polhemus FASTRAK',
+ const.ISOTRAKII: 'Polhemus ISOTRAK',
+ const.PATRIOT: 'Polhemus PATRIOT',
+ const.CAMERA: 'CAMERA',
+ const.POLARIS: 'NDI Polaris',
+ const.DEBUGTRACK: 'Debug tracker device'}
if lib_mode == 'choose':
msg = _('No tracking device selected')
@@ -1240,7 +1241,7 @@ def ShowAboutDialog(parent):
info = AboutDialogInfo()
info.Name = "InVesalius"
- info.Version = "3.1.1"
+ info.Version = const.INVESALIUS_VERSION
info.Copyright = _("(c) 2007-2019 Center for Information Technology Renato Archer - CTI")
info.Description = wordwrap(_("InVesalius is a medical imaging program for 3D reconstruction. It uses a sequence of 2D DICOM image files acquired with CT or MRI scanners. InVesalius allows exporting 3D volumes or surfaces as mesh files for creating physical models of a patient's anatomy using additive manufacturing (3D printing) technologies. The software is developed by Center for Information Technology Renato Archer (CTI), National Council for Scientific and Technological Development (CNPq) and the Brazilian Ministry of Health.\n\n InVesalius must be used only for research. The Center for Information Technology Renato Archer is not responsible for damages caused by the use of this software.\n\n Contact: invesalius at cti.gov.br"), 350, wx.ClientDC(parent))
@@ -1249,7 +1250,13 @@ def ShowAboutDialog(parent):
# _("The software also allows generating correspondent STL files,")+\
# _("so the user can print 3D physical models of the patient's anatomy ")+\
# _("using Rapid Prototyping."), 350, wx.ClientDC(parent))
- info.WebSite = ("https://www.cti.gov.br/invesalius")
+
+ icon = wx.Icon(os.path.join(inv_paths.ICON_DIR, "invesalius_64x64.ico"),\
+ wx.BITMAP_TYPE_ICO)
+
+ info.SetWebSite("https://www.cti.gov.br/invesalius")
+ info.SetIcon(icon)
+
info.License = _("GNU GPL (General Public License) version 2")
info.Developers = [u"Paulo Henrique Junqueira Amorim",
@@ -1997,7 +2004,7 @@ class MaskBooleanDialog(wx.Dialog):
else:
self.mask2.SetSelection(0)
- icon_folder = const.ICON_DIR
+ icon_folder = inv_paths.ICON_DIR
op_choices = ((_(u"Union"), const.BOOLEAN_UNION, 'bool_union.png'),
(_(u"Difference"), const.BOOLEAN_DIFF, 'bool_difference.png'),
(_(u"Intersection"), const.BOOLEAN_AND, 'bool_intersection.png'),
@@ -3319,7 +3326,7 @@ class ObjectCalibrationDialog(wx.Dialog):
self.tracker_id = nav_prop[0]
self.trk_init = nav_prop[1]
- self.obj_ref_id = 0
+ self.obj_ref_id = 2
self.obj_name = None
self.obj_fiducials = np.full([5, 3], np.nan)
@@ -3347,11 +3354,11 @@ class ObjectCalibrationDialog(wx.Dialog):
tooltip = wx.ToolTip(_(u"Choose the object reference mode"))
choice_ref = wx.ComboBox(self, -1, "", size=wx.Size(90, 23),
choices=const.REF_MODE, style=wx.CB_DROPDOWN | wx.CB_READONLY)
- choice_ref.SetSelection(self.obj_ref_id)
+ choice_ref.SetSelection(1)
choice_ref.SetToolTip(tooltip)
choice_ref.Bind(wx.EVT_COMBOBOX, self.OnChoiceRefMode)
choice_ref.Enable(0)
- if self.tracker_id == const.MTC or self.tracker_id == const.FASTRAK or self.tracker_id == const.DEBUGTRACK:
+ if not (self.tracker_id == const.PATRIOT or self.tracker_id == const.ISOTRAKII):
choice_ref.Enable(1)
# ComboBox for sensor selection for FASTRAK
@@ -3361,7 +3368,10 @@ class ObjectCalibrationDialog(wx.Dialog):
choice_sensor.SetSelection(0)
choice_sensor.SetToolTip(tooltip)
choice_sensor.Bind(wx.EVT_COMBOBOX, self.OnChoiceFTSensor)
- choice_sensor.Show(False)
+ if self.tracker_id == const.FASTRAK or self.tracker_id == const.DEBUGTRACK:
+ choice_sensor.Show(True)
+ else:
+ choice_sensor.Show(False)
self.choice_sensor = choice_sensor
# Buttons to finish or cancel object registration
@@ -3480,7 +3490,7 @@ class ObjectCalibrationDialog(wx.Dialog):
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputData(normals.GetOutput())
mapper.ScalarVisibilityOff()
- mapper.ImmediateModeRenderingOn()
+ #mapper.ImmediateModeRenderingOn()
obj_actor = vtk.vtkActor()
obj_actor.SetMapper(mapper)
@@ -3556,16 +3566,19 @@ class ObjectCalibrationDialog(wx.Dialog):
if evt.GetSelection():
self.obj_ref_id = 2
if self.tracker_id == const.FASTRAK or self.tracker_id == const.DEBUGTRACK:
- self.choice_sensor.Show(True)
- self.Layout()
+ self.choice_sensor.Show(self.obj_ref_id)
else:
self.obj_ref_id = 0
+ self.choice_sensor.Show(self.obj_ref_id)
for m in range(0, 5):
self.obj_fiducials[m, :] = np.full([1, 3], np.nan)
self.obj_orients[m, :] = np.full([1, 3], np.nan)
for n in range(0, 3):
self.txt_coord[m][n].SetLabel('-')
+ # Used to update choice sensor controls
+ self.Layout()
+
def OnChoiceFTSensor(self, evt):
if evt.GetSelection():
self.obj_ref_id = 3
@@ -3778,3 +3791,169 @@ class GoToDialogScannerCoord(wx.Dialog):
def Close(self):
wx.Dialog.Close(self)
self.Destroy()
+
+
+class SetNDIconfigs(wx.Dialog):
+ def __init__(self, title=_("Setting NDI polaris configs:")):
+ wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, title, size=wx.Size(1000, 200),
+ style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP|wx.RESIZE_BORDER)
+ self._init_gui()
+
+ def serial_ports(self):
+ """ Lists serial port names and pre-select the description containing NDI
+ """
+ import serial.tools.list_ports
+
+ ports = serial.tools.list_ports.comports()
+ if sys.platform.startswith('win'):
+ port_list = []
+ count = 0
+ for port, desc, hwid in sorted(ports):
+ port_list.append(port)
+ if 'NDI' in desc:
+ port_selec = port, count
+ count += 1
+ else:
+ raise EnvironmentError('Unsupported platform')
+
+ #print("Here is the chosen port: {} with id {}".format(port_selec[0], port_selec[1]))
+
+ return port_list, port_selec
+
+ def _init_gui(self):
+ self.com_ports = wx.ComboBox(self, -1, style=wx.CB_DROPDOWN|wx.CB_READONLY)
+ row_com = wx.BoxSizer(wx.VERTICAL)
+ row_com.Add(wx.StaticText(self, wx.ID_ANY, "Select the COM port"), 0, wx.TOP|wx.RIGHT,5)
+ row_com.Add(self.com_ports, 0, wx.EXPAND)
+
+ port_list, port_selec = self.serial_ports()
+
+ self.com_ports.Append(port_list)
+ self.com_ports.SetSelection(port_selec[1])
+
+ session = ses.Session()
+ last_ndi_probe_marker = session.get('paths', 'last_ndi_probe_marker', '')
+ last_ndi_ref_marker = session.get('paths', 'last_ndi_ref_marker', '')
+ last_ndi_obj_marker = session.get('paths', 'last_ndi_obj_marker', '')
+
+ if not last_ndi_probe_marker:
+ last_ndi_probe_marker = inv_paths.NDI_MAR_DIR_PROBE
+ if not last_ndi_ref_marker:
+ last_ndi_ref_marker = inv_paths.NDI_MAR_DIR_REF
+ if not last_ndi_obj_marker:
+ last_ndi_obj_marker = inv_paths.NDI_MAR_DIR_OBJ
+
+ self.dir_probe = wx.FilePickerCtrl(self, path=last_ndi_probe_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
+ wildcard="Rom files (*.rom)|*.rom", message="Select probe's rom file")
+ row_probe = wx.BoxSizer(wx.VERTICAL)
+ row_probe.Add(wx.StaticText(self, wx.ID_ANY, "Set probe's rom file"), 0, wx.TOP|wx.RIGHT, 5)
+ row_probe.Add(self.dir_probe, 0, wx.EXPAND|wx.ALIGN_CENTER)
+
+ self.dir_ref = wx.FilePickerCtrl(self, path=last_ndi_ref_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
+ wildcard="Rom files (*.rom)|*.rom", message="Select reference's rom file")
+ row_ref = wx.BoxSizer(wx.VERTICAL)
+ row_ref.Add(wx.StaticText(self, wx.ID_ANY, "Set reference's rom file"), 0, wx.TOP | wx.RIGHT, 5)
+ row_ref.Add(self.dir_ref, 0, wx.EXPAND|wx.ALIGN_CENTER)
+
+ self.dir_obj = wx.FilePickerCtrl(self, path=last_ndi_obj_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL,
+ wildcard="Rom files (*.rom)|*.rom", message="Select object's rom file")
+ #self.dir_probe.Bind(wx.EVT_FILEPICKER_CHANGED, self.Selected)
+ row_obj = wx.BoxSizer(wx.VERTICAL)
+ row_obj.Add(wx.StaticText(self, wx.ID_ANY, "Set object's rom file"), 0, wx.TOP|wx.RIGHT, 5)
+ row_obj.Add(self.dir_obj, 0, wx.EXPAND|wx.ALIGN_CENTER)
+
+ btn_ok = wx.Button(self, wx.ID_OK)
+ btn_ok.SetHelpText("")
+ btn_ok.SetDefault()
+
+ btn_cancel = wx.Button(self, wx.ID_CANCEL)
+ btn_cancel.SetHelpText("")
+
+ btnsizer = wx.StdDialogButtonSizer()
+ btnsizer.AddButton(btn_ok)
+ btnsizer.AddButton(btn_cancel)
+ btnsizer.Realize()
+
+ main_sizer = wx.BoxSizer(wx.VERTICAL)
+
+ main_sizer.Add((5, 5))
+ main_sizer.Add(row_com, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
+ main_sizer.Add((5, 5))
+ main_sizer.Add(row_probe, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
+ main_sizer.Add((5, 5))
+ main_sizer.Add(row_ref, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
+ main_sizer.Add((5, 5))
+ main_sizer.Add(row_obj, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
+ main_sizer.Add((15, 15))
+ main_sizer.Add(btnsizer, 0, wx.EXPAND)
+ main_sizer.Add((5, 5))
+
+ self.SetSizer(main_sizer)
+ main_sizer.Fit(self)
+
+ self.CenterOnParent()
+
+ def GetValue(self):
+ fn_probe = self.dir_probe.GetPath().encode(const.FS_ENCODE)
+ fn_ref = self.dir_ref.GetPath().encode(const.FS_ENCODE)
+ fn_obj = self.dir_obj.GetPath().encode(const.FS_ENCODE)
+
+ if fn_probe and fn_ref and fn_obj:
+ session = ses.Session()
+ session['paths']['last_ndi_probe_marker'] = self.dir_probe.GetPath()
+ session['paths']['last_ndi_ref_marker'] = self.dir_ref.GetPath()
+ session['paths']['last_ndi_obj_marker'] = self.dir_obj.GetPath()
+ session.WriteSessionFile()
+
+ return self.com_ports.GetString(self.com_ports.GetSelection()).encode(const.FS_ENCODE), fn_probe, fn_ref, fn_obj
+
+
+class SetCOMport(wx.Dialog):
+ def __init__(self, title=_("Select COM port")):
+ wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, title, style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP)
+ self._init_gui()
+
+ def serial_ports(self):
+ """ Lists serial port names
+ """
+ import serial.tools.list_ports
+ if sys.platform.startswith('win'):
+ ports = ([comport.device for comport in serial.tools.list_ports.comports()])
+ else:
+ raise EnvironmentError('Unsupported platform')
+ return ports
+
+ def _init_gui(self):
+ self.com_ports = wx.ComboBox(self, -1, style=wx.CB_DROPDOWN|wx.CB_READONLY)
+ ports = self.serial_ports()
+ self.com_ports.Append(ports)
+
+ # self.goto_orientation.SetSelection(cb_init)
+
+ btn_ok = wx.Button(self, wx.ID_OK)
+ btn_ok.SetHelpText("")
+ btn_ok.SetDefault()
+
+ btn_cancel = wx.Button(self, wx.ID_CANCEL)
+ btn_cancel.SetHelpText("")
+
+ btnsizer = wx.StdDialogButtonSizer()
+ btnsizer.AddButton(btn_ok)
+ btnsizer.AddButton(btn_cancel)
+ btnsizer.Realize()
+
+ main_sizer = wx.BoxSizer(wx.VERTICAL)
+
+ main_sizer.Add((5, 5))
+ main_sizer.Add(self.com_ports, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
+ main_sizer.Add((5, 5))
+ main_sizer.Add(btnsizer, 0, wx.EXPAND)
+ main_sizer.Add((5, 5))
+
+ self.SetSizer(main_sizer)
+ main_sizer.Fit(self)
+
+ self.CenterOnParent()
+
+ def GetValue(self):
+ return self.com_ports.GetString(self.com_ports.GetSelection())
=====================================
invesalius/gui/frame.py
=====================================
@@ -1234,7 +1234,7 @@ class TaskBarIcon(wx_TaskBarIcon):
wx_TaskBarIcon.__init__(self)
self.frame = parent
- icon = wx.Icon(os.path.join(const.ICON_DIR, "invesalius.ico"),
+ icon = wx.Icon(os.path.join(inv_paths.ICON_DIR, "invesalius.ico"),
wx.BITMAP_TYPE_ICO)
self.SetIcon(icon, "InVesalius")
self.imgidx = 1
=====================================
invesalius/gui/task_navigator.py
=====================================
@@ -229,18 +229,16 @@ class InnerFoldPanel(wx.Panel):
def __bind_events(self):
Publisher.subscribe(self.OnCheckStatus, 'Navigation status')
Publisher.subscribe(self.OnShowObject, 'Update track object state')
- Publisher.subscribe(self.OnVolumeCamera, 'Target navigation mode')
+ Publisher.subscribe(self.OnVolumeCamera, 'Change camera checkbox')
Publisher.subscribe(self.OnShowDbs, "Active dbs folder")
Publisher.subscribe(self.OnHideDbs, "Deactive dbs folder")
def OnShowDbs(self):
self.dbs_item.Show()
-
def OnHideDbs(self):
self.dbs_item.Hide()
-
def OnCheckStatus(self, status):
if status:
self.checktrigger.Enable(False)
@@ -257,6 +255,7 @@ class InnerFoldPanel(wx.Panel):
if not evt:
if flag:
self.checkobj.Enable(True)
+ self.checkobj.SetValue(True)
self.track_obj = True
Publisher.sendMessage('Status target button', status=True)
else:
@@ -267,12 +266,12 @@ class InnerFoldPanel(wx.Panel):
Publisher.sendMessage('Update show object state', state=self.checkobj.GetValue())
- def OnVolumeCamera(self, evt=None, target_mode=None):
+ def OnVolumeCamera(self, evt=None, status=None):
if not evt:
- if target_mode is True:
- self.checkcamera.SetValue(0)
+ self.checkcamera.SetValue(status)
Publisher.sendMessage('Update volume camera state', camera_state=self.checkcamera.GetValue())
+
class NeuronavigationPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
@@ -453,7 +452,7 @@ class NeuronavigationPanel(wx.Panel):
if hasattr(evt, 'GetSelection'):
choice = evt.GetSelection()
else:
- choice = 6
+ choice = const.DISCTRACK
if self.trk_init:
trck = self.trk_init[0]
@@ -462,7 +461,7 @@ class NeuronavigationPanel(wx.Panel):
# Conditions check if click was on current selection and if any other tracker
# has been initialized before
- if trck and choice != 6:
+ if trck and choice != const.DISCTRACK:
self.ResetTrackerFiducials()
Publisher.sendMessage('Update status text in GUI',
label=_("Disconnecting tracker..."))
@@ -480,7 +479,7 @@ class NeuronavigationPanel(wx.Panel):
else:
ctrl.SetSelection(self.tracker_id)
print("Tracker connected!")
- elif choice == 6:
+ elif choice == const.DISCTRACK:
if trck:
self.ResetTrackerFiducials()
Publisher.sendMessage('Update status text in GUI',
@@ -890,6 +889,10 @@ class ObjectRegistrationPanel(wx.Panel):
data=(self.obj_fiducials, self.obj_orients, self.obj_ref_mode, self.obj_name))
Publisher.sendMessage('Update status text in GUI',
label=_("Ready"))
+ # Enable automatically Track object, Show coil and disable Vol. Camera
+ self.checktrack.SetValue(True)
+ Publisher.sendMessage('Update track object state', flag=True, obj_name=self.obj_name)
+ Publisher.sendMessage('Change camera checkbox', status=False)
except wx._core.PyAssertionError: # TODO FIX: win64
pass
@@ -916,6 +919,9 @@ class ObjectRegistrationPanel(wx.Panel):
Publisher.sendMessage('Update object registration',
data=(self.obj_fiducials, self.obj_orients, self.obj_ref_mode, self.obj_name))
Publisher.sendMessage('Update status text in GUI', label=_("Ready"))
+ self.checktrack.SetValue(True)
+ Publisher.sendMessage('Update track object state', flag=True, obj_name=self.obj_name)
+ Publisher.sendMessage('Change camera checkbox', status=False)
wx.MessageBox(_("Object file successfully loaded"), _("Load"))
def ShowSaveObjectDialog(self, evt):
@@ -963,8 +969,8 @@ class MarkersPanel(wx.Panel):
self.tgt_flag = self.tgt_index = None
self.nav_status = False
- self.marker_colour = (0.0, 0.0, 1.)
- self.marker_size = 4
+ self.marker_colour = (1.0, 1.0, 0.)
+ self.marker_size = 3
# Change marker size
spin_size = wx.SpinCtrl(self, -1, "", size=wx.Size(40, 23))
@@ -1058,9 +1064,7 @@ class MarkersPanel(wx.Panel):
self.nav_status = True
def OnMouseRightDown(self, evt):
- self.OnListEditMarkerId(self.nav_status)
-
- def OnListEditMarkerId(self, status):
+ # TODO: Enable the "Set as target" only when target is created with registered object
menu_id = wx.Menu()
edit_id = menu_id.Append(0, _('Edit ID'))
menu_id.Bind(wx.EVT_MENU, self.OnMenuEditMarkerId, edit_id)
@@ -1070,7 +1074,7 @@ class MarkersPanel(wx.Panel):
target_menu = menu_id.Append(1, _('Set as target'))
menu_id.Bind(wx.EVT_MENU, self.OnMenuSetTarget, target_menu)
- target_menu.Enable(status)
+ target_menu.Enable(True)
self.PopupMenu(menu_id)
menu_id.Destroy()
=====================================
invesalius/gui/task_tools.py
=====================================
@@ -78,9 +78,9 @@ class InnerTaskPanel(wx.Panel):
txt_annotation.Bind(hl.EVT_HYPERLINK_LEFT, self.OnTextAnnotation)
# Image(s) for buttons
- BMP_ANNOTATE = wx.Bitmap(os.path.join(const.ICON_DIR, "annotation.png"), wx.BITMAP_TYPE_PNG)
- BMP_ANGLE = wx.Bitmap(os.path.join(const.ICON_DIR, "measure_angle.jpg"), wx.BITMAP_TYPE_JPEG)
- BMP_DISTANCE = wx.Bitmap(os.path.join(const.ICON_DIR, "measure_line.png"), wx.BITMAP_TYPE_PNG)
+ BMP_ANNOTATE = wx.Bitmap(os.path.join(inv_paths.ICON_DIR, "annotation.png"), wx.BITMAP_TYPE_PNG)
+ BMP_ANGLE = wx.Bitmap(os.path.join(inv_paths.ICON_DIR, "measure_angle.jpg"), wx.BITMAP_TYPE_JPEG)
+ BMP_DISTANCE = wx.Bitmap(os.path.join(inv_paths.ICON_DIR, "measure_line.png"), wx.BITMAP_TYPE_PNG)
BMP_ANNOTATE.SetWidth(25)
BMP_ANNOTATE.SetHeight(25)
BMP_ANGLE.SetWidth(25)
=====================================
invesalius/inv_paths.py
=====================================
@@ -49,9 +49,14 @@ else:
)
# Navigation paths
-CAL_DIR = INV_TOP_DIR.joinpath("navigation", "mtc_files", "CalibrationFiles")
-MAR_DIR = INV_TOP_DIR.joinpath("navigation", "mtc_files", "Markers")
-OBJ_DIR = INV_TOP_DIR.joinpath("navigation", "objects")
+OBJ_DIR = str(INV_TOP_DIR.joinpath("navigation", "objects"))
+
+MTC_CAL_DIR = str(INV_TOP_DIR.joinpath("navigation", "mtc_files", "CalibrationFiles"))
+MTC_MAR_DIR = str(INV_TOP_DIR.joinpath("navigation", "mtc_files", "Markers"))
+
+NDI_MAR_DIR_PROBE = str(INV_TOP_DIR.joinpath("navigation", "ndi_files", "Markers", "8700340.rom"))
+NDI_MAR_DIR_REF = str(INV_TOP_DIR.joinpath("navigation", "ndi_files", "Markers", "8700339.rom"))
+NDI_MAR_DIR_OBJ = str(INV_TOP_DIR.joinpath("navigation", "ndi_files", "Markers", "8700338.rom"))
# MAC App
if not os.path.exists(ICON_DIR):
=====================================
navigation/mtc_files/Markers/3Coil_big
=====================================
@@ -0,0 +1,39 @@
+
+[Marker]
+FacetsCount=1
+SliderControlledXpointsCount=0
+Name=3Coil_big
+
+[Facet1]
+VectorsCount=2
+
+[Facet1V1]
+EndPos(0,0)=-12.130921665071337
+EndPos(0,1)=4.771099944171531e-005
+EndPos(0,2)=-1.6777868612989378e-016
+EndPos(1,0)=12.131083622124752
+EndPos(1,1)=1.0800131569805988e-004
+EndPos(1,2)=-2.4831245547224282e-015
+
+[Facet1V2]
+EndPos(0,0)=-12.143021882072084
+EndPos(0,1)=-16.190735690907974
+EndPos(0,2)=-1.3422294890391503e-015
+EndPos(1,0)=-12.130921665071337
+EndPos(1,1)=4.771099944171531e-005
+EndPos(1,2)=-1.6777868612989378e-016
+
+[Tooltip2MarkerXf]
+Scale=1.
+S0=0.
+R0,0=1.
+R1,0=0.
+R2,0=0.
+S1=0.
+R0,1=0.
+R1,1=1.
+R2,1=0.
+S2=0.
+R0,2=0.
+R1,2=0.
+R2,2=1.
=====================================
navigation/ndi_files/Markers/8700338.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/8700338.rom differ
=====================================
navigation/ndi_files/Markers/8700339.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/8700339.rom differ
=====================================
navigation/ndi_files/Markers/8700340.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/8700340.rom differ
=====================================
navigation/ndi_files/Markers/NBSprobe.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/NBSprobe.rom differ
=====================================
navigation/ndi_files/Markers/NBSref.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/NBSref.rom differ
=====================================
navigation/ndi_files/Markers/NT-103.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/NT-103.rom differ
=====================================
navigation/ndi_files/Markers/NT-112.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/NT-112.rom differ
=====================================
navigation/ndi_files/Markers/NT-115.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/NT-115.rom differ
=====================================
navigation/ndi_files/Markers/active-wireless.rom
=====================================
Binary files /dev/null and b/navigation/ndi_files/Markers/active-wireless.rom differ
View it on GitLab: https://salsa.debian.org/med-team/invesalius/-/commit/87652a613c56fad0a050bbe8506b1fca68777727
--
View it on GitLab: https://salsa.debian.org/med-team/invesalius/-/commit/87652a613c56fad0a050bbe8506b1fca68777727
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200301/4f73effc/attachment-0001.html>
More information about the debian-med-commit
mailing list