if (file_magic == 0):
fd.seek(12)
filetree = parsejeol(fd)
filepath = filename[:filename.rfind("/")+1]
if "SampleInfo" in filetree.keys():
for i in sorted(filetree["SampleInfo"].keys(), key=float):
if "ViewInfo" in filetree["SampleInfo"][i].keys():
for j in sorted(filetree["SampleInfo"][i]["ViewInfo"].keys(), key=float):
After Change
if (file_magic == 0):
fd.seek(12)
filetree = parsejeol(fd)
filepath, filen = os.path.split(os.path.abspath(filename))
if "SampleInfo" in filetree.keys():
for i in sorted(filetree["SampleInfo"].keys(), key=float):
if "ViewInfo" in filetree["SampleInfo"][i].keys():
for j in sorted(filetree["SampleInfo"][i]["ViewInfo"].keys(), key=float):
if "ViewData" in filetree["SampleInfo"][i]["ViewInfo"][j].keys():
scale = filetree["SampleInfo"][i]["ViewInfo"][j]["PositionMM"]*1000
for k in sorted(filetree["SampleInfo"][i]["ViewInfo"][j]["ViewData"].keys(), key=float):
root, sample_folder, view_folder, data_file = filetree["SampleInfo"][i]["ViewInfo"][j]["ViewData"][k]["Filename"].split("\\")
subfile = os.path.join(root, sample_folder, view_folder, data_file)
sub_ext = os.path.splitext(subfile)[-1][1:]
if sub_ext == "img" or sub_ext == "map":
dictionary.append(read_img(os.path.join(filepath,subfile), scale))
elif sub_ext == "pts":
dictionary.append(read_pts(os.path.join(filepath,subfile), scale))
elif sub_ext == "eds":
dictionary.append(read_eds(os.path.join(filepath,subfile)))
else:
print("Unknow extension")
else: