-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #804 from NeuroDesk/synthstrip
Added synthstrip 7.4.1
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
---------------------------------- | ||
## synthstrip/toolVersion## | ||
|
||
SynthStrip is a skull-stripping tool that extracts brain voxels from a landscape of image types, ranging across imaging modalities, resolutions, and subject populations. It leverages a deep learning strategy to synthesize arbitrary training images from segmentation maps, yielding a robust model agnostic to acquisition specifics. | ||
|
||
**Citation:** SynthStrip: Skull-Stripping for Any Brain Image Andrew Hoopes, Jocelyn S. Mora, Adrian V. Dalca, Bruce Fischl*, Malte Hoffmann* (*equal contribution) NeuroImage 260, 2022, 119474 https://doi.org/10.1016/j.neuroimage.2022.119474 | ||
|
||
**Homepage:** https://surfer.nmr.mgh.harvard.edu/docs/synthstrip/ | ||
|
||
**Example:** `mri_synthstrip` | ||
|
||
**License:** FreeSurfer Software License Agreement | ||
|
||
---------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
export toolName='synthstrip' | ||
export toolVersion='7.4.1' | ||
|
||
if [ "$1" != "" ]; then | ||
echo "Entering Debug mode" | ||
export debug=$1 | ||
fi | ||
|
||
source ../main_setup.sh | ||
|
||
# Use Singlrity/Apptainer to run TinyRange to generate the rootfs. | ||
singularity run -B /storage:/storage docker://ghcr.io/tinyrange/tinyrange:stable build synthstrip.star:synthstrip_root -o synthstrip.tar | ||
|
||
# Make sure the automaticcly included template doesn't add to the final layer. | ||
neurodocker generate ${neurodocker_buildMode} \ | ||
--base-image ubuntu \ | ||
--pkg-manager apt \ | ||
--base-image scratch \ | ||
--add synthstrip.tar . \ | ||
--run "/init -run-scripts /.pkg/scripts.json" \ | ||
--run "/init -run-scripts /wheels/scripts.json" \ | ||
--run="printf '#!/bin/bash\nls -la' > /usr/bin/ll" \ | ||
--run="chmod +x /usr/bin/ll" \ | ||
--run="mkdir -p ${mountPointList}" \ | ||
--env FREESURFER_HOME=/freesurfer \ | ||
--run="ln -s /usr/bin/python3 /usr/bin/python" \ | ||
--entrypoint "/bin/bash" \ | ||
--env DEPLOY_BINS=mri_synthstrip \ | ||
--copy README.md /README.md \ | ||
> ${imageName}.${neurodocker_buildExt} | ||
|
||
if [ "$1" != "" ]; then | ||
./../main_build.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
load("//lib/pypi.star", "build_fs_for_requirements") | ||
|
||
requirements = "https://surfer.nmr.mgh.harvard.edu/docs/synthstrip/requirements/requirements.txt" | ||
|
||
files = [ | ||
"https://github.com/freesurfer/freesurfer/raw/v7.4.1/mri_synthstrip/mri_synthstrip", | ||
"https://surfer.nmr.mgh.harvard.edu/docs/synthstrip/requirements/synthstrip.1.pt", | ||
"https://surfer.nmr.mgh.harvard.edu/docs/synthstrip/requirements/synthstrip.nocsf.1.pt", | ||
] | ||
|
||
base = define.plan( | ||
builder = "ubuntu@jammy", | ||
packages = [ | ||
query("python3-pip"), | ||
query("python3-packaging"), | ||
], | ||
tags = ["level3", "defaults"], | ||
) | ||
|
||
requirements_fs = build_fs_for_requirements(base, define.fetch_http(requirements)) | ||
|
||
def synthstrip_fs(ctx, script, data_1, data_2): | ||
ret = filesystem() | ||
|
||
ret["usr/bin/mri_synthstrip"] = file(script, executable = True) | ||
|
||
ret["freesurfer/models/synthstrip.1.pt"] = data_1 | ||
ret["freesurfer/models/synthstrip.nocsf.1.pt"] = data_2 | ||
|
||
return ctx.archive(ret) | ||
|
||
synthstrip_root = define.build_fs([ | ||
base.set_tags([ | ||
"level3", | ||
"defaults", | ||
"noScripts", | ||
]), | ||
requirements_fs, | ||
define.build(synthstrip_fs, *[define.fetch_http(file) for file in files]), | ||
directive.builtin("init", "/init"), | ||
], "tar") |