Skip to content
Snippets Groups Projects
Commit 96de1a8c authored by Christian Kento Rasmussen's avatar Christian Kento Rasmussen
Browse files

Fix file format check in DataLoader class

parent d00b3bd5
No related branches found
No related tags found
2 merge requests!45Save files function,!44Load vol files
......@@ -351,14 +351,19 @@ class DataLoader:
Args:
path (str): The path to the VGI file.
Raises:
ValueError: If path points to a .vol file and not a .vgi file
returns:
numpy.ndarray or tuple: The loaded volume.
numpy.ndarray, numpy.memmap or tuple: The loaded volume.
If 'self.return_metadata' is True, returns a tuple (volume, metadata).
"""
# makes sure path point to .VGI metadata file and not the .VOL file
if path.endswith(".vol") and os.path.isfile(path.replace(".vol",".vgi")):
path = path.replace(".vol",".vgi")
log.warning("Corrected path to .vgi metadata file from .vol file")
elif path.endswith(".vol") and not os.path.isfile(path.replace(".vol",".vgi")):
raise ValueError(f"Unsupported file format, should point to .vgi metadata file assumed to be in same folder as .vol file: {path}")
meta_data = self._load_vgi_metadata(path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment