tr=2500., t1_gm=1331.) # Compute brain mask brain_mask_file = preprocessing.compute_brain_mask( out_coregister_anat.outputs.coregistered_source, frac=.2) # Normalize CBF normalize = mem.cache(spm.Normalize) out_normalize = normalize( parameter_file=out_segment.outputs.transformation_mat, apply_to_files=[out_quantify.outputs.cbf_file, brain_mask_file], write_voxel_sizes=_utils.get_voxel_dims(func_file), write_interp=2, jobtype='write') # Mask CBF map with brain mask cbf_map = preprocessing.apply_mask( out_normalize.outputs.normalized_files[0], out_normalize.outputs.normalized_files[1]) # Plot CBF map on top of MNI template plotting.plot_stat_map( cbf_map, bg_img='/usr/share/fsl/5.0/data/standard/MNI152_T1_2mm.nii.gz', threshold=.1, vmax=150., display_mode='z') plt.show() os.chdir(current_directory)
perfusion_file = quantification.compute_perfusion( out_realign.outputs.realigned_files, ctl_scans=ctl_scans, tag_scans=tag_scans) # Compute CBF quantify = mem.cache(quantification.QuantifyCBF) out_quantify = quantify(perfusion_file=perfusion_file, m0_file=out_smooth_m0.outputs.smoothed_files, tr=2500., t1_gm=1331.) # Mask CBF map with brain mask brain_mask_file = preprocessing.compute_brain_mask( out_coregister_anat.outputs.coregistered_source, frac=.2) cbf_map = preprocessing.apply_mask(out_quantify.outputs.cbf_file, brain_mask_file) # Plot CBF map on top of anat import matplotlib.pylab as plt from nilearn import plotting cut_coords = ( -15, 0, 15, 45, 60, 75, ) min_cbf = 1. max_cbf = 150. for map_to_plot, title, vmax, threshold in zip(
out_realign.outputs.realigned_files, ctl_scans=ctl_scans, tag_scans=tag_scans) # Compute CBF quantify = mem.cache(quantification.QuantifyCBF) out_quantify = quantify( perfusion_file=perfusion_file, m0_file=out_smooth_m0.outputs.smoothed_files, tr=2500., t1_gm=1331.) # Mask CBF map with brain mask brain_mask_file = preprocessing.compute_brain_mask( out_coregister_anat.outputs.coregistered_source, frac=.2) cbf_map = preprocessing.apply_mask(out_quantify.outputs.cbf_file, brain_mask_file) os.chdir(current_directory) # Plot CBF map on top of anat import matplotlib.pylab as plt from nilearn import plotting for map_to_plot, title, vmax, threshold in zip( [cbf_map, heroes['basal CBF'][0]], ['pipeline CBF', 'scanner CBF'], [150., 1500.], [1., 10.]): # scanner CBF maps are scaled plotting.plot_stat_map( map_to_plot, bg_img=out_coregister_anat.outputs.coregistered_source, threshold=threshold, vmax=vmax, (-15, 0, 15, 45, 60, 75,), display_mode='z', title=title) plt.show()