Commit 973cafe604056b262ab2c8f2d6c2c24700530804
1 parent
0ce0c1dd
Exists in
master
and in
68 other branches
ENH: Advances on translation to pt
Showing
3 changed files
with
52 additions
and
44 deletions
Show diff stats
invesalius/constants.py
@@ -246,36 +246,40 @@ TYPE_RAYCASTING_MAPPER = 1 | @@ -246,36 +246,40 @@ TYPE_RAYCASTING_MAPPER = 1 | ||
246 | folder=RAYCASTING_PRESETS_DIRECTORY= os.path.abspath(os.path.join("..", | 246 | folder=RAYCASTING_PRESETS_DIRECTORY= os.path.abspath(os.path.join("..", |
247 | "presets", | 247 | "presets", |
248 | "raycasting")) | 248 | "raycasting")) |
249 | -_("Airways") | ||
250 | -_("Airways II") | ||
251 | -_("Black & White") | ||
252 | -_("Bone + Skin") | ||
253 | -_("Bone + Skin II") | ||
254 | -_("Dark Bone") | ||
255 | -_("Glossy") | ||
256 | -_("Glossy II") | ||
257 | -_("Gold Bone") | ||
258 | -_("High Contrast") | ||
259 | -_("Low Contrast") | ||
260 | -_("Soft on White") | ||
261 | -_("Mid Contrast") | ||
262 | -_("No Shading") | ||
263 | -_("Pencil") | ||
264 | -_("Red on White") | ||
265 | -_("Skin On Blue") | ||
266 | -_("Skin On Blue II") | ||
267 | -_("Soft on White") | ||
268 | -_("Soft + Skin") | ||
269 | -_("Soft + Skin II") | ||
270 | -_("Soft + Skin III") | ||
271 | -_("Soft On Blue") | ||
272 | -_("Soft") | ||
273 | -_("Standard") | ||
274 | -_("Vascular") | ||
275 | -_("Vascular II") | ||
276 | -_("Vascular III") | ||
277 | -_("Vascular IV") | ||
278 | -_("Yellow Bone") | 249 | + |
250 | + | ||
251 | +RAYCASTING_FILES = {_("Airways"): "Airways.plist", | ||
252 | + _("Airways II"): "Airways II.plist", | ||
253 | + _("Black & White"): "Black & White.plist", | ||
254 | + _("Bone + Skin"): "Bone + Skin.plist", | ||
255 | + _("Bone + Skin II"): "Bone + Skin II.plist", | ||
256 | + _("Dark Bone"): "Dark Bone.plist", | ||
257 | + _("Glossy"): "Glossy.plist", | ||
258 | + _("Glossy II"): "Glossy II.plist", | ||
259 | + _("Gold Bone"): "Gold Bone.plist", | ||
260 | + _("High Contrast"): "High Contrast.plist", | ||
261 | + _("Low Contrast"): "Low Contrast.plist", | ||
262 | + _("Soft on White"): "Soft on White.plist", | ||
263 | + _("Mid Contrast"): "Mid Contrast.plist", | ||
264 | + _("No Shading"): "No Shading.plist", | ||
265 | + _("Pencil"): "Pencil.plist", | ||
266 | + _("Red on White"): "Red on White.plist", | ||
267 | + _("Skin On Blue"): "Skin On Blue.plist", | ||
268 | + _("Skin On Blue II"): "Skin On Blue II.plist", | ||
269 | + _("Soft on White"): "Soft on White.plist", | ||
270 | + _("Soft + Skin"): "Soft + Skin.plist", | ||
271 | + _("Soft + Skin II"): "Soft + Skin II.plist", | ||
272 | + _("Soft + Skin III"): "Soft + Skin III.plist", | ||
273 | + _("Soft On Blue"): "Soft On Blue.plist", | ||
274 | + _("Soft"): "Soft.plist", | ||
275 | + _("Standard"): "Standard.plist", | ||
276 | + _("Vascular"): "Vascular.plist", | ||
277 | + _("Vascular II"): "Vascular II.plist", | ||
278 | + _("Vascular III"): "Vascular III.plist", | ||
279 | + _("Vascular IV"): "Vascular IV.plist", | ||
280 | + _("Yellow Bone"): "Yellow Bone.plist"} | ||
281 | + | ||
282 | + | ||
279 | 283 | ||
280 | RAYCASTING_TYPES = [_(filename.split(".")[0]) for filename in | 284 | RAYCASTING_TYPES = [_(filename.split(".")[0]) for filename in |
281 | os.listdir(folder) if | 285 | os.listdir(folder) if |
invesalius/control.py
@@ -402,14 +402,17 @@ class Controller(): | @@ -402,14 +402,17 @@ class Controller(): | ||
402 | def LoadRaycastingPreset(self, pubsub_evt): | 402 | def LoadRaycastingPreset(self, pubsub_evt): |
403 | label = pubsub_evt.data | 403 | label = pubsub_evt.data |
404 | if label != const.RAYCASTING_OFF_LABEL: | 404 | if label != const.RAYCASTING_OFF_LABEL: |
405 | - try: | 405 | + if label in const.RAYCASTING_FILES.keys(): |
406 | path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, | 406 | path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, |
407 | + const.RAYCASTING_FILES[label]) | ||
408 | + else: | ||
409 | + try: | ||
410 | + path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, | ||
411 | + label+".plist") | ||
412 | + except IOError: | ||
413 | + path = os.path.join(const.USER_RAYCASTING_PRESETS_DIRECTORY, | ||
407 | label+".plist") | 414 | label+".plist") |
408 | - preset = plistlib.readPlist(path) | ||
409 | - except IOError: | ||
410 | - path = os.path.join(const.USER_RAYCASTING_PRESETS_DIRECTORY, | ||
411 | - label+".plist") | ||
412 | - preset = plistlib.readPlist(path) | 415 | + preset = plistlib.readPlist(path) |
413 | prj.Project().raycasting_preset = preset | 416 | prj.Project().raycasting_preset = preset |
414 | # Notify volume | 417 | # Notify volume |
415 | # TODO: Chamar grafico tb! | 418 | # TODO: Chamar grafico tb! |
invesalius/data/surface.py
@@ -17,20 +17,21 @@ | @@ -17,20 +17,21 @@ | ||
17 | # detalhes. | 17 | # detalhes. |
18 | #-------------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------------- |
19 | 19 | ||
20 | -from imagedata_utils import BuildEditedImage | ||
21 | -import constants as const | ||
22 | -import imagedata_utils as iu | ||
23 | import multiprocessing | 20 | import multiprocessing |
24 | import os | 21 | import os |
25 | import plistlib | 22 | import plistlib |
26 | -import polydata_utils as pu | ||
27 | -import project as prj | ||
28 | -import session as ses | 23 | +import sys |
29 | import tempfile | 24 | import tempfile |
25 | + | ||
30 | import vtk | 26 | import vtk |
31 | -import vtk_utils as vu | ||
32 | import wx.lib.pubsub as ps | 27 | import wx.lib.pubsub as ps |
33 | 28 | ||
29 | +import constants as const | ||
30 | +import imagedata_utils as iu | ||
31 | +import polydata_utils as pu | ||
32 | +import project as prj | ||
33 | +import session as ses | ||
34 | +import vtk_utils as vu | ||
34 | 35 | ||
35 | #------------------------------------------------------------------ | 36 | #------------------------------------------------------------------ |
36 | class SurfaceProcess(multiprocessing.Process): | 37 | class SurfaceProcess(multiprocessing.Process): |
@@ -280,7 +281,7 @@ class SurfaceManager(): | @@ -280,7 +281,7 @@ class SurfaceManager(): | ||
280 | imagedata_tmp = vtk.vtkImageData() | 281 | imagedata_tmp = vtk.vtkImageData() |
281 | imagedata_tmp.DeepCopy(imagedata) | 282 | imagedata_tmp.DeepCopy(imagedata) |
282 | imagedata_tmp.Update() | 283 | imagedata_tmp.Update() |
283 | - imagedata = BuildEditedImage(imagedata_tmp, edited_points) | 284 | + imagedata = iu.BuildEditedImage(imagedata_tmp, edited_points) |
284 | 285 | ||
285 | if quality in const.SURFACE_QUALITY.keys(): | 286 | if quality in const.SURFACE_QUALITY.keys(): |
286 | imagedata_resolution = const.SURFACE_QUALITY[quality][0] | 287 | imagedata_resolution = const.SURFACE_QUALITY[quality][0] |