Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated 01_episode with python snippets #14

Merged
merged 1 commit into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions _episodes/01-Image_Modalities.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ keypoints:

### T1 and T2 relaxation
Here we see signal from two different tissues as the nuclei are tilted and realigned.
The figure on the left shows a single nucleus (i.e. tiny magnet) being tilted away and then precessing back to the the initial alighment along B<sub>0</sub>. The figure on the right shows the corresponding registered T1 and T2 signal profiles for two different "tissues". The difference in their signal intensties results in the image contrast.

![MR_relax](https://user-images.githubusercontent.com/7978607/112332334-08750c80-8c90-11eb-90fc-33956c037a1c.gif)

### T1w, T2w, and PD acquisition
Expand All @@ -36,6 +38,18 @@ Here we see signal from two different tissues as the nuclei are tilted and reali

_Note_: More recently, the FLAIR (Fluid Attenuated Inversion Recovery) sequence has replaced the PD image. FLAIR images are T2-weighted with the CSF signal suppressed.

> ## pulse sequence parameters and image contrast
>
> What are the two basic pulse sequence parameters that impact T1w and T2w image contrasts? Which one is larger?
>
> > ## Solution
> >
> > Repetition time (TR) and echo time (TE) are the two pulse sequence parameters that dictate the T1w and T2w image contrasts.
> > TR > TE.
> {: .solution}
{: .challenge}


### T1 and T2 relaxation times for various tissues

| | T1 (ms) | T2 (ms) |
Expand All @@ -45,6 +59,18 @@ _Note_: More recently, the FLAIR (Fluid Attenuated Inversion Recovery) sequence
| Grey Matter | 1300 | 110 |
| White Matter | 800 | 80 |


> ## Tissue type and image contrast
>
> What is the brightest tissue in the T1w image?
>
> > ## Solution
> >
> > White-matter (i.e. axonal tracts)
> {: .solution}
{: .challenge}


### T1w, T2w image contrasts

| T1w | T2w |
Expand All @@ -63,5 +89,40 @@ _Note_: More recently, the FLAIR (Fluid Attenuated Inversion Recovery) sequence

**Note: In this lesson, we have only talked about image contrast which is most relevent to sMRI image pipelines. The details of spatial encoding and k-space transforms are out of the scope.**


### Interacting with images (see [this notebook](../code/1_sMRI_modalities.ipynb) for detailed example.)

~~~
import nibabel as nib
import nilearn
from nilearn import plotting
~~~
{: .language-python}

~~~
local_data_dir = '../local_data/1_sMRI_modalities/'
T1_filename = local_data_dir + 'craving_sub-SAXSISO01b_T1w.nii.gz'
T2_filename = local_data_dir +'craving_sub-SAXSISO01b_T2w.nii.gz'
T1_img = nib.load(T1_filename)
T2_img = nib.load(T2_filename)

# grab data array
T1_data = T1_img.get_fdata()
T2_data = T2_img.get_fdata()

# plot
plotting.plot_anat(T1_filename, title="T1", vmax=500)
plotting.plot_anat(T2_filename, title="T2", vmax=300)

~~~
{: .language-python}


| T1w | T2w |
| :-------------: | :-----------: |
| ![nilearn_T1](../fig/episode_1/nilearn_T1.png) | ![nilearn_T2](../fig/episode_1/nilearn_T2.png) |



{% include links.md %}

Binary file added fig/episode_1/nilearn_T1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fig/episode_1/nilearn_T2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Things to keep in mind:
3. MR (pre)processing pipeline is a set of sequential image processing tasks performed on acquired MR scans prior to the statistical analyese.

Notes:
1. These days (year 2021), several software packages (e.g. FreeSurfer, FSL, SPM, fMRIprep) provide ready-to-use pipelines which will comprising commonly used pre(processesing) tasks. Thus as a user, you need not know the details of each algorithm. Nevertheless it is useful to understand the methods and their impact on the downstream analyses. This will 1) help developers to improve the underlying algorithms and 2) help users to customize the neuorimaging pipelines according to their dataset requirements.
1. These days (year 2021), several software packages (e.g. FreeSurfer, FSL, SPM, fMRIprep) provide ready-to-use pipelines which will comprise commonly used pre(processesing) tasks. Thus as a user, you need not know the details of each image processing algorithm. Nevertheless it is useful to understand the key objectives of these tasks, the corresponding computational methods, and their impact on the downstream analyses. This will 1) help developers to improve the underlying algorithms and 2) help users to customize the neuorimaging pipelines according to specific dataset requirements.

_All of this may sound complicated, but we'll explain things step-by-step in depth with practical examples as the course goes along. We will begin our computational journey stating from how an MR image is acquired, followed by several pre-processing tasks, with the end goal of conducting a statistical analysis to investigate volumetric hippocampal differences between Alzheimer's patients and healthy controls._

Expand Down