---
# System prepended metadata

title: Neurohackademy 2020 MRI Overview Project

---

# Neurohackademy 2020 MRI Overview Project
Welcome to the mri overview in flowcharts project. Our goal: Bring newcomers together (maybe with some experienced coders!) to develop some flowcharts and/or overview materials that will increase our understanding of the start-to-finish MRI/fMRI/DTI analysis process by collaborating on interactive flowcharts, which we hope can be shared more broadly to help others similarly understand how these processes flow at a macro level. 

## Group Info:
We are dividing into 2 groups to achieve our goals:
1. Researching and creating platforms for interactive collaborative flowcharts: https://meet.jit.si/nha-mri-overview-platforms
2. Content and organization for flowcharts: 
https://meet.jit.si/Hello-mri-overview
    * Google Doc for organizing hack content: https://docs.google.com/document/d/1d2YIGNcBgyLPSA3bIh_4ykLT1ixNjU6LHuPns6krSRg/edit#heading=h.y8cmid1ej2bp
    * Google Sheet for terms and definitions:    https://docs.google.com/spreadsheets/d/1U3Qi4Ns4POn9R8m0SEua6zU0cO5jjseMq3WrctPEtyo/edit?usp=sharing
    * GitHub repository for flowcharts / materials: https://github.com/amelia-m/mri-overview
    
## Collaborators


| Name             | Role (?) | email                      | GitHub    |     |
| ---------------- | -------- | -------------------------- | --------- | --- |
| Annalysa Lovos   | Lead     | aklovos@email.arizona.edu  | annalysa  |     |
| Amelia Miramonti | Co-Lead  | amelia.miramonti@gmail.com | amelia-m  |     |
| Allison Londeree |          | alonderee@gmail.com        | londeree4 |     |
| Stepheni Uh      |          |                            | stephuh2  |     |
| Nazek Queder     |          | nqueder@hs.uci.edu         | nqueder   |     |
| Jinyi Hung       |          | jinyihung@gmail.com        | jinyihung |     |
| Tuba Sahin       |          | tubasahin.psyc@gmail.com   | tubapona  |     |
| Hulya Aldemir    |          | hulyaald@gmail.com         | hulyaald  |     |
| Dara Ghahremani  |          | darag@ucla.edu             | daraucla  |     |
| Neha Sara John   |          | nehasjohn1d@gmail.com      | NSJohn    |     |



## Ideas
* overview flow chart (including preprocessing / post/etc)
    * links to more in-depth (sub?) flow charts for each section
* different flow charts for different MR technologies? 
    * structural
    * fMRI task-based and resting state



# Potential flowchart platforms for group work & interactive design?
half of our group is working on this, that jitsi is https://meet.jit.si/nha-mri-overview-platforms
* lucidchart:
    * https://app.lucidchart.com/invitations/accept/d21cb744-91ab-4824-ba8e-002e1467d338
* iBoske: is interactive but maybe only 1 person can create: https://iboske.com/
* Visio: https://www.microsoft.com/en-us/microsoft-365/visio/flowchart-software
* Miro: interactive flowchart maker: https://miro.com/templates/flowchart/
* programming in R
    * http://rich-iannone.github.io/DiagrammeR/
        * https://mikeyharper.uk/flowcharts-in-r-using-diagrammer/?fbclid=IwAR1tfnd_4tmPrBs3McXl6gBkiPP-D2T7-Q5s5yP-qwfQjQ_nVbGfVbQCFtg
    * http://personal.tcu.edu/kylewalker/interactive-flow-visualization-in-r.html?fbclid=IwAR1tfnd_4tmPrBs3McXl6gBkiPP-D2T7-Q5s5yP-qwfQjQ_nVbGfVbQCFtg
    * https://www.edrawsoft.com/flowchart-resource.html?fbclid=IwAR01h1dieIuPM_8c5ddAvQWbBCSNoSDXVMwRJ9DyS5Sg3437VNSCLgaeqDU
    * https://medium.com/technical-writing-is-easy/diagrams-in-documentation-markdown-guide-4e78419e8d2f


# Resources to Include
* NARPS Paper by Russ Poldrack: https://www.nature.com/articles/s41586-020-2314-9
* Paper by Ciric et al. on postprocessing/motion correction strategies: https://www.sciencedirect.com/science/article/pii/S1053811917302288
* Links to:
    * Andy's Brain Book for tutorials on Freesurfer, FSL, AFNI, SPM, CONN, and UNIX: https://andysbrainbook.readthedocs.io/en/latest/

* https://f1000research.com/articles/6-124
* Principles of fMRI https://www.youtube.com/channel/UC_BIby85hZmcItMrkAlc8eA 

# Sections

## Data Acquisition
* fMRI Data Acquisition: Data is obtained primarily through scanning “slices” of the brain over time and developing a volumetric representation of the brain. Each volumetric slice is organized as a matrix where each point in a matrix is known as a voxel with a corresponding BOLD value. These BOLD (Blood Oxygen Level Dependent) values measure the amount of oxygenated and deoxygenated blood in an area. These hemodynamic responses are not a direct indication of neuronal activity but have been shown to predict neuronal activity. The most common form of imaging is known as echo planar imaging (EPI) due to its high BOLD response sensitivity and fast imaging speed.
Important properties to keep in mind:
    * Magnetic field strength (usually 3T or 7T)
    * Slice acquisition (inferior to superior or some other direction)
    * Acquisition resolution (temporal or spatial) – this will primarily be determined on what type of image you want to look at such as anatomical or functional
    * Repetition times known as TR’s (usually 2 to 3 seconds) -this tells you how long it will take to acquire one volume
    * Voxel size (usually around 2-3 mm)
    * Echo time known as TE – How soon after excitation we acquire the data and is dependent of tissue type
    * Flip angle
    * For more things to think about check out https://thewinnower.com/papers/977-a-checklist-for-fmri-acquisition-methods-reporting-in-the-literature

    Note that your data will have 4 dimensions (x, y, z, and time). In the end you will have a 3-dimensional representation on the brain for each time point.
