@figo2150
2020-07-08T10:30:41.000000Z
字数 1656
阅读 977
创建:2020-07-08 by 叶辰飞
brainlabel
docker
原理说明:算法基本原理是利用多脑图谱进行图像配准与融合,实现对目标磁共振T1加权脑影像的自动脑区分割。Brainlabel官网
说明:Pipeline可大致分为图谱预选(atlas preselection)和分割(segmentation/parcellation)两步,分别制作了镜像文件
task_json
和t1_segmt
。
task_json.tar.gz
docker load -i task_json.tar.gz
t1_segmt.tar.gz
docker load -i t1_segmt.tar.gz
在跑pipeline之前需在run_atlas_preselection.csv
手动定义任务信息,每一行对应每一个分割任务。
CSV文件中:
- targetT1W_path
: 即每一个被试的T1W影像文件的本地路径
- gender_F0M1U2
: 被试性别。0=女;1=男;2=unknown
- age
: 年龄。若年龄未知可以为空,预选时默认作为60岁处理。
- output_folder
:每一个被试对应的输出文件夹的名字,可以任意定义,但不同被试不能重复定义
task.json
定义了分割算法需要的基本配置信息,输入与输出目录信息,以及从图谱库中预选出30个和目标被试具有相似人口学特征(年龄性别)的图谱,是后续分割pipeline需要的唯一参数文件。
docker run -v YourLocalPath:/data/ task_json:v1.6 python /bin/preselect_docker.py -i /data/run_atlas_preselection.csv -o /data/
其中,YourLocalPath是本地run_atlas_preselection.csv
文件的存放目录
容器跑完后,会在YourLocalPath生成每个被试的task.json文件
docker run -v YourLocalV1AtlasesPath:/data/atlases -v YourLocalTaskJsonPath/:/tmp -v YourInputT1WPath:/mnt/input -v YourOutputPath:/mnt/output -v YourConfigPath:/mnt/config brainlabel/t1_segmt:v1 /tmp/task.json
该命令将针对单个指定被试实现脑区自动分割,同时利用本地多核CPU并行运算,-v
操作将本地路径挂载给容器路径,运行前建议检查挂载路径与task.json
中存放的路径内容一致。以下详细解释每个目录:
YourLocalV1AtlasesPath
:如/home/mindsgo/atlases 该路径存放了V1图谱,容器将在本地找到/home/mindsgo/atlases/v1/YourLocalTaskJsonPath
: 如/home/mindsgo/input/sub1 该路径存放了task.json
,容器将在本地找到/home/mindsgo/input/sub1/task.jsonYourInputT1WPath
:如/home/mindsgo/Documents/ 该路径存放了输入文件,如sub1.nii
,容器将在本地找到/home/mindsgo/Documents/sub1.niiYourConfigPath
:如/home/mindsgo/PycharmProjects/P1/pipeline_config 该路径是pipeline_config
文件夹的本地绝对路径YourOutputPath
:如/home/mindsgo/output 容器将把输出的分割结果挂载到该本地路径TBD...