Skip to content
Open
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: 1 addition & 1 deletion rtspm/_spm_reslice_rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def spm_reslice_rt(r, flags):
temp_x1 = np.transpose(np.array(range(1, r0_dim[0] + 1), ndmin=2))
x1 = np.tile(temp_x1, (1, r0_dim[1]))
temp_x2 = np.transpose(np.array(range(1, r0_dim[1] + 1), ndmin=2))
x2 = np.transpose(np.tile(temp_x2, (1, r0_dim[1])))
x2 = np.transpose(np.tile(temp_x2, (1, r0_dim[0])))

if int(flags['mean']):
count = np.zeros(r0_dim)
Expand Down
27 changes: 27 additions & 0 deletions tests/test_rtspm/test_spm.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
import numpy as np
import importlib

from rtspm import spm_realign_rt
from rtspm import spm_reslice_rt


def test_spm_reslice_supports_non_square_in_plane_dimensions(monkeypatch):
module = importlib.import_module("rtspm._spm_reslice_rt")
monkeypatch.setattr(
module.spm,
"bsplins",
lambda _coefficients, y1, _y2, _y3, _degree: np.ones(y1.shape),
)
dim = np.array([3, 5, 2])
identity = np.eye(4)
r = [
{"mat": identity, "dim": dim, "C": np.zeros(dim)},
{"mat": identity, "dim": dim, "C": np.zeros(dim)},
]
flags = {
"interp": 1,
"wrap": np.zeros(3),
"mask": 1,
"mean": 0,
"which": 2,
}

result = spm_reslice_rt(r, flags)

assert result.shape == tuple(dim)


def img_2d_to_3d(img2d, xdim_img_number, ydim_img_number, dim3d):
sl = 0
vol3d = np.zeros(dim3d)
Expand Down