Skip to content

Commit

Permalink
Merge pull request #476 from bloomdt-uw/enh/443-callosal-group-example
Browse files Browse the repository at this point in the history
ENH #443 Callosal Group Example
  • Loading branch information
arokem committed Oct 7, 2020
2 parents aaa1db4 + 2ed4d85 commit b60a25b
Show file tree
Hide file tree
Showing 3 changed files with 528 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ docs/build
docs/auto_examples
docs/source/auto_examples
docs/source/usage/config.rst
examples/*.nii.gz
examples/*.trk
examples/*.npy
examples/**/*.nii.gz
examples/**/*.trk
examples/**/*.npy
examples/**/*.png
build
dist
.DS_Store
Expand Down
28 changes: 28 additions & 0 deletions AFQ/viz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,3 +1335,31 @@ def visualize_gif_inline(fname, use_s3fs=False):
fs.get(fname_remote, fname)

display.display(display.Image(fname))


def show_anatomical_slices(img_data, title):
"""
display anatomical slices from midpoint
based on:
https://nipy.org/nibabel/coordinate_systems.html
"""

axial_slice = img_data[:, :, int(img_data.shape[2] / 2)]
coronal_slice = img_data[:, int(img_data.shape[1] / 2), :]
sagittal_slice = img_data[int(img_data.shape[0] / 2), :, :]

fig = plt.figure(constrained_layout=False)
gs = fig.add_gridspec(nrows=3, ncols=2, wspace=0.01, hspace=0.01)
ax1 = fig.add_subplot(gs[:-1, :])
ax1.imshow(axial_slice.T, cmap="gray", origin="lower")
ax1.axis('off')
ax2 = fig.add_subplot(gs[2, 0])
ax2.imshow(coronal_slice.T, cmap="gray", origin="lower")
ax2.axis('off')
ax3 = fig.add_subplot(gs[2, 1])
ax3.imshow(sagittal_slice.T, cmap="gray", origin="lower")
ax3.axis('off')

plt.suptitle(title)
plt.show()

0 comments on commit b60a25b

Please sign in to comment.