diff --git a/invesalius/reader/dicom.py b/invesalius/reader/dicom.py index 295cbc6..5fc18b2 100644 --- a/invesalius/reader/dicom.py +++ b/invesalius/reader/dicom.py @@ -186,14 +186,21 @@ class Parser(): filename = path.abspath(filename) + var_file = open("c:\\arquivo.txt","w") + var_file.write(filename) + var_file.close() + #print type(filename) + #print filename + #print filename + #print "____________" if path.isfile(filename): # Several information can be acquired from DICOM using # vtkgdcm.vtkGDCMImageReader.GetMedicalImageProperties() # but some tags (such as spacing) can only be achieved # with gdcm.ImageReader() - # used to parse DICOM files - similar to vtkDICOMParser gdcm_reader = gdcm.ImageReader() + #filename = filename.encode('utf-8') gdcm_reader.SetFileName(filename) diff --git a/invesalius/reader/dicom_reader.py b/invesalius/reader/dicom_reader.py index d1059fe..93eebea 100644 --- a/invesalius/reader/dicom_reader.py +++ b/invesalius/reader/dicom_reader.py @@ -32,14 +32,14 @@ import dicom_grouper import session def ReadDicomGroup(dir_): - + patient_group = GetDicomGroups(dir_) if len(patient_group) > 0: filelist, dicom, zspacing = SelectLargerDicomGroup(patient_group) filelist = SortFiles(filelist, dicom) size = dicom.image.size bits = dicom.image.bits_allocad - + imagedata = CreateImageData(filelist, zspacing, size, bits) session.Session().project_status = const.NEW_PROJECT return imagedata, dicom @@ -55,7 +55,7 @@ def SelectLargerDicomGroup(patient_group): if group.nslices > maxslices: maxslices = group.nslices larger_group = group - + return larger_group def SortFiles(filelist, dicom): @@ -107,7 +107,7 @@ def yGetDicomGroups(directory, recursive=True, gui=True): else: dirpath, dirnames, filenames = os.walk(directory) nfiles = len(filenames) - + counter = 0 grouper = dicom_grouper.DicomPatientGrouper() q = Queue.Queue() @@ -121,7 +121,7 @@ def yGetDicomGroups(directory, recursive=True, gui=True): if recursive: for dirpath, dirnames, filenames in os.walk(directory): for name in filenames: - filepath = str(os.path.join(dirpath, name)) + filepath = os.path.join(dirpath, name).encode('latin-1') counter += 1 if gui: yield (counter,nfiles) @@ -156,10 +156,10 @@ class ProgressDicomReader: def CancelLoad(self, evt_pubsub): self.running = False self.stoped = True - + def SetWindowEvent(self, frame): self.frame = frame - + def SetDirectoryPath(self, path,recursive=True): self.running = True self.stoped = False @@ -172,14 +172,14 @@ class ProgressDicomReader: ps.Publisher().sendMessage("End dicom load", patient_list) def GetDicomGroups(self, path, recursive): - + if not const.VTK_WARNING: log_path = os.path.join(const.LOG_FOLDER, 'vtkoutput.txt') fow = vtk.vtkFileOutputWindow() fow.SetFileName(log_path) ow = vtk.vtkOutputWindow() ow.SetInstance(fow) - + y = yGetDicomGroups(path, recursive) for value_progress in y: if not self.running: diff --git a/invesalius/session.py b/invesalius/session.py index f292656..3a3a077 100644 --- a/invesalius/session.py +++ b/invesalius/session.py @@ -118,10 +118,10 @@ class Session(object): config.add_section('paths') config.set('paths','homedir',self.homedir) config.set('paths','tempdir',self.tempdir) - config.set('paths','last_dicom_folder',self.last_dicom_folder) + config.set('paths','last_dicom_folder',self.last_dicom_folder.encode('utf-8')) path = os.path.join(self.homedir , '.invesalius', 'config.cfg') - + configfile = open(path, 'wb') config.write(configfile) configfile.close() @@ -185,6 +185,11 @@ class Session(object): self.homedir = config.get('paths','homedir') self.tempdir = config.get('paths','tempdir') self.last_dicom_folder = config.get('paths','last_dicom_folder') + self.last_dicom_folder = self.last_dicom_folder.decode('utf-8') + #print "_______________________________" + #print self.last_dicom_folder + #print type(self.last_dicom_folder) + #print "_______________________________" return True except(ConfigParser.NoSectionError, ConfigParser.NoOptionError, -- libgit2 0.21.2