Output : Binary mask of the ROI with voxels that are between the supplied threshold
if len(threshold) != 6:
raise ValueError("threshold must be of length 6")
if (np.min(threshold) < 0 or np.max(threshold) > 1):
raise ValueError("threshold must be between 0 and 1")
if (np.min(cfa) < 0 or np.max(cfa) > 1):
After Change
FA = fractional_anisotropy(tensorfit.evals)
FA[np.isnan(FA)] = 0
FA = np.clip(FA, 0, 1) // Clamp the FA to remove degenerate tensors
cfa = color_fa(FA, tensorfit.evecs)
return np.all(((cfa >= threshold[0::2]) & (cfa <= threshold[1::2]) & ROI[..., None]), axis=-1)