From ed318a750ff65b91f798cde0d4a9eafe2c9e6e75 Mon Sep 17 00:00:00 2001 From: Christian Kento Rasmussen <christian.kento@gmail.com> Date: Wed, 24 Jan 2024 13:58:13 +0100 Subject: [PATCH] Fix path issue in DataLoader class --- qim3d/io/load.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qim3d/io/load.py b/qim3d/io/load.py index e9c00f7e..b69d37ac 100644 --- a/qim3d/io/load.py +++ b/qim3d/io/load.py @@ -340,6 +340,11 @@ class DataLoader: Args: path (str): The path to the VGI file. """ + # 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") + print("WARNING: Corrected path to .vgi metadata file from .vol file") + meta_data = self._load_vgi_metadata(path) # Extracts relevant information from the metadata @@ -392,7 +397,7 @@ class DataLoader: # Stringify path in case it is not already a string path = stringify_path(path) - print(os.path.isfile(path),path,path.endswith((".vgi"))) + # Load a file if os.path.isfile(path): # Choose the loader based on the file extension -- GitLab