diff --git a/invesalius/constants.py b/invesalius/constants.py index ddeaa3b..47274c2 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -43,7 +43,7 @@ TEXT_POS_RIGHT_DOWN = (1-X, 1-Y) # SetVerticalJustificationToBottom & # SetJustificationToRight #------------------------------------------------------------------ TEXT_POS_HCENTRE_DOWN = (0.5, 1-Y) # SetJustificationToCentered - # SetVerticalJustificationToBottom + # ChildrticalJustificationToBottom #------------------------------------------------------------------ TEXT_POS_HCENTRE_UP = (0.5, Y) # SetJustificationToCentered #------------------------------------------------------------------ @@ -102,13 +102,13 @@ MODE_ODONTOLOGY = 3 #Color Table from Slice #NumberOfColors, SaturationRange, HueRange, ValueRange -SLICE_COLOR_TABLE = {"Default ":(None,(0,0),(0,0),(0,1)), - "Hue":(None,(1,1),(0,1),(1,1)), - "Saturation":(None,(0,1),(0.6,0.6),(1,1)), - "Desert":(256, (1,1), (0, 0.1), (1,1)), - "Rainbow":(256,(1,1),(0,0.8),(1,1)), - "Ocen":(256,(1,1),(0.667, 0.5),(1,1)), - "Inverse Gray":(256, (0, 0), (0, 0), (1,0)), +SLICE_COLOR_TABLE = {_("Default "):(None,(0,0),(0,0),(0,1)), + _("Hue"):(None,(1,1),(0,1),(1,1)), + _("Saturation"):(None,(0,1),(0.6,0.6),(1,1)), + _("Desert"):(256, (1,1), (0, 0.1), (1,1)), + _("Rainbow"):(256,(1,1),(0,0.8),(1,1)), + _("Ocen"):(256,(1,1),(0.667, 0.5),(1,1)), + _("Inverse Gray"):(256, (0, 0), (0, 0), (1,0)), } # Volume view angle @@ -149,14 +149,14 @@ VOLUME_POSITION = {AXIAL: [AXIAL_VOLUME_CAM_VIEW_UP, AXIAL_VOLUME_CAM_POSITION], # Mask threshold options proj = Project() -THRESHOLD_RANGE = proj.threshold_modes["Bone"] +THRESHOLD_RANGE = proj.threshold_modes[_("Bone")] THRESHOLD_PRESETS_INDEX = 0 #Bone THRESHOLD_HUE_RANGE = (0, 0.6667) THRESHOLD_INVALUE = 5000 THRESHOLD_OUTVALUE = 0 # Mask properties -MASK_NAME_PATTERN = "Mask %d" +MASK_NAME_PATTERN = _("Mask %d") MASK_OPACITY = 0.40 #MASK_OPACITY = 0.35 MASK_COLOUR = [(0.33, 1, 0.33), @@ -185,7 +185,7 @@ BRUSH_DRAW = 0 BRUSH_ERASE = 1 BRUSH_THRESH = 2 DEFAULT_BRUSH_OP = BRUSH_THRESH -BRUSH_OP_NAME = ["Draw", "Erase", "Threshold"] +BRUSH_OP_NAME = [_("Draw"), _("Erase"), _("Threshold")] BRUSH_COLOUR = (0,0,1.0) BRUSH_SIZE = 30 @@ -196,36 +196,36 @@ BRUSH_SIZE = 30 # 2: smooth_relaxation_factor # 3: decimate_reduction SURFACE_QUALITY = { - "Low": (3, 2, 0.3000, 0.4), - "Medium": (2, 2, 0.3000, 0.4), - "High": (0, 1, 0.3000, 0.1), - "Optimal": (0, 2, 0.3000, 0.4), - "Custom": (None, None, None, None)} -DEFAULT_SURFACE_QUALITY = "Optimal" + _("Low"): (3, 2, 0.3000, 0.4), + _("Medium"): (2, 2, 0.3000, 0.4), + _("High"): (0, 1, 0.3000, 0.1), + _("Optimal *"): (0, 2, 0.3000, 0.4), + _("Custom"): (None, None, None, None)} +DEFAULT_SURFACE_QUALITY = _("Optimal *") # Surface properties SURFACE_TRANSPARENCY = 0.0 -SURFACE_NAME_PATTERN = "Surface %d" +SURFACE_NAME_PATTERN = _("Surface %d") # Imagedata - window and level presets -WINDOW_LEVEL = {"Abdomen":(350,50), - "Bone":(2000, 300), - "Brain Posterior Fossa":(120,40), - "Brain":(80,40), - "Default":(None, None), #Control class set window and level from DICOM - "Emphysema":(500,-850), - "Ischemia - Hard Non Contrast":(15,32), - "Ischemia - Soft Non Contrast":(80,20), - "Larynx":(180, 80), - "Liver":(2000, -500), - "Lung - Soft":(1600,-600), - "Lung - Hard":(1000,-600), - "Mediastinum":(350,25), - "Manual":(None, None), #Case the user change window and level - "Pelvis": (450,50), - "Sinus":(4000, 400), - "Vasculature - Hard":(240,80), - "Vasculature - Soft":(650,160)} +WINDOW_LEVEL = {_("Abdomen"):(350,50), + _("Bone"):(2000, 300), + _("Brain Posterior Fossa"):(120,40), + _("Brain"):(80,40), + _("Default"):(None, None), #Control class set window and level from DICOM + _("Emphysema"):(500,-850), + _("Ischemia - Hard Non Contrast"):(15,32), + _("Ischemia - Soft Non Contrast"):(80,20), + _("Larynx"):(180, 80), + _("Liver"):(2000, -500), + _("Lung - Soft"):(1600,-600), + _("Lung - Hard"):(1000,-600), + _("Mediastinum"):(350,25), + _("Manual"):(None, None), #Case the user change window and level + _("Pelvis"): (450,50), + _("Sinus"):(4000, 400), + _("Vasculature - Hard"):(240,80), + _("Vasculature - Soft"):(650,160)} if (sys.platform == 'win32') and (platform.architecture()[0] == '32bit'): REDUCE_IMAGEDATA_QUALITY = 1 @@ -235,15 +235,14 @@ else: REDUCE_IMAGEDATA_QUALITY = 0 ICON_DIR = os.path.abspath(os.path.join('..', 'icons')) -LANGUAGE_DIR = os.path.abspath(os.path.join('..','locale')) - -ID_TO_BMP = {VOL_FRONT: ["Front", os.path.join(ICON_DIR, "view_front.png")], - VOL_BACK: ["Back", os.path.join(ICON_DIR, "view_back.png")], - VOL_TOP: ["Top", os.path.join(ICON_DIR, "view_top.png")], - VOL_BOTTOM: ["Bottom", os.path.join(ICON_DIR, "view_bottom.png")], - VOL_RIGHT: ["Right", os.path.join(ICON_DIR, "view_right.png")], - VOL_LEFT: ["Left", os.path.join(ICON_DIR, "view_left.png")], - VOL_ISO:["Isometric", os.path.join(ICON_DIR,"view_isometric.png")] + +ID_TO_BMP = {VOL_FRONT: [_("Front"), os.path.join(ICON_DIR, "view_front.png")], + VOL_BACK: [_("Back"), os.path.join(ICON_DIR, "view_back.png")], + VOL_TOP: [_("Top"), os.path.join(ICON_DIR, "view_top.png")], + VOL_BOTTOM: [_("Bottom"), os.path.join(ICON_DIR, "view_bottom.png")], + VOL_RIGHT: [_("Right"), os.path.join(ICON_DIR, "view_right.png")], + VOL_LEFT: [_("Left"), os.path.join(ICON_DIR, "view_left.png")], + VOL_ISO:[_("Isometric"), os.path.join(ICON_DIR,"view_isometric.png")] } # if 1, use vtkVolumeRaycastMapper, if 0, use vtkFixedPointVolumeRayCastMapper @@ -252,7 +251,38 @@ TYPE_RAYCASTING_MAPPER = 1 folder=RAYCASTING_PRESETS_DIRECTORY= os.path.abspath(os.path.join("..", "presets", "raycasting")) -RAYCASTING_TYPES = [filename.split(".")[0] for filename in +_("Airways") +_("Airways II") +_("Black & White") +_("Bone + Skin") +_("Bone + Skin II") +_("Dark Bone") +_("Glossy") +_("Glossy II") +_("Gold Bone") +_("High Contrast") +_("Low Contrast") +_("Soft on White") +_("Mid Contrast") +_("No Shading") +_("Pencil") +_("Red on White") +_("Skin On Blue") +_("Skin On Blue II") +_("Soft on White") +_("Soft + Skin") +_("Soft + Skin II") +_("Soft + Skin III") +_("Soft On Blue") +_("Soft") +_("Standard") +_("Vascular") +_("Vascular II") +_("Vascular III") +_("Vascular IV") +_("Yellow Bone") + +RAYCASTING_TYPES = [_(filename.split(".")[0]) for filename in os.listdir(folder) if os.path.isfile(os.path.join(folder,filename))] @@ -260,13 +290,13 @@ folder = os.path.join(os.path.expanduser('~'), '.invesalius', 'presets') if not os.path.isdir(folder): os.makedirs(folder) USER_RAYCASTING_PRESETS_DIRECTORY = folder -RAYCASTING_TYPES += [filename.split(".")[0] for filename in +RAYCASTING_TYPES += [_(filename.split(".")[0]) for filename in os.listdir(folder) if os.path.isfile(os.path.join(folder,filename))] -RAYCASTING_TYPES.append(' Off') +RAYCASTING_TYPES.append(_(' Off')) RAYCASTING_TYPES.sort() -RAYCASTING_OFF_LABEL = ' Off' -RAYCASTING_TOOLS = ["Cut plane"] +RAYCASTING_OFF_LABEL = _(' Off') +RAYCASTING_TOOLS = [_("Cut plane")] # If 0 dont't blur, 1 blur RAYCASTING_WWWL_BLUR = 0 diff --git a/invesalius/gui/data_notebook.py b/invesalius/gui/data_notebook.py index 5ce9738..c7dbc96 100644 --- a/invesalius/gui/data_notebook.py +++ b/invesalius/gui/data_notebook.py @@ -398,7 +398,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): else: print "unchecked, ", index - def InsertNewItem(self, index=0, type_="Mask 1", value="(1000, 4500)", + def InsertNewItem(self, index=0, type_="", value="(1000, 4500)", colour=None): self.InsertStringItem(index, "") self.SetStringItem(index, 1, type_, imageId = self.img_colour) diff --git a/invesalius/gui/dicom_preview_panel.py b/invesalius/gui/dicom_preview_panel.py index bac2971..a4f9285 100755 --- a/invesalius/gui/dicom_preview_panel.py +++ b/invesalius/gui/dicom_preview_panel.py @@ -320,8 +320,8 @@ class SingleImagePreview(wx.Panel): self.dicom_list = [] self.nimages = 1 self.current_index = 0 - self.window_width = const.WINDOW_LEVEL["Bone"][0] - self.window_level = const.WINDOW_LEVEL["Bone"][1] + self.window_width = const.WINDOW_LEVEL[_("Bone")][0] + self.window_level = const.WINDOW_LEVEL[_("Bone")][1] def __init_vtk(self): actor = vtk.vtkImageActor() diff --git a/invesalius/gui/language_dialog.py b/invesalius/gui/language_dialog.py index a91080a..75ddec3 100644 --- a/invesalius/gui/language_dialog.py +++ b/invesalius/gui/language_dialog.py @@ -22,8 +22,8 @@ import wx import wx.combo import i18n -import constants as const +ICON_DIR = os.path.abspath(os.path.join('..', 'icons')) class LanguageDialog(wx.Dialog): """Class define the language to be used in the InVesalius, @@ -46,9 +46,9 @@ class LanguageDialog(wx.Dialog): self.bitmapCmb = bitmapCmb = wx.combo.BitmapComboBox(self, style=wx.CB_READONLY) - bmp_brazilian_flag = wx.Bitmap(os.path.join(const.ICON_DIR, "pt_BR.bmp"), wx.BITMAP_TYPE_BMP) - bmp_english_flag = wx.Bitmap(os.path.join(const.ICON_DIR, "en_GB.bmp"), wx.BITMAP_TYPE_BMP) - bmp_spanish_flag = wx.Bitmap(os.path.join(const.ICON_DIR, "es.bmp"), wx.BITMAP_TYPE_BMP) + bmp_brazilian_flag = wx.Bitmap(os.path.join(ICON_DIR, "pt_BR.bmp"), wx.BITMAP_TYPE_BMP) + bmp_english_flag = wx.Bitmap(os.path.join(ICON_DIR, "en_GB.bmp"), wx.BITMAP_TYPE_BMP) + bmp_spanish_flag = wx.Bitmap(os.path.join(ICON_DIR, "es.bmp"), wx.BITMAP_TYPE_BMP) bitmapCmb.Append(self.locales[0], bmp_english_flag,"en_GB") bitmapCmb.Append(self.locales[1], bmp_brazilian_flag,"pt_BR") diff --git a/invesalius/gui/task_surface.py b/invesalius/gui/task_surface.py index fcbe3cc..8ec21ff 100644 --- a/invesalius/gui/task_surface.py +++ b/invesalius/gui/task_surface.py @@ -29,7 +29,7 @@ import gui.widgets.foldpanelbar as fpb #INTERPOLATION_MODE_LIST = ["Cubic", "Linear", "NearestNeighbor"] QUALITY_LIST = [_("Low"), _("Medium"), _("High"), _("Optimal *"), _("Custom")] SURFACE_LIST = [] -MASK_LIST = ["Mask 1"] +MASK_LIST = [] MIN_TRANSPARENCY = 0 MAX_TRANSPARENCY = 100 diff --git a/invesalius/i18n.py b/invesalius/i18n.py index 29d48fc..a9195d3 100644 --- a/invesalius/i18n.py +++ b/invesalius/i18n.py @@ -26,7 +26,7 @@ import gettext import os import sys -import constants as const +LANGUAGE_DIR = os.path.abspath(os.path.join('..','locale')) def GetLocales(): """Return a dictionary which defines supported languages""" @@ -45,7 +45,7 @@ def GetLocaleOS(): def InstallLanguage(language): - lang = gettext.translation('invesalius', const.LANGUAGE_DIR,\ + lang = gettext.translation('invesalius', LANGUAGE_DIR,\ languages=[language], codeset='utf8') # Using unicode lang.install(unicode=1) diff --git a/invesalius/presets.py b/invesalius/presets.py index 0aeb5d9..f60253a 100644 --- a/invesalius/presets.py +++ b/invesalius/presets.py @@ -27,39 +27,39 @@ class Presets(): def __init__(self): self.thresh_ct = TwoWaysDictionary({ - "Bone":(226,3071), - "Soft Tissue":(-700,225), - "Enamel (Adult)":(1553,2850), - "Enamel (Child)":(2042,3071), - "Compact Bone (Adult)":(662,1988), - "Compact Bone (Child)":(586,2198), - "Spongial Bone (Adult)":(148,661), - "Spongial Bone (Child)":(156,585), - "Muscle Tissue (Adult)":(-5,135), - "Muscle Tissue (Child)":(-25,139), - "Fat Tissue (Adult)":(-205,-51), - "Fat Tissue (Adult)":(-212,-72), - "Skin Tissue (Adult)":(-718,-177), - "Skin Tissue (Child)":(-766,-202), - "Custom":('', '') + _("Bone"):(226,3071), + _("Soft Tissue"):(-700,225), + _("Enamel (Adult)"):(1553,2850), + _("Enamel (Child)"):(2042,3071), + _("Compact Bone (Adult)"):(662,1988), + _("Compact Bone (Child)"):(586,2198), + _("Spongial Bone (Adult)"):(148,661), + _("Spongial Bone (Child)"):(156,585), + _("Muscle Tissue (Adult)"):(-5,135), + _("Muscle Tissue (Child)"):(-25,139), + _("Fat Tissue (Adult)"):(-205,-51), + _("Fat Tissue (Child)"):(-212,-72), + _("Skin Tissue (Adult)"):(-718,-177), + _("Skin Tissue (Child)"):(-766,-202), + _("Custom"):('', '') }) self.thresh_mri = TwoWaysDictionary({ - "Bone":(1250,4095), - "Soft Tissue":(324,1249), - "Enamel (Adult)":(2577,3874), - "Enamel (Child)":(3066,4095), - "Compact Bone (Adult)":(1686,3012), - "Compact Bone (Child)":(1610,3222), - "Spongial Bone (Adult)":(1172,1685), - "Spongial Bone (Child)":(1180,1609), - "Muscle Tissue (Adult)":(1019,1159), - "Muscle Tissue (Child)":(999,1163), - "Fat Tissue (Adult)":(819,973), - "Fat Tissue (Adult)":(812,952), - "Skin Tissue (Adult)":(306,847), - "Skin Tissue (Child)":(258,822), - "Custom":('', '') + _("Bone"):(1250,4095), + _("Soft Tissue"):(324,1249), + _("Enamel (Adult)"):(2577,3874), + _("Enamel (Child)"):(3066,4095), + _("Compact Bone (Adult)"):(1686,3012), + _("Compact Bone (Child)"):(1610,3222), + _("Spongial Bone (Adult)"):(1172,1685), + _("Spongial Bone (Child)"):(1180,1609), + _("Muscle Tissue (Adult)"):(1019,1159), + _("Muscle Tissue (Child)"):(999,1163), + _("Fat Tissue (Adult)"):(819,973), + _("Fat Tissue (Child)"):(812,952), + _("Skin Tissue (Adult)"):(306,847), + _("Skin Tissue (Child)"):(258,822), + _("Custom"):('', '') }) self.__bind_events() @@ -116,5 +116,5 @@ class Presets(): def Test(self): print "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - print self.thresh_ct.get_value("Bone") + print self.thresh_ct.get_value(_("Bone")) print "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" diff --git a/invesalius/session.py b/invesalius/session.py index fbfa8f3..e95d9dc 100644 --- a/invesalius/session.py +++ b/invesalius/session.py @@ -4,7 +4,6 @@ from threading import Thread import time import wx.lib.pubsub as ps -import constants as const from utils import Singleton import wx.lib.pubsub as ps @@ -24,6 +23,7 @@ class Session(object): ps.Publisher().subscribe(self.StopRecording, "Stop Config Recording") def CreateItens(self): + import constants as const self.project_path = () self.debug = False @@ -55,6 +55,7 @@ class Session(object): def CloseProject(self): + import constants as const print "-- CloseProject" self.project_path = () self.project_status = const.PROJ_CLOSE @@ -62,6 +63,7 @@ class Session(object): self.temp_item = False def SaveProject(self, path=()): + import constants as const print "-- SaveProject" self.project_status = const.PROJ_OPEN if path: @@ -71,10 +73,12 @@ class Session(object): self.temp_item = False def ChangeProject(self): + import constants as const print "-- ChangeProject" self.project_status = const.PROJ_CHANGE def CreateProject(self, filename): + import constants as const print "-- CreateProject" # Set session info self.project_path = (self.tempdir, filename) @@ -83,6 +87,7 @@ class Session(object): return self.tempdir def OpenProject(self, filepath): + import constants as const print "-- OpenProject" # Add item to recent projects list item = (path, file) = os.path.split(filepath) @@ -123,6 +128,7 @@ class Session(object): def __add_to_list(self, item): + import constants as const # Last projects list l = self.recent_projects @@ -226,4 +232,4 @@ class WriteSession(Thread): - \ No newline at end of file + -- libgit2 0.21.2