(Reference: https://www.frontiersin.org/articles/10.3389/fnins.2016.00515/full)
    


## Pre-processing
* https://fmriprep.org/en/stable/workflows.html
* Neurohackademy 2020: Oscar Esteban - Nipreps https://www.youtube.com/watch?v=J_ZwPN8gYpM&feature=emb_title
*  Summary of analysis software: https://learn-neuroimaging.github.io/tutorials-and-resources/analysis_software_MRI/
*  Questions to ask yourself before you begin:
    * Do you have the MPRAGE/structural file for each subject?
    * Do you have the functional files for each subject?
    * What sort of design do you have (resting, block, event-related)?
    * How do you collect slices? Interleaved? 
    * How do you collect onset times? In seconds or in scans?


## Post-processing
* First-level
* Second-level
* Nuisance Regression: https://fcp-indi.github.io/docs/latest/user/nuisance
    * Controversy on global signal regression (https://www.nature.com/articles/s41598-019-50750-8)
* Spatial Smoothing & Frequency Filtering:
    * http://www.fmri4newbies.com/tutorial-4
* Different methods for correcting for motion:
    * https://neurostars.org/t/despiking-vs-scrubbing/2157
    * https://www.sciencedirect.com/science/article/pii/S1053811917302288 (Ciric et al., 2017)

## Statistical Analyses (Processes?)
* Nilearn: 
    * https://nilearn.github.io/
    * https://nbviewer.jupyter.org/github/lukassnoek/nilearn-tutorial/blob/master/nilearn.ipynb
* Neurohackademy 2020: Elizabeth DuPre - Nilearn 
    * https://www.youtube.com/watch?v=ASEyg5nxj3A&feature=emb_title
* DartBrains - GLM, single, group, multivariate, RSA?
    * https://dartbrains.org/intro

## Data management (?)
* Bids Starter Kit https://github.com/bids-standard/bids-starter-kit
* Bids Overview https://bids.neuroimaging.io/
* Bids Docs https://bids-specification.readthedocs.io/en/stable/\


## Process management, Data/Code-sharing, and Open Science
* Git / GitHub
    * https://neuroplausible.com/github
    * https://git-scm.com/book/en/v2
* Open Science resources
    * https://learn-neuroimaging.github.io/tutorials-and-resources/open_science/
* Pre-registrations
    * https://www.cos.io/our-services/prereg?_ga=2.66188201.689987463.1596208505-603984138.1594409150
    * https://www.pnas.org/content/115/11/2600
    * https://www.nature.com/articles/d41586-018-07118-1
* Dataset sharing
    * https://openneuro.org/public/datasets
    * https://neurovault.org/


# resources for hosting / platform? development
* https://guides.github.com/features/pages/#setup

* https://rstudio.github.io/DT/

* https://bookdown.org/yihui/rmarkdown/html-document.html#document-dependencies

* shiny app?
    * https://stackoverflow.com/questions/45787353/how-to-display-flowchart-created-using-r-diagram-library-in-an-rshiny-app
    * https://cran.r-project.org/web/packages/collapsibleTree/index.html

## Other useful resources
* Nipype Beginner's Guide: https://miykael.github.io/nipype-beginner-s-guide/neuroimaging.html
* MRI animations 
http://www-mrsrl.stanford.edu/~brian/mri-movies/
* Schnyer Learning and Memory Lab page: http://wikis.la.utexas.edu/imagelab/index.html

## Checklist: Things we want to work on (also use Issues in our GitHub:)
* 


### Prerequisites
- Have a [Github account](https://github.com/join) 
- Get added as a member to the [MRI Overview Github Organization](https://github.com/MRI-Overview) - feel free to just email any member of this project team.
- Install [Git](https://git-scm.com/downloads) 
- Install [RStudio](https://rstudio.com/products/rstudio/download/) installed
    - Required packages can be installed by running the first code chunk (commented out by default - more on this below)


### Cloning the Repository
Once you have these things installed open RStudio.
    - If you already opened RStudio you will need to restart it.
    
Under "File" Select New Project. From the create project window select "Version Control" then "Git" 

On the Clone Git Repository window, input:
- repository URL as https://github.com/MRI-Overview/mri-overview 
- Project directory name as mri-overview (may auto-populate)
- And enter the sub directory as wherever you would like things on your computer

Congratulations!  You have sucessfully cloned the repository! 
You can open this project again by opening the `mri-overview.Rproj` file in the future.

### Examining the File Structure

Welcome to the local directory - you can view all of the site files in the "Files" pane of Rstudio!

There's really only two files you might want to edit: `index.Rmd` and `README.md`. Most of the other files are generated by R and some are not human readable -unless you have your HTML goggles on. 

The `README.md` is displayed on the GitHub repository page, but doesn't show up on the [site](https://mri-overview.github.io/mri-overview/).

The `index.rmd` is the only page on the website! If you want to add additional pages or make changes the site theme, you can edit the `_site.yml` file. Everything in this file is be written in Markdown, HTML, or R script, but you probably won't need to edit any of the HTML (in the index file).

Flowchart and vocab sections are pulling information from the following Google docs:
- [Flowchart](https://docs.google.com/spreadsheets/d/1OS48G1jEBcArDIN76jh5PFHGoJSeqfGSTE23ve7lfjk/edit?usp=sharing)
- [Vocab](https://docs.google.com/spreadsheets/d/1U3Qi4Ns4POn9R8m0SEua6zU0cO5jjseMq3WrctPEtyo/edit?usp=slack&ts=5f24816f)

### Updating the site with a change made to the Google doc (without editing the site code)

There are really only two steps to this:
1. Rendering the site
2. Getting the new version of the site onto GitHub

**Rendering the site**

To render the site you will need to go to the console tab of RStudio and type in `rmarkdown::render_site()`
What this does is re-run all of the code in the site, and generate the site output in HTML in the "docs" directory which is where the site is accessed by GitHub Pages. This will pull the most current version of the Google docs and update all flowcharts and tables that rely on it! 

If you are doing this for the first time, you may need to install some packages to get the code to run.  To do this you can either uncomment and run the following line in the first codechunk in the index.Rmd file `install.packages("dplyr","collapsibleTree","gsheet","DT","readr","prettydoc")
`
OR sometimes there is a banner at the top of the gui that will allow you to install packages. Which ever you prefer! 

**Communicating with Github**
Next, we need to get this new beautiful version onto GitHub! Switch over to the terminal tab in RStudio

To make sure git is working type `git status` This should yield some information about what changes have been made, and if you need to `pull` a more recent repo. If you are a version behind, use `git pull` to get up to date. It's a good idea to do this any time you want to make a change. 

Use `git add .` to add all of the changes made to the commit queue.
 

Commit message should describe the changes made, e.g., "rendering site with updated Google doc content"
`git commit -m "[your commit message]"`

Finally we want to push our most recent version onto GitHub with the new commits we just made using  `git push`. The first time you do this you may be prompted to sign into github. This may take a minute to update. 

Once you have pushed, you can check the project repository to see your new commit! You can also view [the site](https://mri-overview.github.io/mri-overview/) with your new change! 

Woot Woot! You made it!

### To update site including code changes

Say you want to edit the actual structure of the index.Rmd. Please feel free to by following the same steps as above! One additional thing you may want to do before commiting changes to github is just double checking the code by knitting and looking at the HTML to make sure your changes look correct!

































##



