Session 9 - fMRI Flashcards
(115 cards)
In this session, we will start looking at how to
to manipulate neuroimaging data in Python.
We are going to be using a module called
nibabel to load MRI and fMRI data to Python and save out overlays and statistical maps in the same format - old way of doing it
Going to be using Spyder
which is used for scientific programming in Python and can run python directly from machine (as compared to Colab - running it from cloud) and can produce interactive plots
All of the files for this section can be found in the - (2)
course materials repository.
They are in the s7_fmri directory.
Obtaining the data files needed for this lecture which is found in s7_fMRI directory by running this code:
What does this code mean?
git is accessing remote reposities and borrows data from YNiC (s7_fMRI directory) to local content directory
Output of this code:
After running the code:
We can check the current working directory
List the contents inside the current working directory
List what is inside pin-materials and s7_fMRI
What are these files when listening what is inside s7_fMRI? (last part) - (4)
These are all data files
‘highres.nii.gz’ is a anatomical file - 3D high-resolution structural image (T1) of someone’s brain
‘highres_brain.nii.gz’ - word brain means we have stripped away the skull and just looking at the brain (skull-stripped image of the brain) - using FSL command called BET
There are two functional imaging data files here/datasets which are 3D snapshots of the brain taken every 2 seconds (TR) while its doing a task: 1) filtered_func_data.nii.gz and func_data.nii.gz
What does
‘ls-l’ mean?
Listening contents of files and directories in long format (“l” at bottom)
The ‘Babel’ part of nibabel refers to
the ‘Tower of Babel’.
The nibabel module has
reading and writing routines for various neuroimaging formats - so that we can all speak the same neuroimaging ‘language’ or something.
Most MRI data are taken off scanners in a format known as
DICOM
What does DICOM stand for?
Digital Imaging and Communications in Medicine)
Most MRI data are taken off the scanners in a format known as DICOM - this format is
very complex so scientists almost always convert the DICOM images from the scanner into NIFTI
What does NIFTI stand for?
Neuroimaging Informatics Technology Initiative
Most MRI data are taken off scanners in a format known as DICOM which is complex and scientist always conert to NIFTI and at YNIC this is done
automatically
NIFTI files end in
nii.gz, gz means the file is compressed so does not take up much space on disk
What are the two parts of NIFTI files, and what does each part contain? - (3)
NIFTI files consist of a ‘header,’ which contains information about
the image (e.g., how big the image is, how big the voxels are, many voxels there are in each direction, number of volumes, TR),
and the actual imaging data which is just an array of numbers: usually integers for raw data that has come from scanner; often floating point for processed data
The first dataset we will look at is in the folder is a high-resolution anatomy file called ‘highres.nii.gz’ which contains - (2)
a single T1-weighted scan of a brain
It was acquired slice by slice : 176 slices running >across< the head from Left to Right in steps of 1mm with 256x256 1mm x 1mm voxels in each slice.
Let’s move into the s7_fMRI which contains ‘highres.nii.gz’ directory for rest of tutorial by doing this which means
This code changes the current working directory to ‘/content/pin-material/s7_fmri’
So we are going to examine the ‘highres.nii.gz’ by loading it using nibabel
Thus, we need to import the module first:
This is common practice, analogous to importing numpy as np.
We will now use nibabel to load an fMRI file into Python and examine it of ‘highres.nii.gz’ using nibabel: