// Load atlas parcellation (and its wm-gm interface reduced version for seeding)
atlas_img = nib.load(labels_im_file)
atlas_data = atlas_img.get_fdata().astype("int")
atlas_img_wm_gm_int = nib.load(labels_im_file_wm_gm_int)
atlas_data_wm_gm_int = atlas_img_wm_gm_int.get_fdata().astype("int")
// Build mask vector from atlas for later roi filtering
After Change
// Load atlas parcellation (and its wm-gm interface reduced version for seeding)
atlas_data = nib.load(labels_im_file).get_fdata().astype("int")
atlas_data_wm_gm_int = nib.load(labels_im_file_wm_gm_int).get_fdata().astype("int")
// Build mask vector from atlas for later roi filtering
parcels = []
i = 0
for roi_val in np.unique(atlas_data)[1:]:
parcels.append(atlas_data == roi_val)
i = i + 1
if np.sum(atlas_data) == 0:
raise ValueError("ERROR: No non-zero voxels found in atlas. Check any roi masks and/or wm-gm interface images "
"to verify overlap with dwi-registered atlas.")
// Iteratively build a list of streamlines for each ROI while tracking
print("%s%s%s%s" % (Fore.GREEN, "Target number of samples: ", Fore.BLUE, target_samples))
print(Style.RESET_ALL)
print("%s%s%s%s" % (Fore.GREEN, "Using curvature threshold(s): ", Fore.BLUE, curv_thr_list))
print(Style.RESET_ALL)
print("%s%s%s%s" % (Fore.GREEN, "Using step size(s): ", Fore.BLUE, step_list))
print(Style.RESET_ALL)
print("%s%s%s%s" % (Fore.GREEN, "Tracking type: ", Fore.BLUE, track_type))
print(Style.RESET_ALL)
if directget == "prob":
print("%s%s%s%s" % (Fore.GREEN, "Direction-getting type: ", Fore.BLUE, "Probabilistic"))
elif directget == "boot":
print("%s%s%s%s" % (Fore.GREEN, "Direction-getting type: ", Fore.BLUE, "Bootstrapped"))
elif directget == "closest":
print("%s%s%s%s" % (Fore.GREEN, "Direction-getting type: ", Fore.BLUE, "Closest Peak"))
elif directget == "det":
print("%s%s%s%s" % (Fore.GREEN, "Direction-getting type: ", Fore.BLUE, "Deterministic Maximum"))
print(Style.RESET_ALL)
// Commence Ensemble Tractography
streamlines = track_ensemble(dwi_data, target_samples, atlas_data_wm_gm_int, parcels, mod_fit,
prep_tissues(B0_mask, gm_in_dwi, vent_csf_in_dwi, wm_in_dwi, tiss_class),
get_sphere("repulsion724"), directget, curv_thr_list, step_list, track_type,
maxcrossing, max_length, roi_neighborhood_tol, min_length, waymask)
print("Tracking Complete")
// Create streamline density map
[streams, dir_path, dm_path] = create_density_map(dwi_img, utils.do_dir_path(atlas, dwi_file), streamlines,
conn_model, target_samples, node_size, curv_thr_list, step_list,
network, roi)
del streamlines
del dwi_data
del atlas_data_wm_gm_int
del atlas_data
del mod_fit
dwi_img.uncache()