From 927c3ff31b00f4d982ef92eb72128ce55e734943 Mon Sep 17 00:00:00 2001 From: Christian Kento Rasmussen <christian.kento@gmail.com> Date: Wed, 24 Jan 2024 14:56:11 +0100 Subject: [PATCH] added support for menmap --- qim3d/io/load.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qim3d/io/load.py b/qim3d/io/load.py index eefd8038..184ebf4f 100644 --- a/qim3d/io/load.py +++ b/qim3d/io/load.py @@ -372,10 +372,11 @@ class DataLoader: case _: raise ValueError(f"Unsupported data type: {dt}") - vol = np.fromfile(vol_path, dtype=dt, count=np.prod(dims)) - # Reshape and transposes the volume to match standard orientation - vol = np.reshape(vol, (dims[2], dims[0], dims[1])) - vol = vol.transpose((0, 2, 1)) + if self.virtual_stack: + vol = np.memmap(vol_path, dtype=dt, mode='r', shape=(dims[2], dims[0], dims[1])) + else: + vol = np.fromfile(vol_path, dtype=dt, count=np.prod(dims)) + vol = np.reshape(vol, (dims[2], dims[0], dims[1])) if self.return_metadata: return vol, meta_data -- GitLab