nipy / nibabel

Python package to access a cacophony of neuro-imaging file formats
http://nipy.org/nibabel/
Other
653 stars 258 forks source link

How to get the axial, sagital and coronal view separately #628

Closed mko010 closed 5 years ago

mko010 commented 6 years ago

Hi guys,

I want to get the distinct views from .nii file, with Nibabel is it posible?

Thank you

effigies commented 6 years ago

Not directly, it would need matplotlib or some other viewer. Nilearn has very flexible plotting, and works smoothly with nibabel images.

mko010 commented 6 years ago

Thank you, I will prove it

ghost commented 6 years ago

I have a function to use the nii affine to transform the image into axial (RAI minus), coronal (RSA minus), and sagittal (ASR minus) views. Is this something interesting to be included in nibabel? @effigies https://github.com/Shuo-Han/segmentation-visualization/blob/master/segmentation_visualization/reslice.py

raamana commented 6 years ago

hi @mko010, take a look at mrivis also: which provides a small utility function get_axis to access any view/slice number without worrying about syntax

There is another useful class called SlicePicker which can let you programmatically traverse through an MRI image in different views, and lets you sample slices in a variety of ways: https://nbviewer.jupyter.org/github/raamana/mrivis/blob/master/docs/example_notebooks/mrivis_demo_Collage_SlicePicker_classes.ipynb