https://github.com/agahkarakuzu/sunrise

NumPy, SciPy, MRI and Music | Presented at ISMRM 2021 Sunrise Educational Session

https://github.com/agahkarakuzu/sunrise

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: ieee.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary

Keywords

daw jupyter-notebook mri mri-reconstruction music-composition notebook numpy pyhton scientific-computing
Last synced: 5 months ago · JSON representation

Repository

NumPy, SciPy, MRI and Music | Presented at ISMRM 2021 Sunrise Educational Session

Basic Info
  • Host: GitHub
  • Owner: agahkarakuzu
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 86.5 MB
Statistics
  • Stars: 24
  • Watchers: 1
  • Forks: 8
  • Open Issues: 0
  • Releases: 1
Topics
daw jupyter-notebook mri mri-reconstruction music-composition notebook numpy pyhton scientific-computing
Created almost 5 years ago · Last pushed over 2 years ago
Metadata Files
Readme

README.md

The XX - Intro | MRI edition

Scientific computing with Python

Course material presented at ISMRM 2021 Sunrise Educational Session for Python Programming & Scientific Computing.

### 📚 3 Notebooks for 3 dimensions of MRI * [1D-MUSIC.ipynb](/1D-MUSIC.ipynb) for basic NumPy operations and SciPy functions to create harmonious MRI melodies. ![](assets/wave_np.png) * [2D-BIDS.ipynb](/2D-BIDS.ipynb) for querying reconstructed images using BIDS layout, loading them using `nibabel`, `parsing them` using `NumPy` and creating interactive plots using `Plotly`. ![](assets/notebook_2.png) * [3D-ISMRMRD.ipynb](/3D-ISMRMRD.ipynb) for reading ISMRM-RD k-space data (16 channels) using `ismrmrd-python`, reconstructing them using `SciPy` and creating interactive plots using `Plotly`. ![](assets/ismrmrd_structure.png) ### 🕸 You can execute the notebooks online [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/agahkarakuzu/sunrise/HEAD) ### 📥 Instructions for running notebooks on your computer #### 1. Clone this repository ``` git clone https://github.com/agahkarakuzu/sunrise.git ``` #### 2. Choose one of the following options

💻 Local Python environment
### Python If you don't have Python installed on your computer, I highly recommend [Anaconda](https://www.anaconda.com/). Simply follow the instructions on the website to install Anaconda, which comes with Jupyter out of the box. Then all you have to do is simply installing Python dependencies using `pip`. In a terminal window: ```python cd /directory/to/sunrise/on/your/computer pip install -r requirements.txt ``` That's all! After installing dependencies, run `jupyter notebook` or `jupyter lab` command in the terminal (while you are still at the `/sunrise` directory. Select a notebook, and start making some music using MRI sounds! ### Potentially missing dependencies * If you cannot run Librosa on a Ubuntu OS, you may be missing `libsndfile1` package: ```terminal sudo apt install libsndfile1 ``` * Lolviz package (visualizing arrays using a graphical representation) is optional. You can follow the [official docs](https://github.com/parrt/lolviz) to install its dependencies on different OS. * I did not test this on a Windows machine, please open an issue if you run into problems.
🐳 Use with Docker
If you have Docker installed on your computer and running, you can run the code in the same environment described in this repository. ### Option-1: Use `repo2docker` 1. Simply install `repo2docker` from pyPI: ``` pip install jupyter-repo2docker ``` 2. Run the following command in your terminal: ``` jupyter-repo2docker https://github.com/agahkarakuzu/sunrise ``` After building (it might take a while!), it should output in your terminal something like: ``` Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://0.0.0.0:36511/?token=f94f8fabb92e22f5bfab116c382b4707fc2cade56ad1ace0 ``` This should start a Jupyter session on your browser and make all the resources you see when you [launch a Binder](https://mybinder.org/v2/gh/agahkarakuzu/sunrise/main) for this repository. To re-use your container built by repo2docker, do the following: 1. Run `docker images` command and copy the `IMAGE ID` to your clipboard 2. Run the following command to start the container: ``` docker run -it --rm -p 8888:8888 `PASTE IMAGE ID HERE` jupyter notebook --ip 0.0.0.0 ``` ### Option 2: Use Docker image built by this repo's GitHub Actions This repository builds and pushes its own Docker images on every release! You can see the available versions [here](https://hub.docker.com/r/agahkarakuzu/sunrise). I will give the instructions for the latest version: 1. Pull the docker image ``` docker pull agahkarakuzu/sunrise:latest ``` 2. Start the container ``` docker run -it --rm -p 8888:8888 agahkarakuzu/sunrise:latest ```
## Special thanks ![](https://mir-s3-cdn-cf.behance.net/user/276/fbaf9164170569.5c8d4293cf696.jpg) My friend Bengü Aktas recorded vocals for this project. She's a [singer](https://www.youtube.com/channel/UC2LUEX92eaq_6VQzIAZnnCw/featured) and a [visual artist](https://www.behance.net/profile/benguaktas) who can also modify Si wafer surfaces to create [bio-compatible micro-environments](https://ieeexplore.ieee.org/document/7026352). Thank you Bengü! ## Equipment * Scanner: 3T Siemens Skyra with RTHawk * Microphone: Audio Technica AT2020usb+ * Acoustic guitar: Taylor 114ce ## How to run NORAH JONES pulse sequence on your scanner? ![](assets/sequence_order.gif) The [pulse sequence](/Sequence) is publicly available. If you have RTHawk real-time imaging platform, you can run it on a Siemens or GE scanner. The pulse sequence is a simple SPGR with 4 varying TRs played in succession. The sequence can export ISMRM-RD and BIDS compatible raw and reconstructed images. Visit [qMRPullseq](https://github.com/qmrlab/pulse_sequences) for other pulse sequences made available for quantitative MRI. ## What makes this Python course special? There are hundreds of free Python courses online to learn about NumPy and SciPy. You may ask, why create another one? * This one is _artfully_ tailored for MRI scientists. I always wanted to make some music with MRI sounds. I took this opportunity to do it in Python and share it with you. * All the notebooks are given in the context of a typical image processing workflow, with an analogy to cooking: * **Shopping** The ingredients we need to work with MRI data are sold in certain formats (DICOM, NIfTI, BIDS, ISMRM-RD etc.) in the marketplace. Without knowing the basics about these ingredients, we can't cook. ![](assets/sunrise_market.png) * **Mise en place** Depending on our research question or application, we often need to dice and slice our data in different ways. `NumPy` is the brand of our chef's knife and all the utensils to put everything in place. ![](assets/numpy_step2.png) * **SciPy culinary academy** You can imagine `SciPy` (or any other Python package) as a culinary academy of Michelin Star Chefs, who are willing to cook your meal for free, if you did the preparation. ![](assets/scipy_chefs.png) * **Share** Everything tastes better when you share. IMHO, sharing our MRI processing recipe with others is a requirement rather than a choice.

It is always good to know what you eat.

To that end, I equipped this repository with some tools to foster transparency & reproducibility.

Last, but not the least

Almost 1.5 years into the pandemic, I feel more and more like an analog guy in a digital world. I wanted to encourage creativity to take your mind off the stress of seeking an academic degree in a digital world, and to make MRI art while learning some Python.

If we are lucky to see digital-to-analog conversion happening next year, I would like to hear Python-generated MRI musics in the next MRM Highlights Party.

Please feel free to send a pull request to this repository by adding your MRI music in the REMIX folder. It does not matter if you used Python, C++, GarageBand, Logic Pro or even a synthesizer. All contributions are welcome!

Bonus

@mathieuboudreau created a fascinating Spotify playlist: unintentionally ISMRM. I hope that it serves as a source of inspiration for you to create magnetic melodies that are "intentionally ISMRM".

References and useful resources

EarSketch: Make beats & Learn code

I found out about EarSketch while creating this repository. It allows you to:

  • Learn coding through music
  • Use our sounds or your own (means that you can use files in the WavMRI folder!)
  • Learn Python or JavaScript code
  • Produce studio-quality music

All in a web browser. It is a great opportunity to improve your algorithmic thinking skills. You need to create an account and login to be able to upload your sound samples. You can export them to SoundCloud with one click. I gave it a try, it works!

Python projects for MRI scientists by NeuroPoly

Vector illustrations in this project are under Freepik Premium license ag_e843bcd6** (Unlimited use without attribution).

Owner

  • Name: Agah
  • Login: agahkarakuzu
  • Kind: user
  • Location: Montreal
  • Company: @neuropoly @qMRLab @neurolibre

GitHub Events

Total
  • Watch event: 1
  • Fork event: 1
Last Year
  • Watch event: 1
  • Fork event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 60
  • Total Committers: 2
  • Avg Commits per committer: 30.0
  • Development Distribution Score (DDS): 0.017
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Agah a****u@g****m 59
Tom Wilkinson t****m@t****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 2.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • tawilkinson (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

Deploy/requirements.txt pypi
  • audioread ==2.1.9
  • h5py ==3.1.0
  • ismrmrd ==1.7.2
  • librosa ==0.8.0
  • lolviz ==1.4.4
  • nibabel ==3.2.0
  • numba ==0.53.1
  • numpy ==1.18.4
  • pandas ==0.25.3
  • plotly ==4.14.0
  • pydot *
  • resampy ==0.2.2
  • scipy ==1.5.4
.github/workflows/dockerBuild.yml actions
  • actions/checkout v2 composite
Deploy/Dockerfile docker
  • jupyter/base-notebook 016833b15ceb build
binder/requirements.txt pypi
  • audioread ==2.1.9
  • h5py ==3.1.0
  • ipywidgets >=7.6
  • ismrmrd ==1.7.2
  • jupyter-book ==0.12.1
  • jupyter-dash *
  • jupyterlab >=3
  • librosa ==0.8.0
  • lolviz ==1.4.4
  • nibabel ==3.2.0
  • numba ==0.53.1
  • numpy ==1.18.4
  • pandas ==0.25.3
  • plotly *
  • repo2data *
  • resampy ==0.2.2
  • scipy ==1.5.4