tiff_stack_only_letters.append(''.join(filter(str.isalpha,name)))# Remove everything else than letters from the name
tiff_stack_only_letters.append(
"".join(filter(str.isalpha,name))
)# Remove everything else than letters from the name
# Get unique elements from tiff_stack_only_letters
# Get unique elements from tiff_stack_only_letters
unique_names=list(set(tiff_stack_only_letters))
unique_names=list(set(tiff_stack_only_letters))
iflen(unique_names)>1:
iflen(unique_names)>1:
raiseValueError(f"The provided part of the filename for the TIFF stack matches multiple TIFF stacks: {unique_names}.\nPlease provide a string that is unique for the TIFF stack that is intended to be loaded")
raiseValueError(
f"The provided part of the filename for the TIFF stack matches multiple TIFF stacks: {unique_names}.\nPlease provide a string that is unique for the TIFF stack that is intended to be loaded"
log.info("Using %s of memory",sizeof(sys.getsizeof(vol)))
log.info("Using %s of memory",sizeof(sys.getsizeof(vol)))
returnvol
returnvol
defload_txrm(self,path):
defload_txrm(self,path):
"""Load a TXRM/XRM/TXM file from the specified path.
"""Load a TXRM/XRM/TXM file from the specified path.
Args:
Args:
...
@@ -221,23 +233,28 @@ class DataLoader:
...
@@ -221,23 +233,28 @@ class DataLoader:
try:
try:
importdxchange
importdxchange
exceptImportError:
exceptImportError:
raiseValueError('The library dxchange is required to load TXRM files. Please find installation instructions at https://dxchange.readthedocs.io/en/latest/source/install.html')
raiseValueError(
"The library dxchange is required to load TXRM files. Please find installation instructions at https://dxchange.readthedocs.io/en/latest/source/install.html"
)
vol,metadata=dxchange.read_txrm(path)
vol,metadata=dxchange.read_txrm(path)
vol=vol.squeeze()# In case of an XRM file, the third redundant dimension is removed
vol=(
vol.squeeze()
)# In case of an XRM file, the third redundant dimension is removed
log.info("Loaded shape: %s",vol.shape)
log.info("Loaded shape: %s",vol.shape)
log.info("Using %s of memory",sizeof(sys.getsizeof(vol)))
log.info("Using %s of memory",sizeof(sys.getsizeof(vol)))
ifself.virtual_stack:
ifself.virtual_stack:
raiseNotImplementedError("Using virtual stack for TXRM files is not implemented yet")
raiseNotImplementedError(
"Using virtual stack for TXRM files is not implemented yet"