From 7fca1e4169db4b5575597a349f9756555d31c94b Mon Sep 17 00:00:00 2001 From: weinmusn Date: Fri, 25 Sep 2026 14:11:35 +0200 Subject: [PATCH 1/2] Voxel position of phantom is always centered --- .../MRzeroCore/phantom/voxel_grid_phantom.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/python/MRzeroCore/phantom/voxel_grid_phantom.py b/python/MRzeroCore/phantom/voxel_grid_phantom.py index 96e8a25..af51273 100644 --- a/python/MRzeroCore/phantom/voxel_grid_phantom.py +++ b/python/MRzeroCore/phantom/voxel_grid_phantom.py @@ -181,23 +181,17 @@ def build(self, PD_threshold: float = 1e-6, mask = self.PD > PD_threshold shape = torch.tensor(mask.shape) - pos_x, pos_y, pos_z = torch.meshgrid( - torch.arange( - int(shape[0]), dtype=torch.float32, device=self.PD.device), - torch.arange( - int(shape[1]), dtype=torch.float32, device=self.PD.device), - torch.arange( - int(shape[2]), dtype=torch.float32, device=self.PD.device), - indexing="ij" - ) - - pos = torch.stack([pos_x, pos_y, pos_z], dim=-1) + axes = [ + torch.arange(n, dtype=torch.float32, device=self.PD.device) - (n // 2) + for n in shape + ] + pos = torch.stack(torch.meshgrid(*axes, indexing="ij"), dim=-1) pos_rot = torch.einsum( 'ij,xyzj->xyzi', self.affine[:3,:3] / 1000, pos - ) + self.affine[None, None, None, :3,3] / 1000 + ) # No translation because we want that the voxel position are centered voxel_pos = pos_rot[mask] From 256c40812908bfac28a665d852574c40ed38dc01 Mon Sep 17 00:00:00 2001 From: weinmusn Date: Fri, 25 Sep 2026 17:12:19 +0200 Subject: [PATCH 2/2] Bump version to 1.1.1: centered voxel positions in VoxelGridPhantom.build() Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 ++ Cargo.lock | 2 +- Cargo.toml | 2 +- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a15d81c..3a06f31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- 1.1.1 + - `VoxelGridPhantom.build()`: voxel positions are always centered around the origin (index offset `- n // 2`); the affine translation is no longer applied, only rotation and scaling - 1.1.0 - `compute_graph` accepts `tissues`: with more than one tissue the prepass is run once per tissue and the graphs are unioned with the mean-tissue graph. Omit `tissues`, or pass a single tissue, and the call is the previous mean-relaxation prepass - 1.0.9 diff --git a/Cargo.lock b/Cargo.lock index fc3ec6b..920ef47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,7 +65,7 @@ dependencies = [ [[package]] name = "mrzero_core" -version = "1.1.0" +version = "1.1.1" dependencies = [ "num-complex", "pulseq-rs", diff --git a/Cargo.toml b/Cargo.toml index 29cfd7a..df0ded7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mrzero_core" -version = "1.1.0" +version = "1.1.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/pyproject.toml b/pyproject.toml index 386a392..fba7330 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "mrzerocore" -version = "1.1.0" +version = "1.1.1" description = "Core functionality of MRzero" authors = [ {name = "Jonathan Endres", email = "jonathan.endres@uk-erlangen.de"},