log.warning("Virtual stack is only thoroughly tested for reconstructed volumes in TXM format and is thus not guaranteed to load TXRM and XRM files correctly")
ifnotpath.endswith(".txm"):
log.warning(
"Virtual stack is only thoroughly tested for reconstructed volumes in TXM format and is thus not guaranteed to load TXRM and XRM files correctly"
)
# Get metadata
ole=olefile.OleFileIO(path)
...
...
@@ -268,23 +273,29 @@ class DataLoader:
# Compute data offsets in bytes for each slice
offsets=_get_ole_offsets(ole)
iflen(offsets)!=metadata['number_of_images']:
raiseValueError(f'Metadata is erroneous: number of images {metadata["number_of_images"]} is different from number of data offsets {len(offsets)}')
iflen(offsets)!=metadata["number_of_images"]:
raiseValueError(
f'Metadata is erroneous: number of images {metadata["number_of_images"]} is different from number of data offsets {len(offsets)}'
log.warning('Virtual stack volume will be returned as a dask array. To load certain slices into memory, use normal indexing followed by the compute() method, e.g. vol[:,0,:].compute()')
log.warning(
"Virtual stack volume will be returned as a dask array. To load certain slices into memory, use normal indexing followed by the compute() method, e.g. vol[:,0,:].compute()"
)
else:
vol,metadata=dxchange.read_txrm(path)
...
...
@@ -352,11 +363,11 @@ class DataLoader:
should_indent=True
withopen(path,'r')asf:
withopen(path,"r")asf:
forlineinf:
line=line.strip()
# {NAME} is start of a new object, so should indent
ifline.startswith('{')andline.endswith('}'):
ifline.startswith("{")andline.endswith("}"):
section_name=line[1:-1]
current_section[section_name]={}
section_stack.append(current_section)
...
...
@@ -364,7 +375,7 @@ class DataLoader:
should_indent=True
# [NAME] is start of a section, so should not indent
elifline.startswith('[')andline.endswith(']'):
elifline.startswith("[")andline.endswith("]"):
section_name=line[1:-1]
ifnotshould_indent:
...
...
@@ -377,10 +388,10 @@ class DataLoader:
should_indent=False
# = is a key value pair
elif'='inline:
key,value=line.split('=',1)
elif"="inline:
key,value=line.split("=",1)
current_section[key.strip()]=value.strip()
elifline=='':
elifline=="":
iflen(section_stack)>1:
current_section=section_stack.pop()
...
...
@@ -404,35 +415,45 @@ class DataLoader:
path=path.replace(".vol",".vgi")
log.warning("Corrected path to .vgi metadata file from .vol file")