Commit 9a7e323e227d692106bda9861e83c3969b5a270e

Authored by Paulo Henrique Junqueira Amorim
1 parent 2a96ff7d
Exists in master

FIX: Fixed problem to import uCT files

Showing 1 changed file with 5 additions and 7 deletions   Show diff stats
invesalius/reader/bitmap_reader.py
... ... @@ -100,12 +100,12 @@ class BitmapData:
100 100  
101 101 def RemoveFileByPath(self, path):
102 102 for d in self.data:
103   - if path.encode('utf-8') in d:
  103 + if path.encode(const.FS_ENCODE) in d:
104 104 self.data.remove(d)
105 105  
106 106 def GetIndexByPath(self, path):
107 107 for i, v in enumerate(self.data):
108   - if path.encode('utf-8') in v:
  108 + if path.encode(const.FS_ENCODE) in v:
109 109 return i
110 110  
111 111 class BitmapFiles:
... ... @@ -223,7 +223,7 @@ def yGetBitmaps(directory, recursive=True, gui=True):
223 223 if recursive:
224 224 for dirpath, dirnames, filenames in os.walk(directory):
225 225 for name in filenames:
226   - filepath = os.path.join(dirpath, name)
  226 + filepath = os.path.join(dirpath, name).encode(const.FS_ENCODE)
227 227 counter += 1
228 228 if gui:
229 229 yield (counter,nfiles)
... ... @@ -231,7 +231,7 @@ def yGetBitmaps(directory, recursive=True, gui=True):
231 231 else:
232 232 dirpath, dirnames, filenames = os.walk(directory)
233 233 for name in filenames:
234   - filepath = str(os.path.join(dirpath, name))
  234 + filepath = str(os.path.join(dirpath, name)).encode(const.FS_ENCODE)
235 235 counter += 1
236 236 if gui:
237 237 yield (counter,nfiles)
... ... @@ -323,10 +323,8 @@ def VtkRead(filepath, t):
323 323 else:
324 324 return False
325 325  
326   - print ">>>> bmp reader", type(filepath)
327   -
328 326 reader.AddObserver("ErrorEvent", VtkErrorToPy)
329   - reader.SetFileName(filepath.encode(const.FS_ENCODE))
  327 + reader.SetFileName(filepath)
330 328 reader.Update()
331 329  
332 330 if no_error:
... ...