rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.Reposition(slice_data) | def OnUnZoom(self, evt, obj = None): mouse_x, mouse_y = self.interactor.GetLastEventPosition() ren = self.interactor.FindPokedRenderer(mouse_x, mouse_y) slice_data = self.get_slice_data(ren) ren.ResetCamera() ren.ResetCameraClippingRange() self.Reposition(slice_data) self.interactor.Render() | |
ps.Publisher().sendMessage('Load slice to viewer', (proj.imagedata, proj.mask_dict)) | def LoadProject(self): proj = prj.Project() | |
_SplashScreen.__init__(self, | if sys.platform == 'linux2': _SplashScreen.__init__(self, | def __init__(self): # Splash screen image will depend on currently language lang = False |
if overwrite: | if overwrite and self.actors_dict.keys(): | def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. """ imagedata, colour, [min_value, max_value], \ edited_points, overwrite = pubsub_evt.data |
if sys.frozen == "windows_exe": | if hasattr(sys,"frozen") and sys.frozen == "windows_exe": | def main(): """ Initialize InVesalius GUI """ application = InVesalius(0) parse_comand_line() application.MainLoop() |
ps.Publisher().sendMessage('Set project name', proj.name) ps.Publisher().sendMessage('Load surface dict', proj.surface_dict) self.LoadImagedataInfo() ps.Publisher().sendMessage('Show content panel') ps.Publisher().sendMessage('Update AUI') | def LoadProject(self): proj = prj.Project() | |
actors = self.current[1].AddPoint(x, y, z) self.current[0].points.append(position) | actors = mr.AddPoint(x, y, z) m.points.append(position) | def _add_point(self, pubsub_evt): position = pubsub_evt.data[0] type = pubsub_evt.data[1] # Linear or Angular location = pubsub_evt.data[2] # 3D, AXIAL, SAGITAL, CORONAL try: slice_number = pubsub_evt.data[3] except IndexError: slice_number = 0 |
(actors, self.current[0].slice_number)) if self.current[1].IsComplete(): index = prj.Project().AddMeasurement(self.current[0]) self.current[0].index = index | (actors, m.slice_number)) if self.mr.IsComplete(): index = prj.Project().AddMeasurement(m) | def _add_point(self, pubsub_evt): position = pubsub_evt.data[0] type = pubsub_evt.data[1] # Linear or Angular location = pubsub_evt.data[2] # 3D, AXIAL, SAGITAL, CORONAL try: slice_number = pubsub_evt.data[3] except IndexError: slice_number = 0 |
name = self.current[0].name colour = self.current[0].colour self.current[0].value = self.current[1].GetValue() | name = m.name colour = m.colour m.value = mr.GetValue() | def _add_point(self, pubsub_evt): position = pubsub_evt.data[0] type = pubsub_evt.data[1] # Linear or Angular location = pubsub_evt.data[2] # 3D, AXIAL, SAGITAL, CORONAL try: slice_number = pubsub_evt.data[3] except IndexError: slice_number = 0 |
value = u"%.2f mm"% self.current[0].value | value = u"%.2f mm"% m.value | def _add_point(self, pubsub_evt): position = pubsub_evt.data[0] type = pubsub_evt.data[1] # Linear or Angular location = pubsub_evt.data[2] # 3D, AXIAL, SAGITAL, CORONAL try: slice_number = pubsub_evt.data[3] except IndexError: slice_number = 0 |
value = u"%.2f˚"% self.current[0].value | value = u"%.2f˚"% m.value | def _add_point(self, pubsub_evt): position = pubsub_evt.data[0] type = pubsub_evt.data[1] # Linear or Angular location = pubsub_evt.data[2] # 3D, AXIAL, SAGITAL, CORONAL try: slice_number = pubsub_evt.data[3] except IndexError: slice_number = 0 |
prj.Project().RemoveMeasurement(m) | prj.Project().RemoveMeasurement(index) | def _remove_measurements(self, pubsub_evt): indexes = pubsub_evt.data print indexes for index in indexes: m, mr = self.measures.pop(index) actors = mr.GetActors() prj.Project().RemoveMeasurement(m) ps.Publisher().sendMessage(('Remove actors', m.location), (actors, m.slice_number)) ps.Publisher().sendMessage('Update sli... |
path = os.path.join(d, "tool_translate.png") BMP_MOVE =wx.Bitmap(path, wx.BITMAP_TYPE_PNG) | path = os.path.join(d, "tool_translate.gif") BMP_MOVE =wx.Bitmap(path, wx.BITMAP_TYPE_GIF) | def __init_items(self): """ Add tools into toolbar. """ d = const.ICON_DIR if sys.platform == 'darwin': path = os.path.join(d, "tool_rotate_original.gif") BMP_ROTATE = wx.Bitmap(path, wx.BITMAP_TYPE_GIF) |
diff_ww, diff_wl = pubsub_evt.data | diff_wl, diff_ww = pubsub_evt.data | def OnSetRelativeWindowLevel(self, pubsub_evt): diff_ww, diff_wl = pubsub_evt.data ww = self.ww + diff_ww wl = self.wl + diff_wl ps.Publisher().sendMessage('Set volume window and level text', (ww, wl)) self.SetWWWL(ww, wl) self.ww = ww self.wl = wl |
self.SetWLText(self.acum_achange_level, self.acum_achange_window) | def OnWindowLevelMove(self, evt, obj): if (self.left_pressed): position = self.interactor.GetLastEventPosition() mouse_x, mouse_y = self.interactor.GetEventPosition() self.acum_achange_window += mouse_x - self.last_x self.acum_achange_level += mouse_y - self.last_y self.last_x, self.last_y = mouse_x, mouse_y | |
self.interactor.Render() | def OnWindowLevelMove(self, evt, obj): if (self.left_pressed): position = self.interactor.GetLastEventPosition() mouse_x, mouse_y = self.interactor.GetEventPosition() self.acum_achange_window += mouse_x - self.last_x self.acum_achange_level += mouse_y - self.last_y self.last_x, self.last_y = mouse_x, mouse_y | |
self.interactor.Render() | def SetWLText(self, window_width, window_level): value = STR_WL%(window_width, window_level) if (self.wl_text): self.wl_text.SetValue(value) self.interactor.Render() | |
def OnCrossMouseClick(self, evt, obj): self.ChangeCrossPosition() | def OnBrushMove(self, evt, obj): self.__set_editor_cursor_visibility(1) | |
mouse_x, mouse_y = self.interactor.GetEventPosition() renderer = self.slice_data_list[0].renderer self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer) coord_cross = self.get_coordinate_cursor() coord = self.get_coordinate() ps.Publisher().sendMessage('Update cross position', (self.orientation, coo... | self.ChangeCrossPosition() def ChangeCrossPosition(self): mouse_x, mouse_y = self.interactor.GetEventPosition() renderer = self.slice_data_list[0].renderer self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer) coord_cross = self.get_coordinate_cursor() coord = self.CalcultateScrollPosition(coord... | def OnCrossMove(self, evt, obj): # Update position in other slices if (self.left_pressed): mouse_x, mouse_y = self.interactor.GetEventPosition() renderer = self.slice_data_list[0].renderer self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer) coord_cross = self.get_coordinate_cursor() coord = self.... |
def OnCrossMouseClick(self, evt, obj): mouse_x, mouse_y = self.interactor.GetEventPosition() renderer = self.slice_data_list[0].renderer self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer) coord_cross = self.get_coordinate_cursor() coord = self.get_coordinate() ps.Publisher().sendMessage('Update ... | def OnZoomRightClick(self, evt, obj): evt.StartDolly() | |
def get_coordinate(self): x, y, z = self.pick.GetPickPosition() | def CalcultateScrollPosition(self, coord): x, y, z = coord | def get_coordinate(self): # Find position x, y, z = self.pick.GetPickPosition() |
coordinates = {"SAGITAL": [self.slice_number, y, z], "CORONAL": [x, self.slice_number, z], "AXIAL": [x, y, self.slice_number]} coord = [int(coord) for coord in coordinates[self.orientation]] | coordinates = {const.AXIAL: [x, y, z], const.SAGITAL: [z, x, y], const.CORONAL: [x, z, y]} coord = [int(i) for i in coordinates[orig_orien]] | def get_coordinate(self): # Find position x, y, z = self.pick.GetPickPosition() |
proj = project.Project() orig_orien = proj.original_orientation | def __update_cross_position(self, pubsub_evt): x, y, z = pubsub_evt.data[1] orientation = pubsub_evt.data[0] #xi, yi, zi = self.vline.GetPoint1() #xf, yf, zf = self.vline.GetPoint2() #self.vline.SetPoint1(x, yi, z) #self.vline.SetPoint2(x, yf, z) #self.vline.Update() | |
self.btn_ok.SetDefault() | def _init_ui(self): splitter = spl.MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) splitter.SetOrientation(wx.VERTICAL) self.splitter = splitter panel = wx.Panel(self) #button = wx.Button(panel, -1, _("Import medical images"), (20, 20)) | |
print 'ENTROU......' | def GetEncoding(self): """ Return the dicom encoding DICOM standard tag (0x0008, 0x0005) was used. """ tag = gdcm.Tag(0x0008, 0x0005) ds = self.gdcm_reader.GetFile().GetDataSet() if ds.FindDataElement(tag): encoding = str(ds.GetDataElement(tag).GetValue()) | |
try: path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, | path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, | def LoadRaycastingPreset(self, pubsub_evt): label = pubsub_evt.data if label != const.RAYCASTING_OFF_LABEL: if label in const.RAYCASTING_FILES.keys(): path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, const.RAYCASTING_FILES[label]) else: try: path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, label+".plist")... |
except IOError: | if not os.path.isfile(path): | def LoadRaycastingPreset(self, pubsub_evt): label = pubsub_evt.data if label != const.RAYCASTING_OFF_LABEL: if label in const.RAYCASTING_FILES.keys(): path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, const.RAYCASTING_FILES[label]) else: try: path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, label+".plist")... |
session = ses.Session() session.SaveProject() | def _load_measurements(self, pubsub_evt): dict = pubsub_evt.data for i in dict: m = dict[i] if m.type == const.LINEAR: mr = LinearMeasure(m.colour) else: mr = AngularMeasure(m.colour) self.current = (m, mr) self.measures.append(self.current) for point in m.points: x, y, z = point actors = mr.AddPoint(x, y, z) ps.Publis... | |
proj = project.Project() orig_orien = proj.original_orientation | x, y, z = self._assert_coord_into_image([x, y, z]) | def CalcultateScrollPosition(self, coord): # Based in the given coord (x, y, z), returns a list with the scroll positions for each # orientation, being the first position the sagital, second the coronal # and the last, axial. x, y, z = coord |
extent = self.imagedata.GetWholeExtent() extent_min = extent[0], extent[2], extent[4] extent_max = extent[1], extent[3], extent[5] for index in xrange(3): if coord[index] > extent_max[index]: coord[index] = extent_max[index] elif coord[index] < extent_min[index]: coord[index] = extent_min[index] | def CalcultateScrollPosition(self, coord): # Based in the given coord (x, y, z), returns a list with the scroll positions for each # orientation, being the first position the sagital, second the coronal # and the last, axial. x, y, z = coord | |
_ = i18n.InstallLanguage(language) | self.language = language | def __init__(self, pipe, filename, mode, min_value, max_value, decimate_reduction, smooth_relaxation_factor, smooth_iterations, language): |
r = image.GetScalarRange()[1] - image.GetScalarRange()[0] | r = int(image.GetScalarRange()[1] - image.GetScalarRange()[0]) | def CalculateHistogram(self): proj = prj.Project() image = proj.imagedata r = image.GetScalarRange()[1] - image.GetScalarRange()[0] accumulate = vtk.vtkImageAccumulate() accumulate.SetInput(image) accumulate.SetComponentExtent(0, r -1, 0, 0, 0, 0) accumulate.SetComponentOrigin(image.GetScalarRange()[0], 0, 0) accumulat... |
self.mapper.SetInput(value.encode("cp1252")) | try: self.mapper.SetInput(value.encode("latin-1")) except(UnicodeEncodeError): self.mapper.SetInput(value.encode("utf-8")) | def SetValue(self, value): if isinstance(value, int) or isinstance(value, float): value = str(value) if sys.platform == 'win32': value += "" # Otherwise 0 is not shown under win32 # With some encoding in some dicom fields (like name) raises a # UnicodeEncodeError because they have non-ascii characters. To avoid # that ... |
def SetTempDir(self, directory): self.directory = directory | def SetTempDir(self, directory): self.directory = directory | |
self._jpeg_file = tempfile.mktemp(suffix='.jpeg', dir=self.directory) | def jpeg_file(self): if self._jpeg_file: return self._jpeg_file else: self._jpeg_file = tempfile.mktemp(suffix='.jpeg', dir=self.directory) | |
print width, height, z,ni.shape | def jpeg_file(self): if self._jpeg_file: return self._jpeg_file else: self._jpeg_file = tempfile.mktemp(suffix='.jpeg', dir=self.directory) | |
img.Rescale(70, 70) | img = img.Rescale(70, 70).Mirror(False) | def jpeg_file(self): if self._jpeg_file: return self._jpeg_file else: self._jpeg_file = tempfile.mktemp(suffix='.jpeg', dir=self.directory) |
self.slided = 1 | def SetMinValue(self, value): try: value = value.data except AttributeError: pass self.GradientPanel.SetMinValue(value) self.slided = 1 self.SpinMin.SetValue(int(value)) self.slided = 0 self.GradientPanel.Refresh() | |
self.slided = 0 | def SetMinValue(self, value): try: value = value.data except AttributeError: pass self.GradientPanel.SetMinValue(value) self.slided = 1 self.SpinMin.SetValue(int(value)) self.slided = 0 self.GradientPanel.Refresh() | |
self.slided = 1 | def SetMaxValue(self, value): try: value = value.data except AttributeError: pass self.GradientPanel.SetMaxValue(value) self.slided = 1 self.SpinMax.SetValue(int(value)) self.slided = 0 self.GradientPanel.Refresh() | |
self.slided = 0 | def SetMaxValue(self, value): try: value = value.data except AttributeError: pass self.GradientPanel.SetMaxValue(value) self.slided = 1 self.SpinMax.SetValue(int(value)) self.slided = 0 self.GradientPanel.Refresh() | |
if dlg.ShowModal() == wx.ID_OK: print "TODO: Send Signal - New mask" | try: op = dlg.ShowModal() == wx.ID_OK except(wx._core.PyAssertionError): print "win64 - wx._core.PyAssertionError" op = True print "TODO: Send Signal - New mask" if (op): | def OnLinkNewMask(self, evt=None): dlg = wx.TextEntryDialog(self, _('Name of new mask:'), _('InVesalius 3 - New mask')) dlg.CenterOnScreen() default_mask_name = const.MASK_NAME_PATTERN %(mask.Mask.general_index+2) dlg.SetValue(default_mask_name) |
os_language = locale.getdefaultlocale()[0] return os_language | if sys.platform == 'darwin': locale.setlocale(locale.LC_ALL, "") return locale.getlocale()[0] return locale.getdefaultlocale()[0] | def GetLocaleOS(): """Return language of the operating system.""" os_language = locale.getdefaultlocale()[0] return os_language |
if tool_name == "Cut plane": | if tool_name == _("Cut plane"): | def OnEnableTool(self, pubsub_evt): print "OnEnableTool" tool_name, enable = pubsub_evt.data if tool_name == "Cut plane": if self.plane: if enable: print "Enable" self.plane_on = True self.plane.Enable() else: print "Disable" self.plane_on = False self.plane.Disable() else: print "Enable" self.plane_on = True self.plan... |
value = u"%.2f mm"% self.current[0].value | if type == const.LINEAR: value = u"%.2f mm"% self.current[0].value else: value = u"%.2f˚"% self.current[0].value | def _add_point(self, pubsub_evt): position = pubsub_evt.data[0] type = pubsub_evt.data[1] # Linear or Angular location = pubsub_evt.data[2] # 3D, AXIAL, SAGITAL, CORONAL try: slice_number = pubsub_evt.data[3] except IndexError: slice_number = 0 |
print "From buffer" | def GetSlices(self, orientation, slice_number): if self.buffer_slices[orientation][0] == slice_number: print "From buffer" image = self.buffer_slices[orientation][1] n_mask = self.buffer_slices[orientation][2] mask = iu.to_vtk(n_mask, self.spacing, slice_number, orientation) final_image = self.do_blend(image, self.do_c... | |
n_mask = self.buffer_slices[orientation][2] mask = iu.to_vtk(n_mask, self.spacing, slice_number, orientation) final_image = self.do_blend(image, self.do_colour_mask(mask)) | if self.current_mask and self.current_mask.is_shown: n_mask = self.buffer_slices[orientation][2] mask = iu.to_vtk(n_mask, self.spacing, slice_number, orientation) final_image = self.do_blend(image, self.do_colour_mask(mask)) else: final_image = image | def GetSlices(self, orientation, slice_number): if self.buffer_slices[orientation][0] == slice_number: print "From buffer" image = self.buffer_slices[orientation][1] n_mask = self.buffer_slices[orientation][2] mask = iu.to_vtk(n_mask, self.spacing, slice_number, orientation) final_image = self.do_blend(image, self.do_c... |
n_image = numpy.array(self.matrix[slice_number]) elif orientation == 'CORONAL': n_image = numpy.array(self.matrix[..., slice_number, ...]) elif orientation == 'SAGITAL': n_image = numpy.array(self.matrix[..., ..., slice_number]) return n_image def GetMaskSlice(self, orientation, slice_number): slice_number += 1 if ori... | if self.current_mask.matrix[n, 0, 0] == 0: self.current_mask.matrix[n, 1:, 1:] = \ | def GetImageSlice(self, orientation, slice_number): if orientation == 'AXIAL': n_image = numpy.array(self.matrix[slice_number]) elif orientation == 'CORONAL': n_image = numpy.array(self.matrix[..., slice_number, ...]) elif orientation == 'SAGITAL': n_image = numpy.array(self.matrix[..., ..., slice_number]) return n_ima... |
self.current_mask.matrix[slice_number, 0, 0] = 1 n_mask = numpy.array(self.current_mask.matrix[slice_number]) | self.current_mask.matrix[n, 0, 0] = 1 n_mask = numpy.array(self.current_mask.matrix[n, 1:, 1:]) | def GetMaskSlice(self, orientation, slice_number): slice_number += 1 if orientation == 'AXIAL': if self.current_mask.matrix[slice_number, 0, 0] == 0: self.current_mask.matrix[slice_number, 1:, 1:] = \ self.do_threshold_to_a_slice(self.GetImageSlice(orientation, slice_number)) self.current_mask.matrix[slice_number, 0, 0... |
if self.current_mask.matrix[0, slice_number, 0] == 0: self.current_mask.matrix[1:, slice_number, 1:] = \ | if self.current_mask.matrix[0, n, 0] == 0: self.current_mask.matrix[1:, n, 1:] = \ | def GetMaskSlice(self, orientation, slice_number): slice_number += 1 if orientation == 'AXIAL': if self.current_mask.matrix[slice_number, 0, 0] == 0: self.current_mask.matrix[slice_number, 1:, 1:] = \ self.do_threshold_to_a_slice(self.GetImageSlice(orientation, slice_number)) self.current_mask.matrix[slice_number, 0, 0... |
self.current_mask.matrix[0, slice_number, 0] = 1 n_mask = numpy.array(self.current_mask.matrix[..., slice_number, ...]) | self.current_mask.matrix[0, n, 0] = 1 n_mask = numpy.array(self.current_mask.matrix[1:, n, 1:]) | def GetMaskSlice(self, orientation, slice_number): slice_number += 1 if orientation == 'AXIAL': if self.current_mask.matrix[slice_number, 0, 0] == 0: self.current_mask.matrix[slice_number, 1:, 1:] = \ self.do_threshold_to_a_slice(self.GetImageSlice(orientation, slice_number)) self.current_mask.matrix[slice_number, 0, 0... |
if self.current_mask.matrix[0, 0, slice_number] == 0: self.current_mask.matrix[1:, 1:, slice_number] = \ | if self.current_mask.matrix[0, 0, n] == 0: self.current_mask.matrix[1:, 1:, n] = \ | def GetMaskSlice(self, orientation, slice_number): slice_number += 1 if orientation == 'AXIAL': if self.current_mask.matrix[slice_number, 0, 0] == 0: self.current_mask.matrix[slice_number, 1:, 1:] = \ self.do_threshold_to_a_slice(self.GetImageSlice(orientation, slice_number)) self.current_mask.matrix[slice_number, 0, 0... |
self.current_mask.matrix[0, 0, slice_number] = 1 n_mask = numpy.array(self.current_mask.matrix[..., ..., slice_number]) | self.current_mask.matrix[0, 0, n] = 1 n_mask = numpy.array(self.current_mask.matrix[1:, 1:, n]) | def GetMaskSlice(self, orientation, slice_number): slice_number += 1 if orientation == 'AXIAL': if self.current_mask.matrix[slice_number, 0, 0] == 0: self.current_mask.matrix[slice_number, 1:, 1:] = \ self.do_threshold_to_a_slice(self.GetImageSlice(orientation, slice_number)) self.current_mask.matrix[slice_number, 0, 0... |
m = numpy.zeros(slice_.shape, self.current_mask.matrix.dtype) m[numpy.logical_and(slice_ >= thresh_min,slice_ <= thresh_max)] = 255 self.buffer_slices[orientation][2] = m | self.buffer_slices[orientation][2][:] = 0 self.buffer_slices[orientation][2][numpy.logical_and(slice_ >= thresh_min,slice_ <= thresh_max)] = 255 | def SetMaskThreshold(self, index, threshold_range, slice_number=None, orientation=None): """ Set a mask threshold range given its index and tuple of min and max threshold values. |
if value: self.blend_filter.SetOpacity(1, self.current_mask.opacity) else: self.blend_filter.SetOpacity(1, 0) self.blend_filter.Update() ps.Publisher().sendMessage('Update slice viewer') | self.buffer_slices = {"AXIAL": [-1, None, None], "CORONAL": [-1,None, None], "SAGITAL": [-1, None, None]} ps.Publisher().sendMessage('Reload actual slice') | def ShowMask(self, index, value): "Show a mask given its index and 'show' value (0: hide, other: show)" proj = Project() proj.mask_dict[index].is_shown = value if (index == self.current_mask.index): if value: self.blend_filter.SetOpacity(1, self.current_mask.opacity) else: self.blend_filter.SetOpacity(1, 0) self.blend_... |
if self.current_mask and self.blend_filter and index > -1: proj = Project() future_mask = proj.GetMask(index) future_mask.is_shown = True self.current_mask = future_mask colour = future_mask.colour print index self.SetMaskColour(index, colour, update=False) imagedata = future_mask.imagedata self.img_colours_mask.Set... | proj = Project() future_mask = proj.GetMask(index) future_mask.is_shown = True self.current_mask = future_mask colour = future_mask.colour print index self.SetMaskColour(index, colour, update=False) self.buffer_slices = {"AXIAL": [-1, None, None], "CORONAL": [-1,None, None], "SAGITAL": [-1, None, None]} ps.Publishe... | def SelectCurrentMask(self, index): "Insert mask data, based on given index, into pipeline." # This condition is not necessary in Linux, only under mac and windows # because combobox event is binded when the same item is selected again. #if index != self.current_mask.index: print "SelectCurrentMask" print "index:", ind... |
debug("ShowDialogCloseProject") | def ShowDialogCloseProject(self): debug("ShowDialogCloseProject") session = ses.Session() st = session.project_status if st == const.PROJ_CLOSE: return -1 try: filename = session.project_path[1] except(AttributeError): print "Project doesn't exist" filename = None | |
print "Project doesn't exist" | debug("Project doesn't exist") | def ShowDialogCloseProject(self): debug("ShowDialogCloseProject") session = ses.Session() st = session.project_status if st == const.PROJ_CLOSE: return -1 try: filename = session.project_path[1] except(AttributeError): print "Project doesn't exist" filename = None |
x, y, z = position | x, y, z = round(position[0],0), round(position[1],0),position[2] | def ErasePixel(self, position): "Delete pixel, based on x, y and z position coordinates." x, y, z = position colour = self.imagedata.GetScalarRange()[0] imagedata = self.current_mask.imagedata imagedata.SetScalarComponentFromDouble(x, y, z, 0, colour) self.current_mask.edited_points[(x, y, z)] = colour session = ses.S... |
x, y, z = position | x, y, z = round(position[0],0), round(position[1],0),position[2] | def DrawPixel(self, position, colour=None): "Draw pixel, based on x, y and z position coordinates." x, y, z = position colour = self.imagedata.GetScalarRange()[1] imagedata = self.current_mask.imagedata imagedata.SetScalarComponentFromDouble(x, y, z, 0, colour) self.current_mask.edited_points[(x, y, z)] = colour |
x, y, z = position | x, y, z = round(position[0],0), round(position[1],0),position[2] | def EditPixelBasedOnThreshold(self, position): "Erase or draw pixel based on edition threshold range." x, y, z = position colour = self.imagedata.GetScalarComponentAsDouble(x, y, z, 0) thresh_min, thresh_max = self.current_mask.edition_threshold_range if (colour >= thresh_min) and (colour <= thresh_max): self.DrawPixel... |
self.BMP_WITHOUT_MENU = wx.Bitmap(p, wx.BITMAP_TYPE_GIF) | self.BMP_WITH_MENU = wx.Bitmap(p, wx.BITMAP_TYPE_GIF) | def __init_items(self): """ Add tools into toolbar. """ d = const.ICON_DIR if sys.platform == 'darwin': # Bitmaps for show/hide task panel item p = os.path.join(d, "layout_data_only_original.gif") self.BMP_WITHOUT_MENU = wx.Bitmap(p, wx.BITMAP_TYPE_GIF) |
session.SetLastDicomFolder(path) | def ShowImportDirDialog(): current_dir = os.path.abspath(".") if (sys.platform == 'win32') or (sys.platform == 'linux2'): session = ses.Session() if (session.GetLastDicomFolder()): folder = session.GetLastDicomFolder() else: folder = '' else: folder = '' dlg = wx.DirDialog(None, _("Choose a DICOM folder:"), folder, ... | |
session.SetLastDicomFolder(path) | if (sys.platform != 'darwin'): session.SetLastDicomFolder(path) | def ShowImportDirDialog(): current_dir = os.path.abspath(".") if (sys.platform == 'win32') or (sys.platform == 'linux2'): session = ses.Session() if (session.GetLastDicomFolder()): folder = session.GetLastDicomFolder() else: folder = '' else: folder = '' dlg = wx.DirDialog(None, _("Choose a DICOM folder:"), folder, ... |
ps.Publisher().sendMessage('Update window level value',(self.acum_achange_window, self.acum_achange_level)) | def OnWindowLevelMove(self, evt, obj): if (self.left_pressed): position = self.interactor.GetLastEventPosition() mouse_x, mouse_y = self.interactor.GetEventPosition() self.acum_achange_window += mouse_x - self.last_x self.acum_achange_level += mouse_y - self.last_y self.last_x, self.last_y = mouse_x, mouse_y | |
path = dlg.GetPath().encode('utf-8') | if sys.platform == "win32": path = dlg.GetPath() else: path = dlg.GetPath().encode('utf-8') | def ShowImportDirDialog(): current_dir = os.path.abspath(".") dlg = wx.DirDialog(None, "Choose a DICOM folder:", "", style=wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST | wx.DD_CHANGE_DIR) path = None if dlg.ShowModal() == wx.ID_OK: # GetPath returns in unicode, if a path has non-ascii characters a # UnicodeEncodeError i... |
self.interactor.GetRenderWindow().RemoveRenderer(slice_data.renderer) | def CloseProject(self): for slice_data in self.slice_data_list: self.interactor.GetRenderWindow().RemoveRenderer(slice_data.renderer) del slice_data self.modes = []#['DEFAULT'] self.slice_data_list = [] self.layout = (1, 1) self.orientation_texts = [] self.slice_number = 0 self.cursor = None self.wl_text = None self.p... | |
location = pubsub_evt.data[3] type_ = pubsub_evt.data[4] | location = pubsub_evt.data[4] type_ = pubsub_evt.data[3] | def AddItem_(self, pubsub_evt): index = pubsub_evt.data[0] name = pubsub_evt.data[1] colour = pubsub_evt.data[2] location = pubsub_evt.data[3] type_ = pubsub_evt.data[4] value = pubsub_evt.data[5] |
self.InsertNewItem(m.index, m.name, colour, type, location, value) | self.InsertNewItem(m.index, m.name, colour, location, type, value) | def OnLoadData(self, pubsub_evt): items_dict = pubsub_evt.data for i in items_dict: m = items_dict[i] image = self.CreateColourBitmap(m.colour) image_index = self.imagelist.Add(image) index_list = self._list_index.keys() self._list_index[m.index] = image_index |
location = pubsub_evt.data[4] type_ = pubsub_evt.data[3] | location = pubsub_evt.data[3] type_ = pubsub_evt.data[4] | def AddItem_(self, pubsub_evt): index = pubsub_evt.data[0] name = pubsub_evt.data[1] colour = pubsub_evt.data[2] location = pubsub_evt.data[4] type_ = pubsub_evt.data[3] value = pubsub_evt.data[5] |
self.UpdateItemInfo(index, name, colour, type_, location, value) | self.UpdateItemInfo(index, name, colour, location, type_, value) | def AddItem_(self, pubsub_evt): index = pubsub_evt.data[0] name = pubsub_evt.data[1] colour = pubsub_evt.data[2] location = pubsub_evt.data[4] type_ = pubsub_evt.data[3] value = pubsub_evt.data[5] |
self.InsertNewItem(index, name, colour, type_, location, value) | self.InsertNewItem(index, name, colour, location, type_, value) | def AddItem_(self, pubsub_evt): index = pubsub_evt.data[0] name = pubsub_evt.data[1] colour = pubsub_evt.data[2] location = pubsub_evt.data[4] type_ = pubsub_evt.data[3] value = pubsub_evt.data[5] |
self.SetStringItem(index, 2, type_) self.SetStringItem(index, 3, location) | self.SetStringItem(index, 2, location) self.SetStringItem(index, 3, type_) | def InsertNewItem(self, index=0, label="Measurement 1", colour=None, type_="LINEAR", location="SURFACE", value="0 mm"): self.InsertStringItem(index, "") self.SetStringItem(index, 1, label, imageId = self._list_index[index]) self.SetStringItem(index, 2, type_) self.SetStringItem(index, 3, location) self.SetStringItem(in... |
self.interactor.GetRenderWindow().Render() | self.interactor.Render() | def Reposition(self, slice_data): """ Based on code of method Zoom in the vtkInteractorStyleRubberBandZoom, the of vtk 5.4.3 """ ren = slice_data.renderer size = ren.GetSize() |
""" | def Reposition(self, slice_data): """ Based on code of method Zoom in the vtkInteractorStyleRubberBandZoom, the of vtk 5.4.3 """ ren = slice_data.renderer size = ren.GetSize() | |
'ko': u'한국인', | 'ko': u'조선어', | def GetLocales(): """Return a dictionary which defines supported languages""" d = utl.TwoWaysDictionary ({'zh_TW': u'中文', 'en': u'English', 'es': u'Español', 'ko': u'한국인', 'pt_BR': u'Português (Brasil)', 'pt': u'Português (Portugal)', 'fr':u'Français', 'el_GR':u'Ελληνική', 'it_IT':'Italiano', 'de_DE': 'Deutsch'}) retur... |
size=wx.Size(1024, 768), | size=wx.Size(1024, 748), | def __init__(self, prnt): wx.Frame.__init__(self, id=-1, name='', parent=prnt, pos=wx.Point(0, 0), size=wx.Size(1024, 768), #size = wx.DisplaySize(), style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3') self.Center(wx.BOTH) self.SetIcon(wx.Icon(os.path.join(const.ICON_DIR, "invesalius.ico"), wx.BITMAP_TYPE_ICO)) |
var_file = open("c:\\arquivo.txt","w") var_file.write(filename) var_file.close() | def SetFileName(self, filename): """ Set file name to be parsed given its filename (this should include the full path of the file of interest). | |
value = STR_WL%(window_width, window_level) | value = STR_WL%(window_level, window_width) | def SetWLText(self, window_width, window_level): value = STR_WL%(window_width, window_level) if (self.wl_text): self.wl_text.SetValue(value) #self.interactor.Render() |
self.interactor.Render() | def set_slice_number(self, index): image = self.slice_.GetSlices(self.orientation, index) self.actor.SetInput(image) self.__update_display_extent(image) self.interactor.Render() | |
return encoding | if (encoding.split(":"))[0] == "Loaded": return 'ISO_IR 100' else: return encoding | def GetEncoding(self): """ Return the dicom encoding DICOM standard tag (0x0008, 0x0005) was used. """ tag = gdcm.Tag(0x0008, 0x0005) ds = self.gdcm_reader.GetFile().GetDataSet() if ds.FindDataElement(tag): encoding = str(ds.GetDataElement(tag).GetValue()) if encoding != None: return encoding return 'ISO_IR 100' |
self.LoadDicom(group) | if group: self.LoadDicom(group) | def OnClickOk(self, evt): group = self.text_panel.GetSelection() self.LoadDicom(group) |
utils.debug('THRESHOLD_RANGE %s', mask.threshold_range) | utils.debug('THRESHOLD_RANGE %s'% mask.threshold_range) | def __load_masks(self, imagedata, mask_dict): keys = mask_dict.keys() keys.sort() for key in keys: mask = mask_dict[key] # update gui related to mask utils.debug("__load_masks") utils.debug('THRESHOLD_RANGE %s', mask.threshold_range) ps.Publisher().sendMessage('Add mask', (mask.index, mask.name, mask.threshold_range, ... |
n_processors = 1 | n_processors = multiprocessing.cpu_count() | def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. """ surface_data = pubsub_evt.data mask, spacing = pubsub_evt.data min_value, max_value = mask.threshold_range fill_holes = True |
o_piece = 2 | o_piece = 1 | def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. """ surface_data = pubsub_evt.data mask, spacing = pubsub_evt.data min_value, max_value = mask.threshold_range fill_holes = True |
n_pieces = round(mask.matrix.shape[0] / piece_size + 0.5, 0) | n_pieces = int(round(mask.matrix.shape[0] / piece_size + 0.5, 0)) | def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. """ surface_data = pubsub_evt.data mask, spacing = pubsub_evt.data min_value, max_value = mask.threshold_range fill_holes = True |
normals = vtk.vtkPolyDataNormals() normals.SetInput(polydata) normals.SetFeatureAngle(80) normals.AutoOrientNormalsOn() normals.GetOutput().ReleaseDataFlagOn() | clean = vtk.vtkCleanPolyData() clean.SetInput(polydata) clean.PointMergingOn() | def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. """ surface_data = pubsub_evt.data mask, spacing = pubsub_evt.data min_value, max_value = mask.threshold_range fill_holes = True |
stripper.SetInput(normals.GetOutput()) | stripper.SetInput(clean.GetOutput()) | def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. """ surface_data = pubsub_evt.data mask, spacing = pubsub_evt.data min_value, max_value = mask.threshold_range fill_holes = True |
const.WINDOW_LEVEL['Default'] = (proj.window, proj.level) const.WINDOW_LEVEL['Manual'] = (proj.window, proj.level) | const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level) const.WINDOW_LEVEL[_('Manual')] = (proj.window, proj.level) | def LoadProject(self): proj = prj.Project() |
print "data_notebook: RemoveMeasurements" | def RemoveMeasurements(self): """ Remove items selected. """ print "data_notebook: RemoveMeasurements" # it is necessary to update internal dictionary # that maps bitmap given item index selected_items = self.GetSelected() selected_items.sort(reverse=True) | |
print "notebook: AddItem_" print "self._list_index before:", self._list_index | def AddItem_(self, pubsub_evt): print "notebook: AddItem_" print "self._list_index before:", self._list_index index = pubsub_evt.data[0] print "index", index name = pubsub_evt.data[1] colour = pubsub_evt.data[2] location = pubsub_evt.data[3] type_ = pubsub_evt.data[4] value = pubsub_evt.data[5] | |
print "index", index | def AddItem_(self, pubsub_evt): print "notebook: AddItem_" print "self._list_index before:", self._list_index index = pubsub_evt.data[0] print "index", index name = pubsub_evt.data[1] colour = pubsub_evt.data[2] location = pubsub_evt.data[3] type_ = pubsub_evt.data[4] value = pubsub_evt.data[5] | |
print "InsertNewItem" | def InsertNewItem(self, index=0, label="Measurement 1", colour=None, type_="LINEAR", location="SURFACE", value="0 mm"): print "InsertNewItem" self.InsertStringItem(index, "") self.SetStringItem(index, 1, label, imageId = self._list_index[index]) self.SetStringItem(index, 2, type_) self.SetStringItem(index, 3, location)... | |
print "UpdateItemInfo" | def UpdateItemInfo(self, index=0, label="Measurement 1", colour=None, type_="LINEAR", location="SURFACE", value="0 mm"): print "UpdateItemInfo" self.SetStringItem(index, 1, label, imageId = self._list_index[index]) self.SetStringItem(index, 2, type_) self.SetStringItem(index, 3, location) self.SetStringItem(index, 4, v... | |
mapper.ImmediateModeRendering() | mapper.ImmediateModeRenderingOn() | def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. """ surface_data = pubsub_evt.data |
update_progress= vtk_utils.ShowProgress(len(files), dialog_type = "ProgressDialog") | update_progress= vtk_utils.ShowProgress(len(files) - 1, dialog_type = "ProgressDialog") | def dcm2memmap(files, slice_size, orientation): """ From a list of dicom files it creates memmap file in the temp folder and returns it and its related filename. """ message = _("Generating multiplanar visualization...") update_progress= vtk_utils.ShowProgress(len(files), dialog_type = "ProgressDialog") temp_file = te... |
answer = dlg.ShowModal() | try: answer = dlg.ShowModal() except(wx._core.PyAssertionError): answer = dlg.GetReturnCode() | def SaveChangesDialog(filename): current_dir = os.path.abspath(".") msg = _("The project %s has been modified.\nSave changes?")%filename if sys.platform == 'darwin': dlg = wx.MessageDialog(None, "", msg, wx.ICON_QUESTION | wx.YES_NO | wx.CANCEL) else: dlg = wx.MessageDialog(None, msg, "InVesalius 3", wx.ICON_QUESTION |... |
triangle = vtk.TriangleFilter() | triangle = vtk.vtkTriangleFilter() | def Merge(polydata_list): append = vtk.vtkAppendPolyData() for polydata in polydata_list: triangle = vtk.TriangleFilter() triangle.SetInput(polydata) append.AddInput(triangle.GetOutput()) clean = vtk.vtkCleanPolyData() clean.SetInput(append.GetOutput()) return append.GetOutput() |
self.CloseProject() | self.OnClose(None) | def OnMenuClick(self, evt): """ Capture event from mouse click on menu / toolbar (as both use the same ID's) """ id = evt.GetId() |
self.btn_ok = wx.Button(panel, wx.ID_OK) | def _init_ui(self): splitter = spl.MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) splitter.SetOrientation(wx.VERTICAL) self.splitter = splitter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.