Skip to content

Commit c13720f

Browse files
authored
MAINT: Address various pain points (#159)
* MAINT: Preload some MNIInfant templates * MAINT: Update git-annex version * MAINT: Ensure required data is packaged * MAINT: Prefetch MNIInfant brain masks * FIX: Avoid requiring service when checking wrapper version
1 parent 8289ade commit c13720f

File tree

6 files changed

+82
-4
lines changed

6 files changed

+82
-4
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca
3838
RUN apt-get update && \
3939
apt-get install -y --no-install-recommends \
4040
connectome-workbench=1.5.0-1~nd20.04+1 \
41-
git-annex-standalone=8.20210903-1~ndall+1 && \
41+
git-annex-standalone=8.20211123+git12-g02e3756bd-1~ndall+1 && \
4242
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
4343

4444
# Installing ANTs 2.3.4 (NeuroDocker build)

nibabies/data/flirtsch/bbr.sch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# 1mm scale
2+
setscale 1 force
3+
setoption costfunction bbr
4+
setoption optimisationtype brent
5+
setoption tolerance 0.0005 0.0005 0.0005 0.02 0.02 0.02 0.002 0.002 0.002 0.001 0.001 0.001
6+
#setoption tolerance 0.005 0.005 0.005 0.2 0.2 0.2 0.02 0.02 0.02 0.01 0.01 0.01
7+
setoption boundguess 1
8+
setoption bbrstep 200
9+
clear UA
10+
clear UU
11+
clear UV
12+
clear U
13+
setrowqsform UU
14+
setrow UU 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
15+
measurecost 6 UU:1-2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
16+
gridmeasurecost 6 UU:1-2 -0.07 0.07 0.07 -0.07 0.07 0.07 -0.07 0.07 0.07 -4.0 4.0 4.0 -4.0 4.0 4.0 -4.0 4.0 4.0 0.0 0.0 0.0 abs 8
17+
sort U
18+
copy U UA
19+
clear U
20+
optimise 6 UA:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
21+
setoption optimisationtype powell
22+
optimise 6 U:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
23+
setoption optimisationtype brent
24+
optimise 6 U:2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 4
25+
sort U
26+
setoption tolerance 0.0002 0.0002 0.0002 0.02 0.02 0.02 0.002 0.002 0.002 0.001 0.001 0.001
27+
setoption bbrstep 2
28+
clear UU
29+
copy U UU
30+
clear U
31+
gridmeasurecost 6 UU:1 -0.0017 0.0017 0.0017 -0.0017 0.0017 0.0017 -0.0017 0.0017 0.0017 -0.1 0.1 0.1 -0.1 0.1 0.1 -0.1 0.1 0.1 0.0 0.0 0.0 abs 8
32+
sort U
33+
clear UB
34+
copy U UB
35+
clear U
36+
setoption optimisationtype brent
37+
optimise 6 UB:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
38+
setoption optimisationtype powell
39+
optimise 12 U:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
40+
setoption optimisationtype brent
41+
optimise 12 U:2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 4
42+
sort U
43+
print U:1
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Insight Transform File V1.0
2+
#Transform 0
3+
Transform: MatrixOffsetTransformBase_double_3_3
4+
Parameters: 1 0 0 0 1 0 0 0 1 0 0 0
5+
FixedParameters: 0 0 0

scripts/fetch_templates.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,27 @@ def fetch_fsLR():
7070
tf.get('fsLR', density='32k')
7171

7272

73+
def fetch_MNIInfant(cohort=1):
74+
"""
75+
Expected templates:
76+
77+
tpl-MNIInfant/cohort-1/tpl-MNIInfant_cohort-1_res-1_T1w.nii.gz
78+
tpl-MNIInfant/cohort-1/tpl-MNIInfant_cohort-1_res-2_T1w.nii.gz
79+
tpl-MNIInfant/cohort-1/tpl-MNIInfant_cohort-1_res-1_desc-brain_mask.nii.gz
80+
tpl-MNIInfant/cohort-1/tpl-MNIInfant_cohort-1_res-2_desc-brain_mask.nii.gz
81+
"""
82+
template = 'MNIInfant'
83+
84+
tf.get(template, cohort=cohort, suffix="T1w")
85+
tf.get(template, cohort=cohort, suffix="mask")
86+
87+
7388
def main():
7489
fetch_MNI6()
7590
fetch_UNCInfant()
7691
fetch_fsaverage()
7792
fetch_fsLR()
93+
fetch_MNIInfant()
7894

7995

8096
if __name__ == "__main__":

setup.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ console_scripts =
4444
[options.package_data]
4545
nibabies =
4646
data/*.json
47+
data/*.nii.gz
48+
data/*.mat
49+
data/*.txt
50+
data/boilerplate.bib
51+
data/itkIdentityTransform.txt
52+
data/flirtsch/bbr.sch
53+
data/reports-spec.yml
54+
data/tests/config.toml
55+
VERSION
4756

4857
[options.packages.find]
4958
exclude =

wrapper/nibabies_wrapper.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def _is_file(path, parser):
360360
IsFile = partial(_is_file, parser=parser)
361361

362362
# require users to specify container service
363-
parser.add_argument("service", choices=("docker", "singularity"))
363+
parser.add_argument("service", nargs="?", choices=("docker", "singularity"))
364364
# Standard NiBabies arguments
365365
parser.add_argument("bids_dir", nargs="?", type=os.path.abspath, default="")
366366
parser.add_argument("output_dir", nargs="?", type=os.path.abspath, default="")
@@ -525,9 +525,14 @@ def main():
525525
# Capture additional arguments to pass inside container
526526
opts, unknown_args = parser.parse_known_args()
527527

528+
if opts.version:
529+
print("nibabies wrapper {!s}".format(__version__))
530+
return
531+
528532
# Set help if no directories set
529-
if (opts.bids_dir, opts.output_dir, opts.version) == ("", "", False):
530-
opts.help = True
533+
if not all((opts.service, opts.bids_dir, opts.output_dir)):
534+
parser.print_help()
535+
return 1
531536

532537
container = ContainerManager(opts.service, image=opts.image)
533538
check = container.check_install()

0 commit comments

Comments
 (0)