Mercurial > repos > greg > create_streamlines
comparison create_streamlines.py @ 4:3b5e09c727f5 draft
Uploaded
author | greg |
---|---|
date | Tue, 28 Nov 2017 14:37:35 -0500 |
parents | 51263bfe7b2c |
children | 606a712b6322 |
comparison
equal
deleted
inserted
replaced
3:51263bfe7b2c | 4:3b5e09c727f5 |
---|---|
59 fvtk.add(r, vol_actor) | 59 fvtk.add(r, vol_actor) |
60 fvtk.add(r, vol_actor2) | 60 fvtk.add(r, vol_actor2) |
61 fvtk.add(r, cc_streamlines_actor) | 61 fvtk.add(r, cc_streamlines_actor) |
62 fvtk.add(r, cc_ROI_actor) | 62 fvtk.add(r, cc_ROI_actor) |
63 # Save figures | 63 # Save figures |
64 fvtk.record(r, n_frames=1, out_path=args.output_corpuscallosum_axial, size=(800, 800)) | 64 fvtk.record(r, n_frames=1, out_path="corpuscallosum_axial.png", size=(800, 800)) |
65 shutil.move("corpuscallosum_axial.png", args.output_corpuscallosum_axial) | |
65 fvtk.camera(r, [-1, 0, 0], [0, 0, 0], viewup=[0, 0, 1]) | 66 fvtk.camera(r, [-1, 0, 0], [0, 0, 0], viewup=[0, 0, 1]) |
66 fvtk.record(r, n_frames=1, out_path=args.output_corpuscallosum_sagittal, size=(800, 800)) | 67 fvtk.record(r, n_frames=1, out_path="corpuscallosum_sagittal.png", size=(800, 800)) |
68 shutil.move("corpuscallosum_sagittal.png", args.output_corpuscallosum_sagittal) | |
67 M, grouping = utils.connectivity_matrix(cc_streamlines, labels, affine=affine, return_mapping=True, mapping_as_streamlines=True) | 69 M, grouping = utils.connectivity_matrix(cc_streamlines, labels, affine=affine, return_mapping=True, mapping_as_streamlines=True) |
68 M[:3, :] = 0 | 70 M[:3, :] = 0 |
69 M[:, :3] = 0 | 71 M[:, :3] = 0 |
70 plt.imshow(np.log1p(M), interpolation='nearest') | 72 plt.imshow(np.log1p(M), interpolation='nearest') |
71 plt.savefig(args.output_connectivity) | 73 plt.savefig("connectivity.png") |
74 shutil.move("connectivity.png", args.output_connectivity) | |
72 lr_superiorfrontal_track = grouping[11, 54] | 75 lr_superiorfrontal_track = grouping[11, 54] |
73 shape = labels.shape | 76 shape = labels.shape |
74 dm = utils.density_map(lr_superiorfrontal_track, shape, affine=affine) | 77 dm = utils.density_map(lr_superiorfrontal_track, shape, affine=affine) |
75 # Save density map | 78 # Save density map |
76 dm_img = nib.Nifti1Image(dm.astype("int16"), hardi_img.affine) | 79 dm_img = nib.Nifti1Image(dm.astype("int16"), hardi_img.affine) |