diff --git a/tedana/model/fit.py b/tedana/model/fit.py index f772e4cc3..20986a8aa 100644 --- a/tedana/model/fit.py +++ b/tedana/model/fit.py @@ -137,14 +137,14 @@ def fitmodels_direct(catd, mmix, mask, t2s, t2sG, tes, combmode, ref_img, coeffs_S0 = (B * X1).sum(axis=0) / (X1**2).sum(axis=0) SSE_S0 = (B - X1 * np.tile(coeffs_S0, (n_echos, 1)))**2 SSE_S0 = SSE_S0.sum(axis=0) - F_S0 = (alpha - SSE_S0) * 2 / (SSE_S0) + F_S0 = (alpha - SSE_S0) * (n_echos - 1) / (SSE_S0) F_S0_maps[:, i] = F_S0 # R2 Model coeffs_R2 = (B * X2).sum(axis=0) / (X2**2).sum(axis=0) SSE_R2 = (B - X2 * np.tile(coeffs_R2, (n_echos, 1)))**2 SSE_R2 = SSE_R2.sum(axis=0) - F_R2 = (alpha - SSE_R2) * 2 / (SSE_R2) + F_R2 = (alpha - SSE_R2) * (n_echos - 1) / (SSE_R2) F_R2_maps[:, i] = F_R2 # compute weights as Z-values diff --git a/tedana/utils/utils.py b/tedana/utils/utils.py index dd7680507..9812c5493 100644 --- a/tedana/utils/utils.py +++ b/tedana/utils/utils.py @@ -193,11 +193,13 @@ def make_adaptive_mask(data, minimum=True, getsum=False): first_echo = echo_means[echo_means[:, 0] != 0, 0] # get 33rd %ile of `first_echo` and find corresponding index - perc_33 = np.percentile(first_echo, 33, interpolation='higher') # QUESTION: why 33%ile? - med_val = (echo_means[:, 0] == perc_33) + # NOTE: percentile is arbitrary + perc = np.percentile(first_echo, 33, interpolation='higher') + perc_val = (echo_means[:, 0] == perc) # extract values from all echos at relevant index - lthrs = np.squeeze(echo_means[med_val].T) / 3 # QUESTION: why divide by 3? + # NOTE: threshold of 1/3 voxel value is arbitrary + lthrs = np.squeeze(echo_means[perc_val].T) / 3 # if multiple samples were extracted per echo, keep the one w/the highest signal if lthrs.ndim > 1: