Skip to content

Commit 5399ca5

Browse files
authored
added check for t2s 0 voxels (#807)
1 parent 0f04f76 commit 5399ca5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tedana/decay.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ def _apply_t2s_floor(t2s, echo_times):
3737
echo_times = echo_times[:, None]
3838

3939
eps = np.finfo(dtype=t2s.dtype).eps # smallest value for datatype
40-
temp_arr = np.exp(-echo_times / t2s) # (E x V) array
40+
nonzerovox = t2s != 0
41+
# Exclude values where t2s is 0 when dividing by t2s.
42+
# These voxels are also excluded from bad_voxel_idx
43+
temp_arr = np.zeros((len(echo_times), len(t2s)))
44+
temp_arr[:, nonzerovox] = np.exp(-echo_times / t2s[nonzerovox]) # (E x V) array
4145
bad_voxel_idx = np.any(temp_arr == 0, axis=0) & (t2s != 0)
4246
n_bad_voxels = np.sum(bad_voxel_idx)
4347
if n_bad_voxels > 0:

0 commit comments

Comments
 (0)