Neuro Imagin with Machine Learning

What is nilearn 1.0 ?

  • nilearn is a python way of doing work (statistical analysis) with Neuro Imaging in Python using machine learning. It uses scikit-learn Python toolbox.
  • It is a subset of a family of work done in python language related with Neuro Imaging.
  • It is not a new technique or new science but provides modern pythonic way of dealing with old analysis done on neuro imaging data such as MVPA, decoding, predictive modelling, functional connectivity, brain parcellations, connectomes.
  • It can also be used on different modalaties of fMRI such as task fMRI, resting fMRI, or VBM data
  • nilearn makes the work of neuro imaging with machine learning a specific domain, or feature engineering construction.

Installation 1.1

  • Use pip install -U nilearn or use existing conda environment to install nilearn

Check installation 1.2

  • Following line will check its installaiton.
In [1]:
import nilearn as ni
In [3]:
ni.version
Out[3]:
<module 'nilearn.version' from '/home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/nilearn/version.py'>
In [4]:
from nilearn import plotting
In [5]:
# Plotting glass brain
plotting.plot_glass_brain("data/sample-nifiti-file.nii")
Out[5]:
<nilearn.plotting.displays.OrthoProjector at 0x7fde728a2100>
In [6]:
# plotting anatomical brain.
plotting.plot_anat("data/sample-nifiti-file.nii")
Out[6]:
<nilearn.plotting.displays.OrthoSlicer at 0x7fde6f4886d0>
In [7]:
# plotting
plotting.plot_epi("data/sample-nifiti-file.nii")
Out[7]:
<nilearn.plotting.displays.OrthoSlicer at 0x7fde6d874100>
In [9]:
# Using plot_img
plotting.plot_img("data/sample-nifiti-file.nii")
Out[9]:
<nilearn.plotting.displays.OrthoSlicer at 0x7fde6d62aeb0>
In [26]:
# To read dicom daga
import pydicom as pd 
import pydicom.data 
# To plot it
import matplotlib.pyplot as plot

base = "data/"
pass_dicom = "IM-0001-0001.dcm"
fn = pd.data.data_manager.get_files(base,pass_dicom)[0]
ds = pd.dcmread(fn)

# To view read image
plot.imshow(ds.pixel_array, cmap=plot.cm.bone)
Out[26]:
<matplotlib.image.AxesImage at 0x7fde850be490>
In [ ]:
 

Comments