Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"},
Expand Down
18 changes: 6 additions & 12 deletions python/MRzeroCore/phantom/voxel_grid_phantom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
Loading