This guide aims to be the complete tutorial on how to get your T1 weighted image from a ".nii.gz" format into a handy ".stl" file format. I have tried my best to make the script run on every OS.
Despite my occasional genius I would not have gotten as far as I did, without the help of people that came before me. So as a responsible developer I think it only tell you check out these repositories and people as they have assisted me each in their own unique way.
First working implementation at FU Berlin by Marianna Schmidt
The first github of the project at FU Berlin
Good Ressource on the topic!
- Docker Desktop
- Freesurfer
- FSL
- Meshlab
- and a cool bash script tieing it all together
- Installing Docker Desktop
- Pulling the Docker Image
- Downloading the Freesurfer Licence
- Pulling the Repository
- Setting up the Files
- Running the Container
- Running/Setting up the Script
- Using Meshlab
See that in the wiki!
Image name:
michamigacev/printyourbrain
Details in wiki!
Freesurfer only runs with a license, but fret not! The license is free to obtain.
Here you can get one!
Make sure to remember where you saved it, it is going to come in handy later.
Create a place on your PC where you want to have the repository
and pull this repository on your local machine.
git clone https://github.com/MichaelMigacev/3DPrintYourBrain
Because a script will be running it is important to replicate the intended folder structure like this:
3DPrintYourBrain
│ README.md
│ license.txt
│
└───pyb_mount
| └───Scripts
│ │ Script.sh # this is the script, instructions inside of it!
│
| └───subject00X # your subject
| |
| └───input # this is where you put your '*****T1w.nii.gz' file
| | *****T1w.nii.gz # your T1 image (please replicate the ending or edit the script)
|
| └───output # this is where your future output will be
Wow, that was fast, you are almost there!
To run an interactive container we use the following command:
Don't forget to change the path according to your file locations!
docker run --platform linux/x86_64 -it -v "/path/to/pyb_mount:/home" -v "/path/to/your/freesurfer/license.txt:/opt/freesurfer-6.0.0/license.txt" michamigacev/printyourbrain:latest
Remark: usually you can mount files without "", but my windows userame has a space in it
and this is how you make that work regardless
Now that the container is running we can prepare the script.
Before you go around and start digging in the terminal I recommend you to
open pyb_mount folder on your system in a code editor. This is possible because
you have created a mount/volume linked to your actual file.
Now you can better see the script, it contains all the instructions to run it.
This takes about 2 - 7 hours (depending on your hardware).
After you have ran the script you should have all necessary files in:
subject -> output -> print
I recommend you to copy these files to somewhere else to have a backup copy for the next step.
To have the best quality brain it is best practice to inspect it in Meshlab.
You can install Meshlab here.
Please look in the wiki for instructions on smoothing.