Commit 203f403de2d015c8590a6845d62892a825bd57a8
1 parent
711eafe8
Exists in
master
and in
6 other branches
STL: removed certain prints
Showing
20 changed files
with
97 additions
and
150 deletions
Show diff stats
invesalius/control.py
@@ -36,6 +36,8 @@ import reader.dicom_reader as dcm | @@ -36,6 +36,8 @@ import reader.dicom_reader as dcm | ||
36 | import reader.analyze_reader as analyze | 36 | import reader.analyze_reader as analyze |
37 | import session as ses | 37 | import session as ses |
38 | 38 | ||
39 | +from utils import debug | ||
40 | + | ||
39 | DEFAULT_THRESH_MODE = 0 | 41 | DEFAULT_THRESH_MODE = 0 |
40 | 42 | ||
41 | class Controller(): | 43 | class Controller(): |
@@ -147,7 +149,7 @@ class Controller(): | @@ -147,7 +149,7 @@ class Controller(): | ||
147 | 149 | ||
148 | 150 | ||
149 | def ShowDialogCloseProject(self): | 151 | def ShowDialogCloseProject(self): |
150 | - utils.debug("ShowDialogCloseProject") | 152 | + debug("ShowDialogCloseProject") |
151 | session = ses.Session() | 153 | session = ses.Session() |
152 | st = session.project_status | 154 | st = session.project_status |
153 | if st == const.PROJ_CLOSE: | 155 | if st == const.PROJ_CLOSE: |
@@ -156,18 +158,18 @@ class Controller(): | @@ -156,18 +158,18 @@ class Controller(): | ||
156 | if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE): | 158 | if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE): |
157 | answer = dialog.SaveChangesDialog(filename) | 159 | answer = dialog.SaveChangesDialog(filename) |
158 | if not answer: | 160 | if not answer: |
159 | - utils.debug("Close without changes") | 161 | + debug("Close without changes") |
160 | self.CloseProject() | 162 | self.CloseProject() |
161 | ps.Publisher().sendMessage("Enable state project", False) | 163 | ps.Publisher().sendMessage("Enable state project", False) |
162 | ps.Publisher().sendMessage('Set project name') | 164 | ps.Publisher().sendMessage('Set project name') |
163 | elif answer == 1: | 165 | elif answer == 1: |
164 | self.ShowDialogSaveProject() | 166 | self.ShowDialogSaveProject() |
165 | - utils.debug("Save changes and close") | 167 | + debug("Save changes and close") |
166 | self.CloseProject() | 168 | self.CloseProject() |
167 | ps.Publisher().sendMessage("Enable state project", False) | 169 | ps.Publisher().sendMessage("Enable state project", False) |
168 | ps.Publisher().sendMessage('Set project name') | 170 | ps.Publisher().sendMessage('Set project name') |
169 | elif answer == -1: | 171 | elif answer == -1: |
170 | - utils.debug("Cancel") | 172 | + debug("Cancel") |
171 | else: | 173 | else: |
172 | self.CloseProject() | 174 | self.CloseProject() |
173 | ps.Publisher().sendMessage("Enable state project", False) | 175 | ps.Publisher().sendMessage("Enable state project", False) |
@@ -307,7 +309,7 @@ class Controller(): | @@ -307,7 +309,7 @@ class Controller(): | ||
307 | self.CreateAnalyzeProject(imagedata) | 309 | self.CreateAnalyzeProject(imagedata) |
308 | # OPTION 3: Nothing... | 310 | # OPTION 3: Nothing... |
309 | else: | 311 | else: |
310 | - utils.debug("No medical images found on given directory") | 312 | + debug("No medical images found on given directory") |
311 | return | 313 | return |
312 | self.LoadProject() | 314 | self.LoadProject() |
313 | ps.Publisher().sendMessage("Enable state project", True) | 315 | ps.Publisher().sendMessage("Enable state project", True) |
@@ -392,7 +394,7 @@ class Controller(): | @@ -392,7 +394,7 @@ class Controller(): | ||
392 | interval += 1 | 394 | interval += 1 |
393 | filelist = dicom_group.GetFilenameList()[::interval] | 395 | filelist = dicom_group.GetFilenameList()[::interval] |
394 | if not filelist: | 396 | if not filelist: |
395 | - utils.debug("Not used the IPPSorter") | 397 | + debug("Not used the IPPSorter") |
396 | filelist = [i.image.file for i in dicom_group.GetHandSortedList()[::interval]] | 398 | filelist = [i.image.file for i in dicom_group.GetHandSortedList()[::interval]] |
397 | 399 | ||
398 | 400 |
invesalius/data/imagedata_utils.py
@@ -227,7 +227,7 @@ def CreateImageData(filelist, zspacing, size, bits): | @@ -227,7 +227,7 @@ def CreateImageData(filelist, zspacing, size, bits): | ||
227 | x,y = size | 227 | x,y = size |
228 | px, py = utils.PredictingMemory(len(filelist), x, y, bits) | 228 | px, py = utils.PredictingMemory(len(filelist), x, y, bits) |
229 | 229 | ||
230 | - print "Image Resized to >>>", px, "x", py | 230 | + utils.debug("Image Resized to >>> %f x %f" % (px, py)) |
231 | 231 | ||
232 | if (x == px) and (y == py): | 232 | if (x == px) and (y == py): |
233 | const.REDUCE_IMAGEDATA_QUALITY = 0 | 233 | const.REDUCE_IMAGEDATA_QUALITY = 0 |
@@ -294,35 +294,61 @@ def CreateImageData(filelist, zspacing, size, bits): | @@ -294,35 +294,61 @@ def CreateImageData(filelist, zspacing, size, bits): | ||
294 | return imagedata | 294 | return imagedata |
295 | 295 | ||
296 | 296 | ||
297 | -""" | ||
298 | class ImageCreator: | 297 | class ImageCreator: |
299 | def __init__(self): | 298 | def __init__(self): |
300 | - ps.Publisher().sendMessage("Cancel imagedata load", self.CancelImageDataLoad) | 299 | + self.running = True |
300 | + ps.Publisher().subscribe(self.CancelImageDataLoad, "Cancel DICOM load") | ||
301 | 301 | ||
302 | def CancelImageDataLoad(self, evt_pusub): | 302 | def CancelImageDataLoad(self, evt_pusub): |
303 | - self.running = evt_pusub.data | 303 | + utils.debug("Canceling") |
304 | + self.running = False | ||
305 | + | ||
306 | + def CreateImageData(self, filelist, zspacing, size, bits): | ||
307 | + message = _("Generating multiplanar visualization...") | ||
308 | + | ||
309 | + if not const.VTK_WARNING: | ||
310 | + log_path = os.path.join(const.LOG_FOLDER, 'vtkoutput.txt') | ||
311 | + fow = vtk.vtkFileOutputWindow() | ||
312 | + fow.SetFileName(log_path) | ||
313 | + ow = vtk.vtkOutputWindow() | ||
314 | + ow.SetInstance(fow) | ||
315 | + | ||
316 | + x,y = size | ||
317 | + px, py = utils.PredictingMemory(len(filelist), x, y, bits) | ||
318 | + utils.debug("Image Resized to >>> %f x %f" % (px, py)) | ||
319 | + | ||
320 | + if (x == px) and (y == py): | ||
321 | + const.REDUCE_IMAGEDATA_QUALITY = 0 | ||
322 | + else: | ||
323 | + const.REDUCE_IMAGEDATA_QUALITY = 1 | ||
304 | 324 | ||
305 | - def CreateImageData(filelist, zspacing): | ||
306 | - message = "Generating multiplanar visualization..." | ||
307 | if not(const.REDUCE_IMAGEDATA_QUALITY): | 325 | if not(const.REDUCE_IMAGEDATA_QUALITY): |
308 | - update_progress= vtk_utils.ShowProgress(1) | 326 | + update_progress= vtk_utils.ShowProgress(1, dialog_type = "ProgressDialog") |
309 | 327 | ||
310 | array = vtk.vtkStringArray() | 328 | array = vtk.vtkStringArray() |
311 | for x in xrange(len(filelist)): | 329 | for x in xrange(len(filelist)): |
330 | + if not self.running: | ||
331 | + return False | ||
312 | array.InsertValue(x,filelist[x]) | 332 | array.InsertValue(x,filelist[x]) |
313 | 333 | ||
334 | + if not self.running: | ||
335 | + return False | ||
314 | reader = vtkgdcm.vtkGDCMImageReader() | 336 | reader = vtkgdcm.vtkGDCMImageReader() |
315 | reader.SetFileNames(array) | 337 | reader.SetFileNames(array) |
316 | reader.AddObserver("ProgressEvent", lambda obj,evt: | 338 | reader.AddObserver("ProgressEvent", lambda obj,evt: |
317 | update_progress(reader,message)) | 339 | update_progress(reader,message)) |
318 | reader.Update() | 340 | reader.Update() |
319 | 341 | ||
342 | + if not self.running: | ||
343 | + reader.AbortExecuteOn() | ||
344 | + return False | ||
320 | # The zpacing is a DicomGroup property, so we need to set it | 345 | # The zpacing is a DicomGroup property, so we need to set it |
321 | imagedata = vtk.vtkImageData() | 346 | imagedata = vtk.vtkImageData() |
322 | imagedata.DeepCopy(reader.GetOutput()) | 347 | imagedata.DeepCopy(reader.GetOutput()) |
323 | spacing = imagedata.GetSpacing() | 348 | spacing = imagedata.GetSpacing() |
324 | imagedata.SetSpacing(spacing[0], spacing[1], zspacing) | 349 | imagedata.SetSpacing(spacing[0], spacing[1], zspacing) |
325 | else: | 350 | else: |
351 | + | ||
326 | update_progress= vtk_utils.ShowProgress(2*len(filelist), | 352 | update_progress= vtk_utils.ShowProgress(2*len(filelist), |
327 | dialog_type = "ProgressDialog") | 353 | dialog_type = "ProgressDialog") |
328 | 354 | ||
@@ -330,11 +356,14 @@ class ImageCreator: | @@ -330,11 +356,14 @@ class ImageCreator: | ||
330 | appender = vtk.vtkImageAppend() | 356 | appender = vtk.vtkImageAppend() |
331 | appender.SetAppendAxis(2) #Define Stack in Z | 357 | appender.SetAppendAxis(2) #Define Stack in Z |
332 | 358 | ||
359 | + | ||
333 | # Reformat each slice | 360 | # Reformat each slice |
334 | for x in xrange(len(filelist)): | 361 | for x in xrange(len(filelist)): |
335 | # TODO: We need to check this automatically according | 362 | # TODO: We need to check this automatically according |
336 | # to each computer's architecture | 363 | # to each computer's architecture |
337 | # If the resolution of the matrix is too large | 364 | # If the resolution of the matrix is too large |
365 | + if not self.running: | ||
366 | + return False | ||
338 | reader = vtkgdcm.vtkGDCMImageReader() | 367 | reader = vtkgdcm.vtkGDCMImageReader() |
339 | reader.SetFileName(filelist[x]) | 368 | reader.SetFileName(filelist[x]) |
340 | reader.AddObserver("ProgressEvent", lambda obj,evt: | 369 | reader.AddObserver("ProgressEvent", lambda obj,evt: |
@@ -342,15 +371,15 @@ class ImageCreator: | @@ -342,15 +371,15 @@ class ImageCreator: | ||
342 | reader.Update() | 371 | reader.Update() |
343 | 372 | ||
344 | #Resample image in x,y dimension | 373 | #Resample image in x,y dimension |
345 | - | ||
346 | - slice_imagedata = ResampleImage2D(reader.GetOutput(), 256, update_progress) | ||
347 | - | 374 | + slice_imagedata = ResampleImage2D(reader.GetOutput(), px, py, update_progress) |
348 | #Stack images in Z axes | 375 | #Stack images in Z axes |
349 | appender.AddInput(slice_imagedata) | 376 | appender.AddInput(slice_imagedata) |
350 | #appender.AddObserver("ProgressEvent", lambda obj,evt:update_progress(appender)) | 377 | #appender.AddObserver("ProgressEvent", lambda obj,evt:update_progress(appender)) |
351 | appender.Update() | 378 | appender.Update() |
352 | 379 | ||
353 | # The zpacing is a DicomGroup property, so we need to set it | 380 | # The zpacing is a DicomGroup property, so we need to set it |
381 | + if not self.running: | ||
382 | + return False | ||
354 | imagedata = vtk.vtkImageData() | 383 | imagedata = vtk.vtkImageData() |
355 | imagedata.DeepCopy(appender.GetOutput()) | 384 | imagedata.DeepCopy(appender.GetOutput()) |
356 | spacing = imagedata.GetSpacing() | 385 | spacing = imagedata.GetSpacing() |
@@ -362,5 +391,3 @@ class ImageCreator: | @@ -362,5 +391,3 @@ class ImageCreator: | ||
362 | imagedata.Update() | 391 | imagedata.Update() |
363 | 392 | ||
364 | return imagedata | 393 | return imagedata |
365 | -""" | ||
366 | - |
invesalius/data/slice_.py
@@ -581,8 +581,8 @@ class Slice(object): | @@ -581,8 +581,8 @@ class Slice(object): | ||
581 | mask = mask_dict[key] | 581 | mask = mask_dict[key] |
582 | 582 | ||
583 | # update gui related to mask | 583 | # update gui related to mask |
584 | - print "__load_masks" | ||
585 | - print 'THRESHOLD_RANGE', mask.threshold_range | 584 | + utils.debug("__load_masks") |
585 | + utils.debug('THRESHOLD_RANGE %s', mask.threshold_range) | ||
586 | ps.Publisher().sendMessage('Add mask', | 586 | ps.Publisher().sendMessage('Add mask', |
587 | (mask.index, | 587 | (mask.index, |
588 | mask.name, | 588 | mask.name, |
invesalius/data/viewer_slice.py
@@ -35,6 +35,7 @@ import data.slice_ as sl | @@ -35,6 +35,7 @@ import data.slice_ as sl | ||
35 | import data.vtk_utils as vtku | 35 | import data.vtk_utils as vtku |
36 | import project | 36 | import project |
37 | import slice_data as sd | 37 | import slice_data as sd |
38 | +import utils | ||
38 | 39 | ||
39 | ID_TO_TOOL_ITEM = {} | 40 | ID_TO_TOOL_ITEM = {} |
40 | STR_WL = "WL: %d WW: %d" | 41 | STR_WL = "WL: %d WW: %d" |
@@ -286,14 +287,12 @@ class Viewer(wx.Panel): | @@ -286,14 +287,12 @@ class Viewer(wx.Panel): | ||
286 | style.AddObserver("RightButtonPressEvent", self.QuitRubberBandZoom) | 287 | style.AddObserver("RightButtonPressEvent", self.QuitRubberBandZoom) |
287 | 288 | ||
288 | def OnRightClick(self, evt, obj): | 289 | def OnRightClick(self, evt, obj): |
289 | - print "OnRightClick" | ||
290 | self.last_position_mouse_move = \ | 290 | self.last_position_mouse_move = \ |
291 | self.interactor.GetLastEventPosition() | 291 | self.interactor.GetLastEventPosition() |
292 | 292 | ||
293 | self.right_pressed = 1 | 293 | self.right_pressed = 1 |
294 | 294 | ||
295 | def OnReleaseRightButton(self, evt, obj): | 295 | def OnReleaseRightButton(self, evt, obj): |
296 | - print "OnReleaseRightButton" | ||
297 | self.right_pressed = 0 | 296 | self.right_pressed = 0 |
298 | ps.Publisher().sendMessage('Update slice viewer') | 297 | ps.Publisher().sendMessage('Update slice viewer') |
299 | 298 | ||
@@ -301,7 +300,6 @@ class Viewer(wx.Panel): | @@ -301,7 +300,6 @@ class Viewer(wx.Panel): | ||
301 | self.left_pressed = 1 | 300 | self.left_pressed = 1 |
302 | 301 | ||
303 | def OnZoomLeftClick(self, evt, obj): | 302 | def OnZoomLeftClick(self, evt, obj): |
304 | - print "OnZoomLeftClick" | ||
305 | evt.StartDolly() | 303 | evt.StartDolly() |
306 | 304 | ||
307 | def OnReleaseLeftButton(self, evt, obj): | 305 | def OnReleaseLeftButton(self, evt, obj): |
@@ -383,12 +381,10 @@ class Viewer(wx.Panel): | @@ -383,12 +381,10 @@ class Viewer(wx.Panel): | ||
383 | 381 | ||
384 | def OnZoomMoveLeft(self, evt, obj): | 382 | def OnZoomMoveLeft(self, evt, obj): |
385 | if self.left_pressed: | 383 | if self.left_pressed: |
386 | - print "OnZoomMoveLeft:" | ||
387 | evt.Dolly() | 384 | evt.Dolly() |
388 | evt.OnRightButtonDown() | 385 | evt.OnRightButtonDown() |
389 | 386 | ||
390 | def OnVtkRightRelease(self, evt, obj): | 387 | def OnVtkRightRelease(self, evt, obj): |
391 | - print "On VTK" | ||
392 | evt.OnRightButtonUp() | 388 | evt.OnRightButtonUp() |
393 | 389 | ||
394 | 390 | ||
@@ -688,12 +684,10 @@ class Viewer(wx.Panel): | @@ -688,12 +684,10 @@ class Viewer(wx.Panel): | ||
688 | 684 | ||
689 | 685 | ||
690 | if (self.right_pressed): | 686 | if (self.right_pressed): |
691 | - print "OnZoomMoveRight" | ||
692 | evt.Dolly() | 687 | evt.Dolly() |
693 | evt.OnRightButtonDown() | 688 | evt.OnRightButtonDown() |
694 | 689 | ||
695 | def OnZoomRightClick(self, evt, obj): | 690 | def OnZoomRightClick(self, evt, obj): |
696 | - print "OnZoomRightClick" | ||
697 | evt.StartDolly() | 691 | evt.StartDolly() |
698 | 692 | ||
699 | 693 | ||
@@ -752,8 +746,6 @@ class Viewer(wx.Panel): | @@ -752,8 +746,6 @@ class Viewer(wx.Panel): | ||
752 | coord[index] = extent_max[index] | 746 | coord[index] = extent_max[index] |
753 | elif coord[index] < extent_min[index]: | 747 | elif coord[index] < extent_min[index]: |
754 | coord[index] = extent_min[index] | 748 | coord[index] = extent_min[index] |
755 | - #print "New coordinate: ", coord | ||
756 | - | ||
757 | return coord | 749 | return coord |
758 | 750 | ||
759 | def get_coordinate_cursor(self): | 751 | def get_coordinate_cursor(self): |
@@ -854,9 +846,7 @@ class Viewer(wx.Panel): | @@ -854,9 +846,7 @@ class Viewer(wx.Panel): | ||
854 | "SAGITAL": const.SAGITAL} | 846 | "SAGITAL": const.SAGITAL} |
855 | 847 | ||
856 | if id == dict[self.orientation]: | 848 | if id == dict[self.orientation]: |
857 | - print "ok" | ||
858 | if filetype == const.FILETYPE_POV: | 849 | if filetype == const.FILETYPE_POV: |
859 | - print 1 | ||
860 | renwin = self.interactor.GetRenderWindow() | 850 | renwin = self.interactor.GetRenderWindow() |
861 | image = vtk.vtkWindowToImageFilter() | 851 | image = vtk.vtkWindowToImageFilter() |
862 | image.SetInput(renwin) | 852 | image.SetInput(renwin) |
@@ -866,7 +856,6 @@ class Viewer(wx.Panel): | @@ -866,7 +856,6 @@ class Viewer(wx.Panel): | ||
866 | writer.Write() | 856 | writer.Write() |
867 | return | 857 | return |
868 | else: | 858 | else: |
869 | - print 2 | ||
870 | #Use tiling to generate a large rendering. | 859 | #Use tiling to generate a large rendering. |
871 | image = vtk.vtkRenderLargeImage() | 860 | image = vtk.vtkRenderLargeImage() |
872 | image.SetInput(self.ren) | 861 | image.SetInput(self.ren) |
@@ -877,19 +866,14 @@ class Viewer(wx.Panel): | @@ -877,19 +866,14 @@ class Viewer(wx.Panel): | ||
877 | 866 | ||
878 | # write image file | 867 | # write image file |
879 | if (filetype == const.FILETYPE_BMP): | 868 | if (filetype == const.FILETYPE_BMP): |
880 | - print 3 | ||
881 | writer = vtk.vtkBMPWriter() | 869 | writer = vtk.vtkBMPWriter() |
882 | elif (filetype == const.FILETYPE_JPG): | 870 | elif (filetype == const.FILETYPE_JPG): |
883 | - print 4 | ||
884 | writer = vtk.vtkJPEGWriter() | 871 | writer = vtk.vtkJPEGWriter() |
885 | elif (filetype == const.FILETYPE_PNG): | 872 | elif (filetype == const.FILETYPE_PNG): |
886 | - print 5 | ||
887 | writer = vtk.vtkPNGWriter() | 873 | writer = vtk.vtkPNGWriter() |
888 | elif (filetype == const.FILETYPE_PS): | 874 | elif (filetype == const.FILETYPE_PS): |
889 | - print 6 | ||
890 | writer = vtk.vtkPostScriptWriter() | 875 | writer = vtk.vtkPostScriptWriter() |
891 | elif (filetype == const.FILETYPE_TIF): | 876 | elif (filetype == const.FILETYPE_TIF): |
892 | - print 7 | ||
893 | writer = vtk.vtkTIFFWriter() | 877 | writer = vtk.vtkTIFFWriter() |
894 | filename = "%s.tif"%filename.strip(".tif") | 878 | filename = "%s.tif"%filename.strip(".tif") |
895 | 879 | ||
@@ -904,11 +888,9 @@ class Viewer(wx.Panel): | @@ -904,11 +888,9 @@ class Viewer(wx.Panel): | ||
904 | ps.Publisher().sendMessage('End busy cursor') | 888 | ps.Publisher().sendMessage('End busy cursor') |
905 | 889 | ||
906 | def OnShowText(self, pubsub_evt): | 890 | def OnShowText(self, pubsub_evt): |
907 | - print "OnShowText" | ||
908 | self.ShowTextActors() | 891 | self.ShowTextActors() |
909 | 892 | ||
910 | def OnHideText(self, pubsub_evt): | 893 | def OnHideText(self, pubsub_evt): |
911 | - print "OnHideText" | ||
912 | self.HideTextActors() | 894 | self.HideTextActors() |
913 | 895 | ||
914 | 896 | ||
@@ -939,7 +921,6 @@ class Viewer(wx.Panel): | @@ -939,7 +921,6 @@ class Viewer(wx.Panel): | ||
939 | 921 | ||
940 | 922 | ||
941 | def ChangeBrushOperation(self, pubsub_evt): | 923 | def ChangeBrushOperation(self, pubsub_evt): |
942 | - #print pubsub_evt.data | ||
943 | self._brush_cursor_op = pubsub_evt.data | 924 | self._brush_cursor_op = pubsub_evt.data |
944 | 925 | ||
945 | def __bind_events_wx(self): | 926 | def __bind_events_wx(self): |
@@ -1005,8 +986,6 @@ class Viewer(wx.Panel): | @@ -1005,8 +986,6 @@ class Viewer(wx.Panel): | ||
1005 | if i == self.layout[0] - 1: | 986 | if i == self.layout[0] - 1: |
1006 | style = style | sd.BORDER_RIGHT | 987 | style = style | sd.BORDER_RIGHT |
1007 | 988 | ||
1008 | - print "->Style", style | ||
1009 | - | ||
1010 | slice_data.SetBorderStyle(style) | 989 | slice_data.SetBorderStyle(style) |
1011 | n += 1 | 990 | n += 1 |
1012 | 991 | ||
@@ -1130,21 +1109,10 @@ class Viewer(wx.Panel): | @@ -1130,21 +1109,10 @@ class Viewer(wx.Panel): | ||
1130 | extent = slice_data.actor.GetDisplayExtent() | 1109 | extent = slice_data.actor.GetDisplayExtent() |
1131 | cam = slice_data.renderer.GetActiveCamera() | 1110 | cam = slice_data.renderer.GetActiveCamera() |
1132 | 1111 | ||
1133 | |||
1134 | - #print self.orientation | ||
1135 | - #print x, y, z | ||
1136 | - #print actor_bound | ||
1137 | - #print "ViewUp", cam.GetViewUp() | ||
1138 | - #print "Position", cam.GetPosition() | ||
1139 | - #print "Orientation", cam.GetOrientation() | ||
1140 | - #print "Focal Point", cam.GetFocalPoint() | ||
1141 | - | ||
1142 | vCamera = numpy.array(cam.GetPosition()) - numpy.array(cam.GetFocalPoint()) | 1112 | vCamera = numpy.array(cam.GetPosition()) - numpy.array(cam.GetFocalPoint()) |
1143 | n_vCamera = vCamera / numpy.linalg.norm(vCamera) | 1113 | n_vCamera = vCamera / numpy.linalg.norm(vCamera) |
1144 | - #print "Normalized", n_vCamera | ||
1145 | 1114 | ||
1146 | pos = [j + 0.01 * i for i,j in zip(n_vCamera, (x, y, z))] | 1115 | pos = [j + 0.01 * i for i,j in zip(n_vCamera, (x, y, z))] |
1147 | - #print "posicao", pos | ||
1148 | 1116 | ||
1149 | #yz = [x + abs(x * 0.001), y, z] | 1117 | #yz = [x + abs(x * 0.001), y, z] |
1150 | #xz = [x, y - abs(y * 0.001), z] | 1118 | #xz = [x, y - abs(y * 0.001), z] |
@@ -1174,7 +1142,6 @@ class Viewer(wx.Panel): | @@ -1174,7 +1142,6 @@ class Viewer(wx.Panel): | ||
1174 | # elif orientation == "CORONAL": | 1142 | # elif orientation == "CORONAL": |
1175 | # pos[1] -= abs(pos[1] * 0.001) | 1143 | # pos[1] -= abs(pos[1] * 0.001) |
1176 | 1144 | ||
1177 | - #print ">POS", pos | ||
1178 | 1145 | ||
1179 | #pos = [x, y, z] | 1146 | #pos = [x, y, z] |
1180 | #if orientation == "AXIAL": | 1147 | #if orientation == "AXIAL": |
invesalius/data/viewer_volume.py
@@ -25,10 +25,10 @@ from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor | @@ -25,10 +25,10 @@ from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor | ||
25 | import wx.lib.pubsub as ps | 25 | import wx.lib.pubsub as ps |
26 | 26 | ||
27 | import constants as const | 27 | import constants as const |
28 | -import project as prj | ||
29 | import data.vtk_utils as vtku | 28 | import data.vtk_utils as vtku |
30 | -from gui.widgets.clut_raycasting import CLUTRaycastingWidget | 29 | +import project as prj |
31 | import style as st | 30 | import style as st |
31 | +import utils | ||
32 | 32 | ||
33 | class Viewer(wx.Panel): | 33 | class Viewer(wx.Panel): |
34 | def __init__(self, parent): | 34 | def __init__(self, parent): |
@@ -274,7 +274,6 @@ class Viewer(wx.Panel): | @@ -274,7 +274,6 @@ class Viewer(wx.Panel): | ||
274 | 274 | ||
275 | # Check each event available for each mode | 275 | # Check each event available for each mode |
276 | for event in action[state]: | 276 | for event in action[state]: |
277 | - print event | ||
278 | # Bind event | 277 | # Bind event |
279 | style.AddObserver(event,action[state][event]) | 278 | style.AddObserver(event,action[state][event]) |
280 | 279 | ||
@@ -439,14 +438,14 @@ class Viewer(wx.Panel): | @@ -439,14 +438,14 @@ class Viewer(wx.Panel): | ||
439 | self.interactor.Render() | 438 | self.interactor.Render() |
440 | 439 | ||
441 | def RemoveActor(self, pubsub_evt): | 440 | def RemoveActor(self, pubsub_evt): |
442 | - print "RemoveActor" | 441 | + utils.debug("RemoveActor") |
443 | actor = pubsub_evt.data | 442 | actor = pubsub_evt.data |
444 | ren = self.ren | 443 | ren = self.ren |
445 | ren.RemoveActor(actor) | 444 | ren.RemoveActor(actor) |
446 | self.interactor.Render() | 445 | self.interactor.Render() |
447 | 446 | ||
448 | def RemoveAllActor(self, pubsub_evt): | 447 | def RemoveAllActor(self, pubsub_evt): |
449 | - print "RemoveAllActor" | 448 | + utils.debug("RemoveAllActor") |
450 | self.ren.RemoveAllProps() | 449 | self.ren.RemoveAllProps() |
451 | ps.Publisher().sendMessage('Render volume viewer') | 450 | ps.Publisher().sendMessage('Render volume viewer') |
452 | 451 | ||
@@ -503,7 +502,6 @@ class Viewer(wx.Panel): | @@ -503,7 +502,6 @@ class Viewer(wx.Panel): | ||
503 | self.interactor.Render() | 502 | self.interactor.Render() |
504 | 503 | ||
505 | def ShowOrientationCube(self): | 504 | def ShowOrientationCube(self): |
506 | - print "ORIENTATION CUBE!" | ||
507 | cube = vtk.vtkAnnotatedCubeActor() | 505 | cube = vtk.vtkAnnotatedCubeActor() |
508 | cube.GetXMinusFaceProperty().SetColor(1,0,0) | 506 | cube.GetXMinusFaceProperty().SetColor(1,0,0) |
509 | cube.GetXPlusFaceProperty().SetColor(1,0,0) | 507 | cube.GetXPlusFaceProperty().SetColor(1,0,0) |
@@ -696,7 +694,6 @@ class SlicePlane: | @@ -696,7 +694,6 @@ class SlicePlane: | ||
696 | a.SetBackfaceCulling(0) | 694 | a.SetBackfaceCulling(0) |
697 | c = self.plane_x.GetTexture() | 695 | c = self.plane_x.GetTexture() |
698 | c.SetRestrictPowerOf2ImageSmaller(1) | 696 | c.SetRestrictPowerOf2ImageSmaller(1) |
699 | - #print dir(a) | ||
700 | 697 | ||
701 | elif(self.original_orientation == const.SAGITAL): | 698 | elif(self.original_orientation == const.SAGITAL): |
702 | if(label == "Axial"): | 699 | if(label == "Axial"): |
invesalius/data/volume.py
@@ -418,17 +418,13 @@ class Volume(): | @@ -418,17 +418,13 @@ class Volume(): | ||
418 | def SetTypeRaycasting(self): | 418 | def SetTypeRaycasting(self): |
419 | if self.volume_mapper.IsA("vtkFixedPointVolumeRayCastMapper"): | 419 | if self.volume_mapper.IsA("vtkFixedPointVolumeRayCastMapper"): |
420 | if self.config.get('MIP', False): | 420 | if self.config.get('MIP', False): |
421 | - print "MIP" | ||
422 | self.volume_mapper.SetBlendModeToMaximumIntensity() | 421 | self.volume_mapper.SetBlendModeToMaximumIntensity() |
423 | else: | 422 | else: |
424 | - print "Composite" | ||
425 | self.volume_mapper.SetBlendModeToComposite() | 423 | self.volume_mapper.SetBlendModeToComposite() |
426 | else: | 424 | else: |
427 | if self.config.get('MIP', False): | 425 | if self.config.get('MIP', False): |
428 | - print "MIP" | ||
429 | raycasting_function = vtk.vtkVolumeRayCastMIPFunction() | 426 | raycasting_function = vtk.vtkVolumeRayCastMIPFunction() |
430 | else: | 427 | else: |
431 | - print "Composite" | ||
432 | raycasting_function = vtk.vtkVolumeRayCastCompositeFunction() | 428 | raycasting_function = vtk.vtkVolumeRayCastCompositeFunction() |
433 | raycasting_function.SetCompositeMethodToInterpolateFirst() | 429 | raycasting_function.SetCompositeMethodToInterpolateFirst() |
434 | self.volume_mapper.SetVolumeRayCastFunction(raycasting_function) | 430 | self.volume_mapper.SetVolumeRayCastFunction(raycasting_function) |
@@ -551,20 +547,16 @@ class Volume(): | @@ -551,20 +547,16 @@ class Volume(): | ||
551 | (volume, colour, (self.ww, self.wl))) | 547 | (volume, colour, (self.ww, self.wl))) |
552 | 548 | ||
553 | def OnEnableTool(self, pubsub_evt): | 549 | def OnEnableTool(self, pubsub_evt): |
554 | - print "OnEnableTool" | ||
555 | tool_name, enable = pubsub_evt.data | 550 | tool_name, enable = pubsub_evt.data |
556 | if tool_name == _("Cut plane"): | 551 | if tool_name == _("Cut plane"): |
557 | if self.plane: | 552 | if self.plane: |
558 | if enable: | 553 | if enable: |
559 | - print "Enable" | ||
560 | self.plane_on = True | 554 | self.plane_on = True |
561 | self.plane.Enable() | 555 | self.plane.Enable() |
562 | else: | 556 | else: |
563 | - print "Disable" | ||
564 | self.plane_on = False | 557 | self.plane_on = False |
565 | self.plane.Disable() | 558 | self.plane.Disable() |
566 | else: | 559 | else: |
567 | - print "Enable" | ||
568 | self.final_imagedata.Update() | 560 | self.final_imagedata.Update() |
569 | self.plane_on = True | 561 | self.plane_on = True |
570 | self.plane = CutPlane(self.final_imagedata, | 562 | self.plane = CutPlane(self.final_imagedata, |
invesalius/gui/default_viewers.py
@@ -262,7 +262,6 @@ class VolumeInteraction(wx.Panel): | @@ -262,7 +262,6 @@ class VolumeInteraction(wx.Panel): | ||
262 | self.aui_manager.Update() | 262 | self.aui_manager.Update() |
263 | 263 | ||
264 | def OnPointChanged(self, evt): | 264 | def OnPointChanged(self, evt): |
265 | - print "Removed" | ||
266 | ps.Publisher.sendMessage('Set raycasting refresh', None) | 265 | ps.Publisher.sendMessage('Set raycasting refresh', None) |
267 | ps.Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | 266 | ps.Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) |
268 | ps.Publisher().sendMessage('Render volume viewer') | 267 | ps.Publisher().sendMessage('Render volume viewer') |
@@ -278,7 +277,6 @@ class VolumeInteraction(wx.Panel): | @@ -278,7 +277,6 @@ class VolumeInteraction(wx.Panel): | ||
278 | 277 | ||
279 | def OnSetRaycastPreset(self, evt_pubsub): | 278 | def OnSetRaycastPreset(self, evt_pubsub): |
280 | preset = project.Project().raycasting_preset | 279 | preset = project.Project().raycasting_preset |
281 | - print "Preset >>>", preset | ||
282 | p = self.aui_manager.GetPane(self.clut_raycasting) | 280 | p = self.aui_manager.GetPane(self.clut_raycasting) |
283 | self.clut_raycasting.SetRaycastPreset(preset) | 281 | self.clut_raycasting.SetRaycastPreset(preset) |
284 | if self.clut_raycasting.to_draw_points and \ | 282 | if self.clut_raycasting.to_draw_points and \ |
@@ -542,13 +540,11 @@ class VolumeToolPanel(wx.Panel): | @@ -542,13 +540,11 @@ class VolumeToolPanel(wx.Panel): | ||
542 | # if i is not item: | 540 | # if i is not item: |
543 | # i.Check(0) | 541 | # i.Check(0) |
544 | if not TOOL_STATE[id]: | 542 | if not TOOL_STATE[id]: |
545 | - print "item is checked" | ||
546 | ps.Publisher().sendMessage('Enable raycasting tool', | 543 | ps.Publisher().sendMessage('Enable raycasting tool', |
547 | [ID_TO_TOOL[id],1]) | 544 | [ID_TO_TOOL[id],1]) |
548 | TOOL_STATE[id] = True | 545 | TOOL_STATE[id] = True |
549 | item.Check(1) | 546 | item.Check(1) |
550 | else: | 547 | else: |
551 | - print "item is not checked" | ||
552 | ps.Publisher().sendMessage('Enable raycasting tool', | 548 | ps.Publisher().sendMessage('Enable raycasting tool', |
553 | [ID_TO_TOOL[id],0]) | 549 | [ID_TO_TOOL[id],0]) |
554 | TOOL_STATE[id] = False | 550 | TOOL_STATE[id] = False |
invesalius/gui/dialogs.py
@@ -28,6 +28,7 @@ import wx.lib.pubsub as ps | @@ -28,6 +28,7 @@ import wx.lib.pubsub as ps | ||
28 | import constants as const | 28 | import constants as const |
29 | import project as proj | 29 | import project as proj |
30 | import session as ses | 30 | import session as ses |
31 | +import utils | ||
31 | 32 | ||
32 | 33 | ||
33 | class NumberDialog(wx.Dialog): | 34 | class NumberDialog(wx.Dialog): |
@@ -275,7 +276,7 @@ def SaveChangesDialog__Old(filename): | @@ -275,7 +276,7 @@ def SaveChangesDialog__Old(filename): | ||
275 | 276 | ||
276 | 277 | ||
277 | def ImportEmptyDirectory(dirpath): | 278 | def ImportEmptyDirectory(dirpath): |
278 | - msg = _("%s is an empty directory.") % dirpath | 279 | + msg = _("%s is an empty directory.") % dirpath.decode("utf-8") |
279 | if sys.platform == 'darwin': | 280 | if sys.platform == 'darwin': |
280 | dlg = wx.MessageDialog(None, "", | 281 | dlg = wx.MessageDialog(None, "", |
281 | msg, | 282 | msg, |
@@ -532,7 +533,7 @@ def ExportPicture(type_=""): | @@ -532,7 +533,7 @@ def ExportPicture(type_=""): | ||
532 | 4: const.FILETYPE_POV, | 533 | 4: const.FILETYPE_POV, |
533 | 5: const.FILETYPE_TIF} | 534 | 5: const.FILETYPE_TIF} |
534 | 535 | ||
535 | - print "ExportPicture" | 536 | + utils.debug("ExportPicture") |
536 | project = proj.Project() | 537 | project = proj.Project() |
537 | 538 | ||
538 | if sys.platform == 'win32': | 539 | if sys.platform == 'win32': |
@@ -554,7 +555,6 @@ def ExportPicture(type_=""): | @@ -554,7 +555,6 @@ def ExportPicture(type_=""): | ||
554 | filetype = INDEX_TO_TYPE[filetype_index] | 555 | filetype = INDEX_TO_TYPE[filetype_index] |
555 | extension = INDEX_TO_EXTENSION[filetype_index] | 556 | extension = INDEX_TO_EXTENSION[filetype_index] |
556 | filename = dlg.GetPath() | 557 | filename = dlg.GetPath() |
557 | - print "filename", filename | ||
558 | if sys.platform != 'win32': | 558 | if sys.platform != 'win32': |
559 | if filename.split(".")[-1] != extension: | 559 | if filename.split(".")[-1] != extension: |
560 | filename = filename + "."+ extension | 560 | filename = filename + "."+ extension |
invesalius/gui/dicom_preview_panel.py
@@ -32,6 +32,7 @@ from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor | @@ -32,6 +32,7 @@ from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor | ||
32 | import constants as const | 32 | import constants as const |
33 | from reader import dicom_reader | 33 | from reader import dicom_reader |
34 | import data.vtk_utils as vtku | 34 | import data.vtk_utils as vtku |
35 | +import utils | ||
35 | 36 | ||
36 | NROWS = 3 | 37 | NROWS = 3 |
37 | NCOLS = 6 | 38 | NCOLS = 6 |
@@ -107,7 +108,6 @@ class DicomInfo(object): | @@ -107,7 +108,6 @@ class DicomInfo(object): | ||
107 | if self._preview: | 108 | if self._preview: |
108 | return self._preview | 109 | return self._preview |
109 | else: | 110 | else: |
110 | - print "First time!" | ||
111 | colorer = vtk.vtkImageMapToWindowLevelColors() | 111 | colorer = vtk.vtkImageMapToWindowLevelColors() |
112 | colorer.SetInput(self.dicom.image.imagedata) | 112 | colorer.SetInput(self.dicom.image.imagedata) |
113 | colorer.SetWindow(float(self.dicom.image.window)) | 113 | colorer.SetWindow(float(self.dicom.image.window)) |
@@ -256,7 +256,6 @@ class Preview(wx.Panel): | @@ -256,7 +256,6 @@ class Preview(wx.Panel): | ||
256 | if not self.select_on: | 256 | if not self.select_on: |
257 | #c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DHILIGHT) | 257 | #c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DHILIGHT) |
258 | c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE) | 258 | c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE) |
259 | - print c | ||
260 | self.SetBackgroundColour(c) | 259 | self.SetBackgroundColour(c) |
261 | 260 | ||
262 | def OnLeave(self, evt): | 261 | def OnLeave(self, evt): |
@@ -265,7 +264,6 @@ class Preview(wx.Panel): | @@ -265,7 +264,6 @@ class Preview(wx.Panel): | ||
265 | self.SetBackgroundColour(c) | 264 | self.SetBackgroundColour(c) |
266 | 265 | ||
267 | def OnSelect(self, evt): | 266 | def OnSelect(self, evt): |
268 | - print "OnSelect" | ||
269 | self.select_on = True | 267 | self.select_on = True |
270 | self.dicom_info.selected = True | 268 | self.dicom_info.selected = True |
271 | ##c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT) | 269 | ##c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT) |
@@ -287,7 +285,6 @@ class Preview(wx.Panel): | @@ -287,7 +285,6 @@ class Preview(wx.Panel): | ||
287 | my_evt.SetSelectedID(self.dicom_info.id) | 285 | my_evt.SetSelectedID(self.dicom_info.id) |
288 | my_evt.SetItemData(self.dicom_info.dicom) | 286 | my_evt.SetItemData(self.dicom_info.dicom) |
289 | my_evt.SetEventObject(self) | 287 | my_evt.SetEventObject(self) |
290 | - print "patient", self.dicom_info.dicom.patient | ||
291 | self.GetEventHandler().ProcessEvent(my_evt) | 288 | self.GetEventHandler().ProcessEvent(my_evt) |
292 | 289 | ||
293 | def OnSize(self, evt): | 290 | def OnSize(self, evt): |
@@ -370,7 +367,6 @@ class DicomPreviewSeries(wx.Panel): | @@ -370,7 +367,6 @@ class DicomPreviewSeries(wx.Panel): | ||
370 | self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) | 367 | self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) |
371 | 368 | ||
372 | def OnSelect(self, evt): | 369 | def OnSelect(self, evt): |
373 | - print dir(evt) | ||
374 | my_evt = SerieEvent(myEVT_CLICK_SERIE, self.GetId()) | 370 | my_evt = SerieEvent(myEVT_CLICK_SERIE, self.GetId()) |
375 | my_evt.SetSelectedID(evt.GetSelectID()) | 371 | my_evt.SetSelectedID(evt.GetSelectID()) |
376 | my_evt.SetItemData(evt.GetItemData()) | 372 | my_evt.SetItemData(evt.GetItemData()) |
@@ -379,7 +375,6 @@ class DicomPreviewSeries(wx.Panel): | @@ -379,7 +375,6 @@ class DicomPreviewSeries(wx.Panel): | ||
379 | self.selected_dicom.selected = self.selected_dicom is \ | 375 | self.selected_dicom.selected = self.selected_dicom is \ |
380 | evt.GetEventObject().dicom_info | 376 | evt.GetEventObject().dicom_info |
381 | self.selected_panel.select_on = self.selected_panel is evt.GetEventObject() | 377 | self.selected_panel.select_on = self.selected_panel is evt.GetEventObject() |
382 | - print "Unselecting a panel", self.selected_panel.select_on | ||
383 | self.selected_panel.Select() | 378 | self.selected_panel.Select() |
384 | self.selected_panel = evt.GetEventObject() | 379 | self.selected_panel = evt.GetEventObject() |
385 | self.selected_dicom = self.selected_panel.dicom_info | 380 | self.selected_dicom = self.selected_panel.dicom_info |
@@ -416,7 +411,7 @@ class DicomPreviewSeries(wx.Panel): | @@ -416,7 +411,7 @@ class DicomPreviewSeries(wx.Panel): | ||
416 | try: | 411 | try: |
417 | self.previews[-i-1].Hide() | 412 | self.previews[-i-1].Hide() |
418 | except IndexError: | 413 | except IndexError: |
419 | - #print "doesn't exist!" | 414 | + utils.debug("doesn't exist!") |
420 | pass | 415 | pass |
421 | self.nhidden_last_display = final-len(self.files) | 416 | self.nhidden_last_display = final-len(self.files) |
422 | else: | 417 | else: |
@@ -425,16 +420,14 @@ class DicomPreviewSeries(wx.Panel): | @@ -425,16 +420,14 @@ class DicomPreviewSeries(wx.Panel): | ||
425 | try: | 420 | try: |
426 | self.previews[-i-1].Show() | 421 | self.previews[-i-1].Show() |
427 | except IndexError: | 422 | except IndexError: |
428 | - #print "doesn't exist!" | 423 | + utils.debug("doesn't exist!") |
429 | pass | 424 | pass |
430 | self.nhidden_last_display = 0 | 425 | self.nhidden_last_display = 0 |
431 | 426 | ||
432 | for f, p in zip(self.files[initial:final], self.previews): | 427 | for f, p in zip(self.files[initial:final], self.previews): |
433 | - #print "f", f | ||
434 | p.SetDicomToPreview(f) | 428 | p.SetDicomToPreview(f) |
435 | if f.selected: | 429 | if f.selected: |
436 | self.selected_panel = p | 430 | self.selected_panel = p |
437 | - #p.interactor.Render() | ||
438 | 431 | ||
439 | for f, p in zip(self.files[initial:final], self.previews): | 432 | for f, p in zip(self.files[initial:final], self.previews): |
440 | p.Show() | 433 | p.Show() |
@@ -449,7 +442,6 @@ class DicomPreviewSeries(wx.Panel): | @@ -449,7 +442,6 @@ class DicomPreviewSeries(wx.Panel): | ||
449 | self._display_previews() | 442 | self._display_previews() |
450 | 443 | ||
451 | def OnWheel(self, evt): | 444 | def OnWheel(self, evt): |
452 | - print "OnWheel" | ||
453 | d = evt.GetWheelDelta() / evt.GetWheelRotation() | 445 | d = evt.GetWheelDelta() / evt.GetWheelRotation() |
454 | self.scroll.SetThumbPosition(self.scroll.GetThumbPosition() - d) | 446 | self.scroll.SetThumbPosition(self.scroll.GetThumbPosition() - d) |
455 | self.OnScroll() | 447 | self.OnScroll() |
@@ -506,7 +498,7 @@ class DicomPreviewSlice(wx.Panel): | @@ -506,7 +498,7 @@ class DicomPreviewSlice(wx.Panel): | ||
506 | self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) | 498 | self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) |
507 | 499 | ||
508 | def SetDicomDirectory(self, directory): | 500 | def SetDicomDirectory(self, directory): |
509 | - print "Setting Dicom Directory", directory | 501 | + utils.debug("Setting Dicom Directory %s" % directory) |
510 | self.directory = directory | 502 | self.directory = directory |
511 | self.series = dicom_reader.GetSeries(directory)[0] | 503 | self.series = dicom_reader.GetSeries(directory)[0] |
512 | 504 | ||
@@ -561,16 +553,13 @@ class DicomPreviewSlice(wx.Panel): | @@ -561,16 +553,13 @@ class DicomPreviewSlice(wx.Panel): | ||
561 | def _display_previews(self): | 553 | def _display_previews(self): |
562 | initial = self.displayed_position * NCOLS | 554 | initial = self.displayed_position * NCOLS |
563 | final = initial + NUM_PREVIEWS | 555 | final = initial + NUM_PREVIEWS |
564 | - print "len:", len(self.files) | ||
565 | 556 | ||
566 | if len(self.files) < final: | 557 | if len(self.files) < final: |
567 | for i in xrange(final-len(self.files)): | 558 | for i in xrange(final-len(self.files)): |
568 | - print "hide ", i | ||
569 | try: | 559 | try: |
570 | self.previews[-i-1].Hide() | 560 | self.previews[-i-1].Hide() |
571 | except IndexError: | 561 | except IndexError: |
572 | - #print "doesn't exist!" | ||
573 | - pass | 562 | + utils.debug("doesn't exist!") |
574 | self.nhidden_last_display = final-len(self.files) | 563 | self.nhidden_last_display = final-len(self.files) |
575 | else: | 564 | else: |
576 | if self.nhidden_last_display: | 565 | if self.nhidden_last_display: |
@@ -578,8 +567,7 @@ class DicomPreviewSlice(wx.Panel): | @@ -578,8 +567,7 @@ class DicomPreviewSlice(wx.Panel): | ||
578 | try: | 567 | try: |
579 | self.previews[-i-1].Show() | 568 | self.previews[-i-1].Show() |
580 | except IndexError: | 569 | except IndexError: |
581 | - #print "doesn't exist!" | ||
582 | - pass | 570 | + utils.debug("doesn't exist!") |
583 | self.nhidden_last_display = 0 | 571 | self.nhidden_last_display = 0 |
584 | 572 | ||
585 | for f, p in zip(self.files[initial:final], self.previews): | 573 | for f, p in zip(self.files[initial:final], self.previews): |
@@ -592,7 +580,6 @@ class DicomPreviewSlice(wx.Panel): | @@ -592,7 +580,6 @@ class DicomPreviewSlice(wx.Panel): | ||
592 | p.Show() | 580 | p.Show() |
593 | 581 | ||
594 | def OnPreviewClick(self, evt): | 582 | def OnPreviewClick(self, evt): |
595 | - print "Hey man, you've clicked over me" | ||
596 | my_evt = SerieEvent(myEVT_CLICK_SLICE, self.GetId()) | 583 | my_evt = SerieEvent(myEVT_CLICK_SLICE, self.GetId()) |
597 | my_evt.SetSelectedID(evt.GetSelectID()) | 584 | my_evt.SetSelectedID(evt.GetSelectID()) |
598 | my_evt.SetItemData(evt.GetItemData()) | 585 | my_evt.SetItemData(evt.GetItemData()) |
@@ -601,7 +588,6 @@ class DicomPreviewSlice(wx.Panel): | @@ -601,7 +588,6 @@ class DicomPreviewSlice(wx.Panel): | ||
601 | self.selected_dicom.selected = self.selected_dicom is \ | 588 | self.selected_dicom.selected = self.selected_dicom is \ |
602 | evt.GetEventObject().dicom_info | 589 | evt.GetEventObject().dicom_info |
603 | self.selected_panel.select_on = self.selected_panel is evt.GetEventObject() | 590 | self.selected_panel.select_on = self.selected_panel is evt.GetEventObject() |
604 | - print "Unselecting a panel", self.selected_panel.select_on | ||
605 | self.selected_panel.Select() | 591 | self.selected_panel.Select() |
606 | self.selected_panel = evt.GetEventObject() | 592 | self.selected_panel = evt.GetEventObject() |
607 | self.selected_dicom = self.selected_panel.dicom_info | 593 | self.selected_dicom = self.selected_panel.dicom_info |
@@ -617,7 +603,6 @@ class DicomPreviewSlice(wx.Panel): | @@ -617,7 +603,6 @@ class DicomPreviewSlice(wx.Panel): | ||
617 | self._display_previews() | 603 | self._display_previews() |
618 | 604 | ||
619 | def OnWheel(self, evt): | 605 | def OnWheel(self, evt): |
620 | - print "OnWheel" | ||
621 | d = evt.GetWheelDelta() / evt.GetWheelRotation() | 606 | d = evt.GetWheelDelta() / evt.GetWheelRotation() |
622 | self.scroll.SetThumbPosition(self.scroll.GetThumbPosition() - d) | 607 | self.scroll.SetThumbPosition(self.scroll.GetThumbPosition() - d) |
623 | self.OnScroll() | 608 | self.OnScroll() |
@@ -747,7 +732,7 @@ class SingleImagePreview(wx.Panel): | @@ -747,7 +732,7 @@ class SingleImagePreview(wx.Panel): | ||
747 | #TODO: temporary fix necessary in the Windows XP 64 Bits | 732 | #TODO: temporary fix necessary in the Windows XP 64 Bits |
748 | #BUG in wxWidgets http://trac.wxwidgets.org/ticket/10896 | 733 | #BUG in wxWidgets http://trac.wxwidgets.org/ticket/10896 |
749 | except(wx._core.PyAssertionError): | 734 | except(wx._core.PyAssertionError): |
750 | - print "wx._core.PyAssertionError" | 735 | + utils.debug("wx._core.PyAssertionError") |
751 | finally: | 736 | finally: |
752 | wx.CallAfter(self.OnRun) | 737 | wx.CallAfter(self.OnRun) |
753 | 738 | ||
@@ -757,12 +742,10 @@ class SingleImagePreview(wx.Panel): | @@ -757,12 +742,10 @@ class SingleImagePreview(wx.Panel): | ||
757 | self.nimages = len(self.dicom_list) | 742 | self.nimages = len(self.dicom_list) |
758 | # GUI | 743 | # GUI |
759 | self.slider.SetMax(self.nimages-1) | 744 | self.slider.SetMax(self.nimages-1) |
760 | - print self.nimages | ||
761 | self.slider.SetValue(0) | 745 | self.slider.SetValue(0) |
762 | self.ShowSlice() | 746 | self.ShowSlice() |
763 | 747 | ||
764 | def ShowSlice(self, index = 0): | 748 | def ShowSlice(self, index = 0): |
765 | - print "ShowSlice" | ||
766 | dicom = self.dicom_list[index] | 749 | dicom = self.dicom_list[index] |
767 | 750 | ||
768 | # UPDATE GUI | 751 | # UPDATE GUI |
@@ -773,7 +756,6 @@ class SingleImagePreview(wx.Panel): | @@ -773,7 +756,6 @@ class SingleImagePreview(wx.Panel): | ||
773 | ## Text related to slice position | 756 | ## Text related to slice position |
774 | value1 = STR_SPC %(dicom.image.spacing[2]) | 757 | value1 = STR_SPC %(dicom.image.spacing[2]) |
775 | value2 = STR_LOCAL %(dicom.image.position[2]) | 758 | value2 = STR_LOCAL %(dicom.image.position[2]) |
776 | - print "Este eh o meu tipo", type(value1) | ||
777 | value = "%s\n%s" %(value1, value2) | 759 | value = "%s\n%s" %(value1, value2) |
778 | self.text_image_location.SetValue(value) | 760 | self.text_image_location.SetValue(value) |
779 | 761 | ||
@@ -802,7 +784,3 @@ class SingleImagePreview(wx.Panel): | @@ -802,7 +784,3 @@ class SingleImagePreview(wx.Panel): | ||
802 | 784 | ||
803 | # Setting slider position | 785 | # Setting slider position |
804 | self.slider.SetValue(index) | 786 | self.slider.SetValue(index) |
805 | - | ||
806 | - def __del__(self): | ||
807 | - print "---------> morri" | ||
808 | - |
invesalius/gui/frame.py
@@ -32,6 +32,7 @@ import gui.dialogs as dlg | @@ -32,6 +32,7 @@ import gui.dialogs as dlg | ||
32 | import import_panel as imp | 32 | import import_panel as imp |
33 | import project as prj | 33 | import project as prj |
34 | import session as ses | 34 | import session as ses |
35 | +import utils | ||
35 | 36 | ||
36 | # Object toolbar | 37 | # Object toolbar |
37 | #OBJ_TOOLS = [ID_ZOOM, ID_ZOOM_SELECT, ID_ROTATE, ID_MOVE, | 38 | #OBJ_TOOLS = [ID_ZOOM, ID_ZOOM_SELECT, ID_ROTATE, ID_MOVE, |
@@ -200,7 +201,7 @@ class Frame(wx.Frame): | @@ -200,7 +201,7 @@ class Frame(wx.Frame): | ||
200 | aui_manager.Update() | 201 | aui_manager.Update() |
201 | 202 | ||
202 | def HideImportPanel(self, evt_pubsub): | 203 | def HideImportPanel(self, evt_pubsub): |
203 | - print "HideImportPanel" | 204 | + utils.debug("HideImportPanel") |
204 | aui_manager = self.aui_manager | 205 | aui_manager = self.aui_manager |
205 | aui_manager.GetPane("Import").Show(0) | 206 | aui_manager.GetPane("Import").Show(0) |
206 | aui_manager.GetPane("Data").Show(0) | 207 | aui_manager.GetPane("Data").Show(0) |
@@ -208,7 +209,7 @@ class Frame(wx.Frame): | @@ -208,7 +209,7 @@ class Frame(wx.Frame): | ||
208 | aui_manager.Update() | 209 | aui_manager.Update() |
209 | 210 | ||
210 | def ShowContentPanel(self, evt_pubsub): | 211 | def ShowContentPanel(self, evt_pubsub): |
211 | - print "ShowContentPanel" | 212 | + utils.debug("ShowContentPanel") |
212 | ps.Publisher().sendMessage("Set layout button full") | 213 | ps.Publisher().sendMessage("Set layout button full") |
213 | aui_manager = self.aui_manager | 214 | aui_manager = self.aui_manager |
214 | aui_manager.GetPane("Import").Show(0) | 215 | aui_manager.GetPane("Import").Show(0) |
@@ -264,16 +265,15 @@ class Frame(wx.Frame): | @@ -264,16 +265,15 @@ class Frame(wx.Frame): | ||
264 | ps.Publisher().sendMessage('Show save dialog', False) | 265 | ps.Publisher().sendMessage('Show save dialog', False) |
265 | 266 | ||
266 | def CloseProject(self): | 267 | def CloseProject(self): |
267 | - print "CloseProject" | 268 | + utils.debug("CloseProject") |
268 | ps.Publisher().sendMessage('Close Project') | 269 | ps.Publisher().sendMessage('Close Project') |
269 | 270 | ||
270 | def OnExit(self, event): | 271 | def OnExit(self, event): |
271 | - print "OnExit" | ||
272 | self.Exit() | 272 | self.Exit() |
273 | event.Skip() | 273 | event.Skip() |
274 | 274 | ||
275 | def Exit(self): | 275 | def Exit(self): |
276 | - print "Exit" | 276 | + utils.debug("Exit") |
277 | ps.Publisher().sendMessage('Close Project') | 277 | ps.Publisher().sendMessage('Close Project') |
278 | 278 | ||
279 | def ShowTask(self, pubsub_evt): | 279 | def ShowTask(self, pubsub_evt): |
@@ -284,7 +284,6 @@ class Frame(wx.Frame): | @@ -284,7 +284,6 @@ class Frame(wx.Frame): | ||
284 | self.aui_manager.GetPane("Tasks").Hide() | 284 | self.aui_manager.GetPane("Tasks").Hide() |
285 | self.aui_manager.Update() | 285 | self.aui_manager.Update() |
286 | 286 | ||
287 | - | ||
288 | #def OnClose(self): | 287 | #def OnClose(self): |
289 | # # TODO: implement this, based on wx.Demo | 288 | # # TODO: implement this, based on wx.Demo |
290 | # pass | 289 | # pass |
@@ -387,9 +386,7 @@ class MenuBar(wx.MenuBar): | @@ -387,9 +386,7 @@ class MenuBar(wx.MenuBar): | ||
387 | self.SetStateProjectClose() | 386 | self.SetStateProjectClose() |
388 | 387 | ||
389 | def OnEnableState(self, pubsub_evt): | 388 | def OnEnableState(self, pubsub_evt): |
390 | - print "----- OnEnableState" | ||
391 | state = pubsub_evt.data | 389 | state = pubsub_evt.data |
392 | - print "state", state | ||
393 | if state: | 390 | if state: |
394 | self.SetStateProjectOpen() | 391 | self.SetStateProjectOpen() |
395 | else: | 392 | else: |
@@ -473,7 +470,7 @@ class StatusBar(wx.StatusBar): | @@ -473,7 +470,7 @@ class StatusBar(wx.StatusBar): | ||
473 | #TODO: temporary fix necessary in the Windows XP 64 Bits | 470 | #TODO: temporary fix necessary in the Windows XP 64 Bits |
474 | #BUG in wxWidgets http://trac.wxwidgets.org/ticket/10896 | 471 | #BUG in wxWidgets http://trac.wxwidgets.org/ticket/10896 |
475 | except(wx._core.PyAssertionError): | 472 | except(wx._core.PyAssertionError): |
476 | - print "wx._core.PyAssertionError" | 473 | + utils.debug("wx._core.PyAssertionError") |
477 | 474 | ||
478 | def UpdateStatusLabel(self, pubsub_evt): | 475 | def UpdateStatusLabel(self, pubsub_evt): |
479 | label = pubsub_evt.data | 476 | label = pubsub_evt.data |
invesalius/gui/import_panel.py
@@ -152,10 +152,10 @@ class InnerPanel(wx.Panel): | @@ -152,10 +152,10 @@ class InnerPanel(wx.Panel): | ||
152 | self.image_panel.SetSerie(group) | 152 | self.image_panel.SetSerie(group) |
153 | 153 | ||
154 | def OnSelectSlice(self, evt): | 154 | def OnSelectSlice(self, evt): |
155 | - print "You've selected the slice", evt.GetSelectID() | 155 | + pass |
156 | 156 | ||
157 | def OnSelectPatient(self, evt): | 157 | def OnSelectPatient(self, evt): |
158 | - print "You've selected the patient", evt.GetSelectID() | 158 | + pass |
159 | 159 | ||
160 | def OnDblClickTextPanel(self, evt): | 160 | def OnDblClickTextPanel(self, evt): |
161 | group = evt.GetItemData() | 161 | group = evt.GetItemData() |
@@ -286,10 +286,7 @@ class TextPanel(wx.Panel): | @@ -286,10 +286,7 @@ class TextPanel(wx.Panel): | ||
286 | dicom.acquisition.serie_number)] = child | 286 | dicom.acquisition.serie_number)] = child |
287 | 287 | ||
288 | tree.Expand(self.root) | 288 | tree.Expand(self.root) |
289 | - | ||
290 | tree.SelectItem(parent_select) | 289 | tree.SelectItem(parent_select) |
291 | - print "parent select", parent_select | ||
292 | - | ||
293 | tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) | 290 | tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) |
294 | tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) | 291 | tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) |
295 | 292 | ||
@@ -372,12 +369,9 @@ class ImagePanel(wx.Panel): | @@ -372,12 +369,9 @@ class ImagePanel(wx.Panel): | ||
372 | self.text_panel.Bind(EVT_SELECT_SLICE, self.OnSelectSlice) | 369 | self.text_panel.Bind(EVT_SELECT_SLICE, self.OnSelectSlice) |
373 | 370 | ||
374 | def OnSelectSerie(self, evt): | 371 | def OnSelectSerie(self, evt): |
375 | - print "Hi, You selected Serie" | ||
376 | evt.Skip() | 372 | evt.Skip() |
377 | 373 | ||
378 | def OnSelectSlice(self, evt): | 374 | def OnSelectSlice(self, evt): |
379 | - print "Hi, You selected slice" | ||
380 | - print "Selected ID", evt.GetSelectID() | ||
381 | self.image_panel.dicom_preview.ShowSlice(evt.GetSelectID()) | 375 | self.image_panel.dicom_preview.ShowSlice(evt.GetSelectID()) |
382 | evt.Skip() | 376 | evt.Skip() |
383 | 377 | ||
@@ -437,7 +431,6 @@ class SeriesPanel(wx.Panel): | @@ -437,7 +431,6 @@ class SeriesPanel(wx.Panel): | ||
437 | self.Update() | 431 | self.Update() |
438 | 432 | ||
439 | def OnSelectSerie(self, evt): | 433 | def OnSelectSerie(self, evt): |
440 | - print "Hey, You selected a serie" | ||
441 | serie = evt.GetItemData() | 434 | serie = evt.GetItemData() |
442 | data = evt.GetItemData() | 435 | data = evt.GetItemData() |
443 | 436 | ||
@@ -454,8 +447,6 @@ class SeriesPanel(wx.Panel): | @@ -454,8 +447,6 @@ class SeriesPanel(wx.Panel): | ||
454 | self.Update() | 447 | self.Update() |
455 | 448 | ||
456 | def OnSelectSlice(self, evt): | 449 | def OnSelectSlice(self, evt): |
457 | - print "Hey, Ho, Let's go", evt.GetSelectID() | ||
458 | - | ||
459 | my_evt = SelectEvent(myEVT_SELECT_SLICE, self.GetId()) | 450 | my_evt = SelectEvent(myEVT_SELECT_SLICE, self.GetId()) |
460 | my_evt.SetSelectedID(evt.GetSelectID()) | 451 | my_evt.SetSelectedID(evt.GetSelectID()) |
461 | my_evt.SetItemData(evt.GetItemData()) | 452 | my_evt.SetItemData(evt.GetItemData()) |
@@ -481,7 +472,6 @@ class SlicePanel(wx.Panel): | @@ -481,7 +472,6 @@ class SlicePanel(wx.Panel): | ||
481 | 472 | ||
482 | def __init_gui(self): | 473 | def __init_gui(self): |
483 | self.SetBackgroundColour((255,255,255)) | 474 | self.SetBackgroundColour((255,255,255)) |
484 | - print "----------------------------" | ||
485 | self.dicom_preview = dpp.SingleImagePreview(self) | 475 | self.dicom_preview = dpp.SingleImagePreview(self) |
486 | 476 | ||
487 | sizer = wx.BoxSizer(wx.VERTICAL) | 477 | sizer = wx.BoxSizer(wx.VERTICAL) |
invesalius/gui/task_slice.py
@@ -408,6 +408,7 @@ class MaskProperties(wx.Panel): | @@ -408,6 +408,7 @@ class MaskProperties(wx.Panel): | ||
408 | 408 | ||
409 | def SetThresholdModes(self, pubsub_evt): | 409 | def SetThresholdModes(self, pubsub_evt): |
410 | (thresh_modes_names, default_thresh) = pubsub_evt.data | 410 | (thresh_modes_names, default_thresh) = pubsub_evt.data |
411 | + print pubsub_evt.data | ||
411 | self.combo_thresh.SetItems(thresh_modes_names) | 412 | self.combo_thresh.SetItems(thresh_modes_names) |
412 | if isinstance(default_thresh, int): | 413 | if isinstance(default_thresh, int): |
413 | self.combo_thresh.SetSelection(default_thresh) | 414 | self.combo_thresh.SetSelection(default_thresh) |
@@ -417,10 +418,12 @@ class MaskProperties(wx.Panel): | @@ -417,10 +418,12 @@ class MaskProperties(wx.Panel): | ||
417 | self.combo_thresh.SetSelection(3) | 418 | self.combo_thresh.SetSelection(3) |
418 | thresh_min, thresh_max = default_thresh | 419 | thresh_min, thresh_max = default_thresh |
419 | 420 | ||
421 | + print "Este e threshold", thresh_min, thresh_max | ||
420 | self.gradient.SetMinValue(thresh_min) | 422 | self.gradient.SetMinValue(thresh_min) |
421 | self.gradient.SetMaxValue(thresh_max) | 423 | self.gradient.SetMaxValue(thresh_max) |
422 | 424 | ||
423 | def SetThresholdBounds(self, pubsub_evt): | 425 | def SetThresholdBounds(self, pubsub_evt): |
426 | + print ">>>Threshold Limits", pubsub_evt.data | ||
424 | thresh_min = pubsub_evt.data[0] | 427 | thresh_min = pubsub_evt.data[0] |
425 | thresh_max = pubsub_evt.data[1] | 428 | thresh_max = pubsub_evt.data[1] |
426 | self.gradient.SetMinRange(thresh_min) | 429 | self.gradient.SetMinRange(thresh_min) |
invesalius/gui/widgets/gradient.py
@@ -582,6 +582,7 @@ class GradientSlider(wx.Panel): | @@ -582,6 +582,7 @@ class GradientSlider(wx.Panel): | ||
582 | self.GradientPanel.Refresh() | 582 | self.GradientPanel.Refresh() |
583 | 583 | ||
584 | def SetMaxRange(self, value): | 584 | def SetMaxRange(self, value): |
585 | + print "Setting max range ", value | ||
585 | self.SliderData.SetMaxRange(value) | 586 | self.SliderData.SetMaxRange(value) |
586 | self.SpinMin.SetMax(value) | 587 | self.SpinMin.SetMax(value) |
587 | self.SpinMax.SetMax(value) | 588 | self.SpinMax.SetMax(value) |
invesalius/invesalius.py
@@ -25,6 +25,7 @@ import sys | @@ -25,6 +25,7 @@ import sys | ||
25 | import gui.language_dialog as lang_dlg | 25 | import gui.language_dialog as lang_dlg |
26 | import i18n | 26 | import i18n |
27 | from session import Session | 27 | from session import Session |
28 | +import utils | ||
28 | 29 | ||
29 | 30 | ||
30 | # TODO: This should be called during installation | 31 | # TODO: This should be called during installation |
@@ -179,7 +180,7 @@ def parse_comand_line(): | @@ -179,7 +180,7 @@ def parse_comand_line(): | ||
179 | 180 | ||
180 | 181 | ||
181 | def print_events(data): | 182 | def print_events(data): |
182 | - print data.topic | 183 | + utils.debug(data.topic) |
183 | 184 | ||
184 | def main(): | 185 | def main(): |
185 | application = InVesalius(0) | 186 | application = InVesalius(0) |
invesalius/project.py
@@ -153,7 +153,7 @@ class Project(object): | @@ -153,7 +153,7 @@ class Project(object): | ||
153 | elif type_ == "CT": | 153 | elif type_ == "CT": |
154 | self.threshold_modes = self.presets.thresh_ct | 154 | self.threshold_modes = self.presets.thresh_ct |
155 | else: | 155 | else: |
156 | - print "Different Acquisition Modality!!!" | 156 | + utils.debug("Different Acquisition Modality!!!") |
157 | self.modality = type_ | 157 | self.modality = type_ |
158 | 158 | ||
159 | def SetRaycastPreset(self, label): | 159 | def SetRaycastPreset(self, label): |
@@ -187,13 +187,11 @@ class Project(object): | @@ -187,13 +187,11 @@ class Project(object): | ||
187 | for index in self.mask_dict: | 187 | for index in self.mask_dict: |
188 | masks[str(index)] = {'#mask':\ | 188 | masks[str(index)] = {'#mask':\ |
189 | self.mask_dict[index].SavePlist(filename_tmp).decode('utf-8')} | 189 | self.mask_dict[index].SavePlist(filename_tmp).decode('utf-8')} |
190 | - print index | ||
191 | 190 | ||
192 | surfaces = {} | 191 | surfaces = {} |
193 | for index in self.surface_dict: | 192 | for index in self.surface_dict: |
194 | surfaces[str(index)] = {'#surface':\ | 193 | surfaces[str(index)] = {'#surface':\ |
195 | self.surface_dict[index].SavePlist(filename_tmp)} | 194 | self.surface_dict[index].SavePlist(filename_tmp)} |
196 | - print index | ||
197 | 195 | ||
198 | project['surface_dict'] = surfaces | 196 | project['surface_dict'] = surfaces |
199 | project['mask_dict'] = masks | 197 | project['mask_dict'] = masks |
@@ -219,15 +217,8 @@ class Project(object): | @@ -219,15 +217,8 @@ class Project(object): | ||
219 | filelist = Extract(filename, tempfile.gettempdir()) | 217 | filelist = Extract(filename, tempfile.gettempdir()) |
220 | main_plist = min(filter(lambda x: x.endswith('.plist'), filelist), | 218 | main_plist = min(filter(lambda x: x.endswith('.plist'), filelist), |
221 | key=lambda x: len(x)) | 219 | key=lambda x: len(x)) |
222 | - #print main_plist | ||
223 | - print main_plist | ||
224 | project = plistlib.readPlist(main_plist) | 220 | project = plistlib.readPlist(main_plist) |
225 | - | ||
226 | - #print "antes", self.__dict__ | ||
227 | - | ||
228 | - # Path were extracted project is | ||
229 | dirpath = os.path.abspath(os.path.split(filelist[0])[0]) | 221 | dirpath = os.path.abspath(os.path.split(filelist[0])[0]) |
230 | - #print "* dirpath", dirpath | ||
231 | 222 | ||
232 | for key in project: | 223 | for key in project: |
233 | if key == 'imagedata': | 224 | if key == 'imagedata': |
invesalius/reader/dicom.py
@@ -1821,7 +1821,6 @@ class Acquisition(object): | @@ -1821,7 +1821,6 @@ class Acquisition(object): | ||
1821 | def SetParser(self, parser): | 1821 | def SetParser(self, parser): |
1822 | self.patient_orientation = parser.GetImagePatientOrientation() | 1822 | self.patient_orientation = parser.GetImagePatientOrientation() |
1823 | self.tilt = parser.GetAcquisitionGantryTilt() | 1823 | self.tilt = parser.GetAcquisitionGantryTilt() |
1824 | - self.serie_number = parser.GetImageSeriesNumber() | ||
1825 | self.id_study = parser.GetStudyID() | 1824 | self.id_study = parser.GetStudyID() |
1826 | self.modality = parser.GetAcquisitionModality() | 1825 | self.modality = parser.GetAcquisitionModality() |
1827 | self.study_description = parser.GetStudyDescription() | 1826 | self.study_description = parser.GetStudyDescription() |
invesalius/reader/dicom_grouper.py
@@ -53,6 +53,8 @@ | @@ -53,6 +53,8 @@ | ||
53 | 53 | ||
54 | import gdcm | 54 | import gdcm |
55 | 55 | ||
56 | +import utils | ||
57 | + | ||
56 | ORIENT_MAP = {"SAGITTAL":0, "CORONAL":1, "AXIAL":2, "OBLIQUE":2} | 58 | ORIENT_MAP = {"SAGITTAL":0, "CORONAL":1, "AXIAL":2, "OBLIQUE":2} |
57 | 59 | ||
58 | 60 | ||
@@ -209,12 +211,15 @@ class PatientGroup: | @@ -209,12 +211,15 @@ class PatientGroup: | ||
209 | 211 | ||
210 | # Check if Problem 1 occurs (n groups with 1 slice each) | 212 | # Check if Problem 1 occurs (n groups with 1 slice each) |
211 | is_there_problem_1 = False | 213 | is_there_problem_1 = False |
214 | + utils.debug("n slice %d" % self.nslices) | ||
215 | + utils.debug("len %d" % len(self.groups_dict)) | ||
212 | if (self.nslices == len(self.groups_dict)) and\ | 216 | if (self.nslices == len(self.groups_dict)) and\ |
213 | (self.nslices > 1): | 217 | (self.nslices > 1): |
214 | is_there_problem_1 = True | 218 | is_there_problem_1 = True |
215 | 219 | ||
216 | # Fix Problem 1 | 220 | # Fix Problem 1 |
217 | if is_there_problem_1: | 221 | if is_there_problem_1: |
222 | + utils.debug("Problem1") | ||
218 | self.groups_dict = self.FixProblem1(self.groups_dict) | 223 | self.groups_dict = self.FixProblem1(self.groups_dict) |
219 | 224 | ||
220 | def GetGroups(self): | 225 | def GetGroups(self): |
invesalius/reader/dicom_reader.py
@@ -141,6 +141,8 @@ def yGetDicomGroups(directory, recursive=True, gui=True): | @@ -141,6 +141,8 @@ def yGetDicomGroups(directory, recursive=True, gui=True): | ||
141 | for t in threads: | 141 | for t in threads: |
142 | t.join() | 142 | t.join() |
143 | 143 | ||
144 | + #TODO: Is this commented update necessary? | ||
145 | + #grouper.Update() | ||
144 | yield grouper.GetPatientsGroups() | 146 | yield grouper.GetPatientsGroups() |
145 | 147 | ||
146 | def GetDicomGroups(directory, recursive=True): | 148 | def GetDicomGroups(directory, recursive=True): |
invesalius/session.py
@@ -4,7 +4,7 @@ from threading import Thread | @@ -4,7 +4,7 @@ from threading import Thread | ||
4 | import time | 4 | import time |
5 | import wx.lib.pubsub as ps | 5 | import wx.lib.pubsub as ps |
6 | 6 | ||
7 | -from utils import Singleton | 7 | +from utils import Singleton, debug |
8 | 8 | ||
9 | import wx.lib.pubsub as ps | 9 | import wx.lib.pubsub as ps |
10 | 10 | ||
@@ -46,7 +46,6 @@ class Session(object): | @@ -46,7 +46,6 @@ class Session(object): | ||
46 | 46 | ||
47 | # Recent projects list | 47 | # Recent projects list |
48 | self.recent_projects = [(const.SAMPLE_DIR, "Cranium.inv3")] | 48 | self.recent_projects = [(const.SAMPLE_DIR, "Cranium.inv3")] |
49 | - print self.recent_projects | ||
50 | self.last_dicom_folder = '' | 49 | self.last_dicom_folder = '' |
51 | 50 | ||
52 | self.CreateSessionFile() | 51 | self.CreateSessionFile() |
@@ -57,7 +56,7 @@ class Session(object): | @@ -57,7 +56,7 @@ class Session(object): | ||
57 | 56 | ||
58 | def CloseProject(self): | 57 | def CloseProject(self): |
59 | import constants as const | 58 | import constants as const |
60 | - print "-- CloseProject" | 59 | + debug("Session.CloseProject") |
61 | self.project_path = () | 60 | self.project_path = () |
62 | self.project_status = const.PROJ_CLOSE | 61 | self.project_status = const.PROJ_CLOSE |
63 | self.mode = const.MODE_RP | 62 | self.mode = const.MODE_RP |
@@ -65,7 +64,7 @@ class Session(object): | @@ -65,7 +64,7 @@ class Session(object): | ||
65 | 64 | ||
66 | def SaveProject(self, path=()): | 65 | def SaveProject(self, path=()): |
67 | import constants as const | 66 | import constants as const |
68 | - print "-- SaveProject" | 67 | + debug("Session.SaveProject") |
69 | self.project_status = const.PROJ_OPEN | 68 | self.project_status = const.PROJ_OPEN |
70 | if path: | 69 | if path: |
71 | self.project_path = path | 70 | self.project_path = path |
@@ -75,13 +74,13 @@ class Session(object): | @@ -75,13 +74,13 @@ class Session(object): | ||
75 | 74 | ||
76 | def ChangeProject(self): | 75 | def ChangeProject(self): |
77 | import constants as const | 76 | import constants as const |
78 | - print "-- ChangeProject" | 77 | + debug("Session.ChangeProject") |
79 | self.project_status = const.PROJ_CHANGE | 78 | self.project_status = const.PROJ_CHANGE |
80 | 79 | ||
81 | def CreateProject(self, filename): | 80 | def CreateProject(self, filename): |
82 | import constants as const | 81 | import constants as const |
82 | + debug("Session.CreateProject") | ||
83 | ps.Publisher().sendMessage('Begin busy cursor') | 83 | ps.Publisher().sendMessage('Begin busy cursor') |
84 | - print "-- CreateProject" | ||
85 | # Set session info | 84 | # Set session info |
86 | self.project_path = (self.tempdir, filename) | 85 | self.project_path = (self.tempdir, filename) |
87 | self.project_status = const.PROJ_NEW | 86 | self.project_status = const.PROJ_NEW |
@@ -90,7 +89,7 @@ class Session(object): | @@ -90,7 +89,7 @@ class Session(object): | ||
90 | 89 | ||
91 | def OpenProject(self, filepath): | 90 | def OpenProject(self, filepath): |
92 | import constants as const | 91 | import constants as const |
93 | - print "-- OpenProject" | 92 | + debug("Session.OpenProject") |
94 | # Add item to recent projects list | 93 | # Add item to recent projects list |
95 | item = (path, file) = os.path.split(filepath) | 94 | item = (path, file) = os.path.split(filepath) |
96 | self.__add_to_list(item) | 95 | self.__add_to_list(item) |
invesalius/utils.py
@@ -25,10 +25,10 @@ import sys | @@ -25,10 +25,10 @@ import sys | ||
25 | 25 | ||
26 | 26 | ||
27 | def debug(error_str): | 27 | def debug(error_str): |
28 | - from project import Project | ||
29 | - proj = Project() | ||
30 | - if proj.debug: | ||
31 | - print >> stderr, str | 28 | + from session import Session |
29 | + session = Session() | ||
30 | + if session.debug: | ||
31 | + print >> sys.stderr, error_str | ||
32 | 32 | ||
33 | 33 | ||
34 | #http://www.garyrobinson.net/2004/03/python_singleto.html | 34 | #http://www.garyrobinson.net/2004/03/python_singleto.html |
@@ -67,7 +67,7 @@ class TwoWaysDictionary(dict): | @@ -67,7 +67,7 @@ class TwoWaysDictionary(dict): | ||
67 | try: | 67 | try: |
68 | self.pop(key) | 68 | self.pop(key) |
69 | except TypeError: | 69 | except TypeError: |
70 | - print "TwoWaysDictionary: no item" | 70 | + debug("TwoWaysDictionary: no item") |
71 | 71 | ||
72 | def get_value(self, key): | 72 | def get_value(self, key): |
73 | """ | 73 | """ |