Skip to content

Commit 41323ca

Browse files
committed
fix: more errors due to smaps.
1 parent a79d3e3 commit 41323ca

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/snake/core/engine/nufft.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _job_trajectories(
2828
dataset: mrd.Dataset,
2929
hdr: mrd.xsd.ismrmrdHeader,
3030
sim_conf: SimConfig,
31-
shot_idx: Sequence[int],
31+
shot_idx: Sequence[int] | int,
3232
) -> NDArray:
3333
"""Get Non Cartesian trajectories from the dataset.
3434
@@ -72,10 +72,12 @@ def _init_model_nufft(
7272
if slice_2d:
7373
shape_ = sim_conf.shape[:-1]
7474
if smaps is not None:
75-
smaps_ = smaps[..., 0]
75+
smaps_ = np.ascontiguousarray(
76+
smaps[..., 0]
77+
) # will be updated in the loop
7678

7779
nufft = get_operator(backend)(
78-
samples, # dummy samples locs
80+
samples, # will be updated in the loop
7981
shape=shape_,
8082
n_coils=n_coils,
8183
smaps=smaps_,
@@ -121,7 +123,7 @@ def _job_model_T2s(
121123
slice_loc = round((traj[0, -1] + 0.5) * sim_conf.shape[-1])
122124
nufft.samples = traj[:, :2]
123125
if phantom.smaps is not None:
124-
nufft.smaps = phantom.smaps[..., slice_loc]
126+
nufft.smaps = np.ascontiguousarray(phantom.smaps[..., slice_loc])
125127
phantom_state = phantom_state[:, None, ..., slice_loc]
126128
else:
127129
phantom_state = phantom_state[:, None, ...]

src/snake/core/phantom/static.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ def add_tissue(
6666
masks = np.concatenate((self.masks, mask[None, ...]), axis=0)
6767
labels = np.concatenate((self.labels, np.array([tissue_name])))
6868
props = np.concatenate((self.props, props), axis=0)
69-
return Phantom(phantom_name or self.name, masks, labels, props)
69+
return Phantom(
70+
phantom_name or self.name, masks, labels, props, smaps=self.smaps
71+
)
7072

7173
@property
7274
def labels_idx(self) -> dict[str, int]:

0 commit comments

Comments
 (0)