|
1 | | -# CaseForge automated pipeline |
| 1 | +# An automated pipeline to create subject-specific headcases for fMRI scanning |
2 | 2 |
|
3 | | -## Requirements |
| 3 | +This repository contains an automated pipeline to create subject-specific headcases for fMRI scanning. Headcases reduce subject motion ([Power et al., 2019](https://pubmed.ncbi.nlm.nih.gov/30639840/)), increase subject's comfort, and facilitate consistent head positioning across multiple scanning sessions. |
4 | 4 |
|
5 | | -Python requirements are listed under `requirements.txt`. You can install them with |
| 5 | +The pipeline takes as an input a 3D model of the participant's head and generates STL files of the headcases for 3D printing. This pipeline has been tested only with a [Structure Sensor](https://structure.io/structure-sensor-pro), but we think other sensors may be used. |
6 | 6 |
|
7 | | -```bash |
8 | | -pip install -r requirements.txt |
9 | | -``` |
10 | | - |
11 | | -We also provide a conda environment file that you can try to use. The |
12 | | -environment was created on Ubuntu, so it will likely not work on other |
13 | | -operating systems. You can install the environment from the conda environment |
14 | | -file with |
| 7 | +Headcases can be generated for the following head coils: |
| 8 | +- Siemens 32 channel |
| 9 | +- Siemens 64 channel |
| 10 | +- Nova 32 channel |
15 | 11 |
|
16 | | -```bash |
17 | | -conda env create -f conda-environment.yml --name headcase |
18 | | -``` |
| 12 | +The pipeline is written in Python and uses [MeshLab](https://www.meshlab.net/) and [Blender](https://www.blender.org/). |
19 | 13 |
|
20 | | -In addition, the code requires |
21 | | - |
22 | | -- Blender 2.7.9. **Do not use newer versions of Blender. The code will not work.** |
23 | | -- Meshlab (the code works with meshlab 1.3.2 and it has not been tested with other versions) |
24 | 14 |
|
25 | 15 | ## Usage |
26 | 16 |
|
27 | | -You need to use a structure sensor to generate a head model of the subject. Use the iOS app to send the model over email. Save the `Model.zip` file, then use `make_headcase.py` as |
| 17 | +The basic [Structure Scanner iOS app](https://apps.apple.com/us/app/scanner-structure-sdk/id891169722) can be used to scan a 3D model of the participant's head. For recommendations on how to scan the participant's head, see [this document](docs/glab_headcase_pipeline.md). From the Scanner app, the 3D model file (`Model.zip`) will need to be sent to an email address. |
| 18 | + |
| 19 | +The pipeline can then be used to generate a headcase with |
28 | 20 |
|
29 | 21 | ```bash |
30 | 22 | python make_headcase.py Model.zip Headcase.zip --headcoil s32 |
31 | 23 | ``` |
32 | 24 |
|
33 | | -This will generate a headcase model split into four parts and zipped in `Headcase.zip`. It is possible to generate headcases for the Siemens 32ch head-coil (`--headcoil s32`), Siemens 64ch head-coil (`--headcoil s64`), or Nova 32ch head-coil (`--headcoil n32`). |
| 25 | +Several options are available, including whether the headcase should be split in two parts (front and back) or in four parts (front-top, front-bottom, back-top, back-bottom). Four parts (the default) can be printed more easily on most 3D printers, but they might require gluing together the top and bottom parts. To see all options, run |
| 26 | + |
| 27 | +```bash |
| 28 | +python make_headcases.py --help |
| 29 | +``` |
| 30 | + |
| 31 | +## Running with Docker |
34 | 32 |
|
35 | | -### Running with docker |
| 33 | +We recommend running the pipeline with the Dockerfile provided in this repository. |
36 | 34 |
|
37 | | -We provide a Dockerfile to generate an image with all dependencies. Create the image with |
| 35 | +First, the docker image needs to be built. |
38 | 36 |
|
39 | 37 | ```bash |
40 | 38 | docker build --tag caseforge . |
41 | 39 | ``` |
42 | 40 |
|
43 | | -then you can run the pipeline as |
| 41 | +Then, the pipeline can be run with |
44 | 42 |
|
45 | 43 | ```bash |
46 | 44 | docker run --rm caseforge:latest --help |
47 | 45 | ``` |
48 | 46 |
|
49 | | -To let docker see the folder with the head model, you will have to bind the folder inside the container. For example, if the head model is in `/tmp/test-headcase/model.zip`, you would run the following command |
| 47 | +To let docker see the folder containing the head 3D model, you will have to bind the folder inside the container. For example, if the head model is in `/tmp/test-headcase/model.zip`, the following command should be run |
50 | 48 |
|
51 | 49 | ```bash |
52 | 50 | docker run -v /tmp:/tmp --rm caseforge:latest /tmp/test-headcase/model.zip /tmp/test-headcase/case.zip |
53 | 51 | ``` |
| 52 | + |
| 53 | +## Manual installation |
| 54 | + |
| 55 | +Python requirements are listed under `requirements.txt`, and can be installed with |
| 56 | + |
| 57 | +```bash |
| 58 | +pip install -r requirements.txt |
| 59 | +``` |
| 60 | + |
| 61 | +We also provide a conda environment file. The environment was created on Ubuntu, so it might not work on other operating systems. |
| 62 | +The environment can be installed with |
| 63 | + |
| 64 | +```bash |
| 65 | +conda env create -f conda-environment.yml --name headcase |
| 66 | +``` |
| 67 | + |
| 68 | +The pipeline also requires |
| 69 | + |
| 70 | +- Blender 2.7.9 (**Do not use newer versions of Blender, or the pipeline won't work.**) |
| 71 | +- MeshLab 1.3.2 (**The pipeline has been tested only with this version.**) |
0 commit comments