def ShowDialogImportOtherFiles(self, id_type): # Offer to save current project if necessary session = ses.Session() st = session.project_status if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE): filename = session.project_path[1] answer = dialog.SaveChangesDialog2(filename) if answer: self.ShowDialogSaveProject() self.CloseProject() # Publisher.sendMessage("Enable state project", False) Publisher.sendMessage('Set project name') Publisher.sendMessage("Stop Config Recording") Publisher.sendMessage("Set slice interaction style", const.STATE_DEFAULT) # Warning for limited support to Analyze format if id_type == const.ID_ANALYZE_IMPORT: dialog.ImportAnalyzeWarning() # Import project treating compressed nifti exception suptype = ('hdr', 'nii', 'nii.gz', 'par') filepath = dialog.ShowImportOtherFilesDialog(id_type) if filepath is not None: name = filepath.rpartition('\\')[-1].split('.') if name[-1] == 'gz': name[1] = 'nii.gz' filetype = name[1].lower() if filetype in suptype: Publisher.sendMessage("Open other files", filepath) else: dialog.ImportInvalidFiles()
def LoadImportPanel(self, patient_series): if patient_series and isinstance(patient_series, list): Publisher.sendMessage("Load import panel", patient_series) first_patient = patient_series[0] Publisher.sendMessage("Load dicom preview", first_patient) return True else: dialog.ImportInvalidFiles("DICOM") return False
def LoadImportBitmapPanel(self, data): #if patient_series and isinstance(patient_series, list): #Publisher.sendMessage("Load import panel", patient_series) #first_patient = patient_series[0] #Publisher.sendMessage("Load bitmap preview", first_patient) if data: Publisher.sendMessage("Load import bitmap panel", data=data) return True else: dialog.ImportInvalidFiles("Bitmap") return False
def OnOpenOtherFiles(self, filepath): filepath = utils.decode(filepath, const.FS_ENCODE) if not (filepath) == None: name = os.path.basename(filepath).split(".")[0] group = oth.ReadOthers(filepath) if group: matrix, matrix_filename = self.OpenOtherFiles(group) self.CreateOtherProject(name, matrix, matrix_filename) self.LoadProject() Publisher.sendMessage("Enable state project", state=True) else: dialog.ImportInvalidFiles(ftype="Others")
def OnOpenOtherFiles(self, pubsub_evt): filepath = utils.decode(pubsub_evt.data, const.FS_ENCODE) if not (filepath) == None: name = filepath.rpartition('\\')[-1].split('.') group = oth.ReadOthers(filepath) if group: matrix, matrix_filename = self.OpenOtherFiles(group) self.CreateOtherProject(str(name[0]), matrix, matrix_filename) self.LoadProject() Publisher.sendMessage("Enable state project", True) else: dialog.ImportInvalidFiles(ftype="Others")
def OnOpenOtherFiles(self, pubsub_evt): filepath = pubsub_evt.data name = filepath.rpartition('\\')[-1].split('.') if name[-1] == 'gz': name[1] = 'nii.gz' suptype = ('hdr', 'nii', 'nii.gz', 'par') filetype = name[1].lower() if filetype in suptype: group = oth.ReadOthers(filepath) else: dialog.ImportInvalidFiles() matrix, matrix_filename = self.OpenOtherFiles(group) self.CreateOtherProject(str(name[0]), matrix, matrix_filename) self.LoadProject() Publisher.sendMessage("Enable state project", True)