Skip to content
Snippets Groups Projects
Commit 3b5ac77e authored by s184058's avatar s184058 Committed by Christian Kento Rasmussen
Browse files

Load bigtiff

parent 927c3ff3
No related branches found
No related tags found
2 merge requests!45Save files function,!44Load vol files
...@@ -68,10 +68,14 @@ class DataLoader: ...@@ -68,10 +68,14 @@ class DataLoader:
If 'self.virtual_stack' is True, returns a numpy.memmap object. If 'self.virtual_stack' is True, returns a numpy.memmap object.
""" """
# Get the number of TIFF series (some BigTIFF have multiple series)
with tifffile.TiffFile(path) as tif:
series = len(tif.series)
if self.virtual_stack: if self.virtual_stack:
vol = tifffile.memmap(path) vol = tifffile.memmap(path)
else: else:
vol = tifffile.imread(path) vol = tifffile.imread(path, key=range(series) if series>1 else None)
log.info("Loaded shape: %s", vol.shape) log.info("Loaded shape: %s", vol.shape)
...@@ -217,7 +221,7 @@ class DataLoader: ...@@ -217,7 +221,7 @@ class DataLoader:
"""Load a TXRM/XRM/TXM file from the specified path. """Load a TXRM/XRM/TXM file from the specified path.
Args: Args:
path (str): The path to the HDF5 file. path (str): The path to the TXRM/XRM/TXM file.
Returns: Returns:
numpy.ndarray or tuple: The loaded volume. numpy.ndarray or tuple: The loaded volume.
...@@ -508,7 +512,7 @@ def load( ...@@ -508,7 +512,7 @@ def load(
log_memory_info(data) log_memory_info(data)
else: else:
# Only log if file type is not a np.ndarray, i.e., it is some kind of memmap object # Only log if file type is not a np.ndarray, i.e., it is some kind of memmap object
if not isinstance( data[0] if isinstance(data,tuple) else data, np.ndarray ): if not isinstance( type(data[0]) if isinstance(data,tuple) else type(data), np.ndarray ):
log.info("Using virtual stack") log.info("Using virtual stack")
else: else:
log.warning('Virtual stack is not supported for this file format') log.warning('Virtual stack is not supported for this file format')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment