{"id":22922689,"url":"https://github.com/agahkarakuzu/sunrise","last_synced_at":"2025-08-02T12:10:40.649Z","repository":{"id":51265003,"uuid":"352423000","full_name":"agahkarakuzu/sunrise","owner":"agahkarakuzu","description":"NumPy, SciPy, MRI and Music | Presented at ISMRM 2021 Sunrise Educational Session","archived":false,"fork":false,"pushed_at":"2023-07-21T23:37:57.000Z","size":90669,"stargazers_count":24,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T10:11:20.191Z","etag":null,"topics":["daw","jupyter-notebook","mri","mri-reconstruction","music-composition","notebook","numpy","pyhton","scientific-computing"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agahkarakuzu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-28T19:44:54.000Z","updated_at":"2025-01-23T14:26:45.000Z","dependencies_parsed_at":"2024-12-14T08:12:18.930Z","dependency_job_id":"4c8ce427-1bb1-49e8-875f-4c0833184b99","html_url":"https://github.com/agahkarakuzu/sunrise","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/agahkarakuzu/sunrise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agahkarakuzu%2Fsunrise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agahkarakuzu%2Fsunrise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agahkarakuzu%2Fsunrise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agahkarakuzu%2Fsunrise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agahkarakuzu","download_url":"https://codeload.github.com/agahkarakuzu/sunrise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agahkarakuzu%2Fsunrise/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268385921,"owners_count":24242105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["daw","jupyter-notebook","mri","mri-reconstruction","music-composition","notebook","numpy","pyhton","scientific-computing"],"created_at":"2024-12-14T08:11:56.146Z","updated_at":"2025-08-02T12:10:40.591Z","avatar_url":"https://github.com/agahkarakuzu.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e \u003ca href=\"https://www.youtube.com/watch?v=XX0UGblIwMM\"\u003e\u003cimg width=\"90\" src=\"https://i.pinimg.com/originals/19/7b/36/197b365922d1ea3aa1a932ff9bbda4a6.png\"\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e  \u003ca href=\"https://www.youtube.com/watch?v=XX0UGblIwMM\"\u003e The XX - Intro | MRI edition \u003c/a\u003e\u003c/p\u003e \n\u003cp align=\"center\"\u003e \u003ca href=\"https://agahkarakuzu.github.io/sunrise\"\u003e\u003cimg src=\"https://img.shields.io/badge/Jupyter%20Book-Interactive%20webpage-ff0000?logo=GitBook\u0026style=for-the-badge\u0026logoColor=white\"\u003e\u003c/a\u003e \u003c/p\u003e\n\n\u003cp align=\"center\"\u003e \u003ca href=\"https://mybinder.org/v2/gh/agahkarakuzu/sunrise/HEAD\"\u003e\u003cimg src=\"https://mybinder.org/badge_logo.svg\"\u003e\u003c/a\u003e \u003ca href=\"https://hub.docker.com/repository/docker/agahkarakuzu/sunrise\"\u003e\u003cimg src=\"https://img.shields.io/badge/DockerHub-sunrise-blue?logo=Docker\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/agahkarakuzu/sunrise/actions/workflows/dockerBuild.yml\"\u003e\u003cimg src=\"https://github.com/agahkarakuzu/sunrise/actions/workflows/dockerBuild.yml/badge.svg\"\u003e\u003c/a\u003e \u003c/p\u003e\n\n\n\n\u003ch1 align=\"center\"\u003e Scientific computing with Python \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e Course material presented at \u003ca href=\"https://www.ismrm.org/21/program-files/T-30.htm\"\u003eISMRM 2021 Sunrise Educational Session for Python Programming \u0026 Scientific Computing. \u003c/p\u003e\n\n\u003cp align=\"center\"\u003e \u003ca href=\"https://www.youtube.com/watch?v=XX0UGblIwMM\"\u003e\u003cimg src=\"assets/cover.png\"\u003e\u003c/a\u003e\n\n\n\n### 📚 3 Notebooks for 3 dimensions of MRI\n\n* [1D-MUSIC.ipynb](/1D-MUSIC.ipynb) for basic NumPy operations and SciPy functions to create harmonious MRI melodies.\n![](assets/wave_np.png)\n* [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`.\n![](assets/notebook_2.png)\n* [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`.\n![](assets/ismrmrd_structure.png)\n### 🕸  You can execute the notebooks online\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/agahkarakuzu/sunrise/HEAD)\n\n### 📥  Instructions for running notebooks on your computer\n\n#### 1. Clone this repository \n\n```\ngit clone https://github.com/agahkarakuzu/sunrise.git\n```\n\n#### 2. Choose one of the following options\n\n\u003cdetails\u003e\u003csummary\u003e \u003cb\u003e💻  Local Python environment\u003c/b\u003e \u003c/font\u003e \u003c/summary\u003e\u003cbr\u003e\n\n### Python \n\nIf 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. \n\nThen all you have to do is simply installing Python dependencies using `pip`. In a terminal window:\n\n```python\ncd /directory/to/sunrise/on/your/computer\npip install -r requirements.txt\n```\n\nThat'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! \n\n\n### Potentially missing dependencies \n\n* If you cannot run Librosa on a Ubuntu OS, you may be missing `libsndfile1` package: \n\n```terminal\nsudo apt install libsndfile1\n```\n\n* 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.\n\n* I did not test this on a Windows machine, please open an issue if you run into problems.\n\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e \u003cb\u003e🐳  Use with Docker\u003c/b\u003e \u003c/font\u003e \u003c/summary\u003e\u003cbr\u003e\n\nIf you have Docker installed on your computer and running, you can run the code \nin the same environment described in this repository. \n\n### Option-1: Use `repo2docker` \n\n1. Simply install `repo2docker` from pyPI: \n```\npip install jupyter-repo2docker\n```\n2. Run the following command in your terminal:\n```\njupyter-repo2docker https://github.com/agahkarakuzu/sunrise\n```\n\nAfter building (it might take a while!), it should output in your terminal \nsomething like:\n\n```\nCopy/paste this URL into your browser when you connect for the first time,\n    to login with a token:\n        http://0.0.0.0:36511/?token=f94f8fabb92e22f5bfab116c382b4707fc2cade56ad1ace0\n```\n\nThis should start a Jupyter session on your browser and make all the resources \nyou see when you [launch a Binder](https://mybinder.org/v2/gh/agahkarakuzu/sunrise/main) for this repository. \n\nTo re-use your container built by repo2docker, do the following: \n\n1. Run `docker images` command and copy the `IMAGE ID` to your clipboard \n2. Run the following command to start the container:\n```\ndocker run -it --rm -p 8888:8888 `PASTE IMAGE ID HERE` jupyter notebook --ip 0.0.0.0\n```\n\n### Option 2: Use Docker image built by this repo's GitHub Actions\n\nThis repository builds and pushes its own Docker images on every release! \n\nYou can see the available versions [here](https://hub.docker.com/r/agahkarakuzu/sunrise). I will give the instructions for the \nlatest version: \n\n1. Pull the docker image\n```\ndocker pull agahkarakuzu/sunrise:latest\n```\n2. Start the container\n```\ndocker run -it --rm -p 8888:8888 agahkarakuzu/sunrise:latest\n```\n\n\u003c/details\u003e\n\n## Special thanks \n\n![](https://mir-s3-cdn-cf.behance.net/user/276/fbaf9164170569.5c8d4293cf696.jpg)\n\nMy 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ü!\n\n## Equipment \n\n* Scanner: 3T Siemens Skyra with RTHawk\n* Microphone: Audio Technica AT2020usb+ \n* Acoustic guitar: Taylor 114ce\n\n## How to run NORAH JONES pulse sequence on your scanner?\n\n![](assets/sequence_order.gif)\n\nThe [pulse sequence](/Sequence) is publicly available. If you have RTHawk real-time imaging platform, you can run it on a Siemens or GE scanner.\n\nThe 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. \n\nVisit [qMRPullseq](https://github.com/qmrlab/pulse_sequences) for other pulse sequences made available for quantitative MRI.\n\n## What makes this Python course special?\n\nThere are hundreds of free Python courses online to learn about NumPy and SciPy. You may ask, why create another one?\n\n* 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.\n* All the notebooks are given in the context of a typical image processing workflow, with an analogy to cooking: \n   * **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.\n   ![](assets/sunrise_market.png)\n   * **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.\n   ![](assets/numpy_step2.png)\n   * **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.\n   ![](assets/scipy_chefs.png)\n   * **Share** Everything tastes better when you share. IMHO, sharing our MRI processing recipe with others is a requirement rather than a choice. \n\n\n\u003cp align=\"center\"\u003e \u003cb\u003eIt is always good to know what you eat.\u003c/b\u003e \u003c/p\u003e\n   \n\u003cp align=\"center\"\u003e \u003cimg src=\"https://i.pinimg.com/originals/f9/f0/1b/f9f01bc7b3436efece0c29cca44cc1e1.gif\"\u003e \u003c/p\u003e\n\n\u003cp align=\"center\"\u003e To that end, I equipped this repository with some tools to foster transparency \u0026 reproducibility. \u003c/p\u003e\n\n\n### Last, but not the least\n\nAlmost 1.5 years into the pandemic, I feel more and more like [an analog guy in a digital world](https://www.youtube.com/watch?v=OkQlrIQhUMQ). 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. \n\nIf 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](https://www.facebook.com/watch/?v=730147610778171).\n\nPlease 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! \n\n### Bonus \n\n@mathieuboudreau created a fascinating Spotify playlist: [unintentionally ISMRM](https://open.spotify.com/playlist/1U8vbOJFSIRQhiu3ZLvgM8?si=0e4d362e3c544999). I hope that it serves as a source of inspiration for you to create magnetic melodies that are \"intentionally ISMRM\". \n\n## References and useful resources\n\n* [AllenDowney/ThinkDSP](https://github.com/AllenDowney/ThinkDSP) was a great source of inspiration, I highly recommend his [SciPy 2015 talk](https://www.youtube.com/watch?v=0ALKGR0I5MA). \n\n* The amazing [Pianoputer project](http://zulko.github.io/blog/2014/03/29/soundstretching-and-pitch-shifting-in-python/)\n\n* [Visual NumPy](https://jalammar.github.io/visual-numpy/), [Pictorial Numpy tutorial](https://towardsdatascience.com/reshaping-numpy-arrays-in-python-a-step-by-step-pictorial-tutorial-aed5f471cf0b), [the Visual Guide to NumPy](https://betterprogramming.pub/numpy-illustrated-the-visual-guide-to-numpy-3b1d4976de1d)\n\n* [Librosa official documentation](https://librosa.org/doc/latest/index.html)\n\n* [100 Numpy Exercises](https://github.com/rougier/numpy-100)\n\n* [Software carpentry Python course](https://swcarpentry.github.io/python-novice-inflammation/)\n\n* [Real Python](https://realpython.com/)\n\n* [Podcast: Talk Python to me](https://talkpython.fm/)\n\n* [Commanline Heroes: Python's tale](https://www.youtube.com/watch?v=eaP4b2nAqm8)\n\n### EarSketch: Make beats \u0026 Learn code\n\nI found out about [EarSketch](https://earsketch.gatech.edu/landing/#/) while creating this repository. It allows you to: \n\n* Learn coding through music\n* Use our sounds or your own (means that you can use files in the [`WavMRI`](/WavMRI) folder!)\n* Learn Python or JavaScript code\n* Produce studio-quality music\n\nAll 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](https://soundcloud.com/agah-karakuzu/quick_tour-py), it works!\n\n## Python projects for MRI scientists by NeuroPoly\n\n* [IvadoMed](https://ivadomed.org/en/latest/)\n\n* [Spinal Cord Toolbox](https://github.com/neuropoly/spinalcordtoolbox)\n\n* [Shimming Toolbox](https://shimming-toolbox.org/en/latest/)\n\n* [AxonDeepSeg](https://github.com/neuropoly/axondeepseg)\n\nVector illustrations in this project are under Freepik Premium license ag_e843bcd6** (Unlimited use without attribution).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagahkarakuzu%2Fsunrise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagahkarakuzu%2Fsunrise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagahkarakuzu%2Fsunrise/lists"}