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
16 changes: 15 additions & 1 deletion phantoms/MR_XCAT_qMRI/sim_ivim_sig.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,15 +451,29 @@ def parse_bvalues_file(file_path):

voxel_selector_fraction = 0.5
D, f, Ds = contrast_curve_calc()
ignore = np.isnan(D)
ignore = np.logical_or(np.logical_or(np.isnan(D),f<0.03),f>0.97)
generic_data = {}
seen_combinations = set()

for level, name in legend.items():
if len(ignore) > level and ignore[level]:
continue
selector = XCAT == level
voxels = sig[selector]
if len(voxels) < 1:
continue
D_val = np.median(Dim[selector], axis=0)
f_val = np.median(fim[selector], axis=0)
Dp_val = np.median(Dpim[selector], axis=0)

combo = (tuple(np.atleast_1d(D_val)),
tuple(np.atleast_1d(f_val)),
tuple(np.atleast_1d(Dp_val)))

if combo in seen_combinations:
continue

seen_combinations.add(combo)
signals = np.squeeze(voxels[int(voxels.shape[0] * voxel_selector_fraction)]).tolist()
generic_data[name] = {
'noise': noise,
Expand Down
Loading