Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christoph Arthofer
ms_templates
Commits
955bf978
Commit
955bf978
authored
Dec 16, 2021
by
Christoph Arthofer
Browse files
Changed masking to mean and threshold to 0.5
parent
2f0be14e
Changes
1
Hide whitespace changes
Inline
Side-by-side
run_template_construction.py
View file @
955bf978
...
...
@@ -17,12 +17,11 @@ import sys
from
fsl.wrappers
import
fslmaths
,
flirt
,
applyxfm
,
concatxfm
,
bet
,
fast
,
fslstats
from
fsl.wrappers.fnirt
import
invwarp
,
applywarp
,
convertwarp
from
file_tree
import
FileTree
from
fsl.utils.fslsub
import
func_to_cmd
from
operator
import
itemgetter
import
tempfile
import
argparse
from
fsl.utils.fslsub
import
func_to_cmd
import
fsl_sub
import
logging
def
writeConfig
(
step
,
mod
,
fpath
):
"""! Writes the nonlinear registration parameters for a given resolution level and modalities to a file readable by MMORF.
...
...
@@ -535,19 +534,19 @@ def submitJob(command, name, log_dir, queue, wait_for=None, array_task=False, co
hold_ids
.
append
(
job_id
)
job_id
=
fsl_sub
.
submit
(
command
=
command
,
array_task
=
array_task
,
jobhold
=
hold_ids
,
name
=
name
,
logdir
=
log_dir
,
queue
=
queue
,
coprocessor
=
coprocessor
,
coprocessor_class
=
coprocessor_class
,
coprocessor_class_strict
=
coprocessor_class_strict
,
coprocessor_multi
=
coprocessor_multi
,
threads
=
threads
,
export_vars
=
export_var
,
jobram
=
jobram
,
jobtime
=
jobtime
array_task
=
array_task
,
jobhold
=
hold_ids
,
name
=
name
,
logdir
=
log_dir
,
queue
=
queue
,
coprocessor
=
coprocessor
,
coprocessor_class
=
coprocessor_class
,
coprocessor_class_strict
=
coprocessor_class_strict
,
coprocessor_multi
=
coprocessor_multi
,
threads
=
threads
,
export_vars
=
export_var
,
jobram
=
jobram
,
jobtime
=
jobtime
)
return
str
(
job_id
)
...
...
@@ -814,8 +813,6 @@ def mmorfWrapper(mmorf_run_cmd, config_path, img_warp_space,
if
__name__
==
"__main__"
:
"""! Main function submitting the jobs.
"""
logging
.
basicConfig
()
logging
.
getLogger
(
'fsl.wrappers'
).
setLevel
(
logging
.
DEBUG
)
mni_path
=
os
.
getenv
(
'FSLDIR'
)
+
'/data/standard/MNI152lin_T1_1mm_brain.nii.gz'
identity_path
=
os
.
getenv
(
'FSLDIR'
)
+
'/etc/flirtsch/ident.mat'
...
...
@@ -900,7 +897,7 @@ if __name__ == "__main__":
jobram_low
=
4
jobram_hi
=
12
jobtime_low
=
15
jobtime_low
=
20
jobtime_high
=
60
job_ids
=
[
''
for
_
in
range
(
100
)]
...
...
@@ -955,7 +952,7 @@ if __name__ == "__main__":
tree
=
tree
.
update
(
sub_id
=
id
)
T1_head_path
=
tree
.
get
(
mod
[
'T1_head_key'
])
T1_clamped_path
=
tree
.
get
(
'T1_head_clamped'
,
make_dir
=
True
)
T1_clamped_hard_path
=
tree
.
get
(
'T1_head_clamped_hard'
)
T1_clamped_hard_path
=
tree
.
get
(
'T1_head_clamped_hard'
,
make_dir
=
True
)
jobcmd
=
func_to_cmd
(
run_soft_clamp
,
args
=
(
T1_head_path
,
T1_clamped_path
),
...
...
@@ -1305,7 +1302,7 @@ if __name__ == "__main__":
print
(
'submitted: '
+
task_name
)
task_name
=
'{:03d}_affT_create_weighted_brain_mask'
.
format
(
task_count
)
jobcmd
=
'fslmaths '
+
aff_template_path
+
' -thr 0.
1
-bin -mul 7 -add 1 -inm 1 '
+
tree
.
get
(
'T1_brain_mask_weighted_affine_template'
)
jobcmd
=
'fslmaths '
+
aff_template_path
+
' -thr 0.
5
-bin -mul 7 -add 1 -inm 1 '
+
tree
.
get
(
'T1_brain_mask_weighted_affine_template'
)
# job_ids[23] = submitJob(tag+'_'+task_name, log_dir, command=jobcmd, queue=cpuq, wait_for=[job_ids[22]])
job_ids
[
23
]
=
submitJob
(
jobcmd
,
tag
+
'_'
+
task_name
,
log_dir
,
queue
=
cpuq
,
wait_for
=
[
job_ids
[
22
]],
array_task
=
False
,
jobram
=
jobram_low
,
jobtime
=
jobtime_low
)
print
(
'submitted: '
+
task_name
)
...
...
@@ -1854,7 +1851,7 @@ if __name__ == "__main__":
img_paths
.
append
(
tree
.
get
(
'warped_T1brain_mask'
))
nln_template_path
=
tree
.
get
(
'T1_brain_mask_nln_template'
)
jobcmd
=
func_to_cmd
(
averageImages
,
args
=
(
img_paths
,
nln_template_path
,
'
intersectio
n'
,
False
),
tmp_dir
=
script_dir
,
jobcmd
=
func_to_cmd
(
averageImages
,
args
=
(
img_paths
,
nln_template_path
,
'
mea
n'
,
False
),
tmp_dir
=
script_dir
,
kwargs
=
None
,
clean
=
"never"
)
# job_ids[49] = submitJob(tag+'_'+task_name, log_dir, command=jobcmd, queue=cpuq, wait_for=[job_ids[38]])
job_ids
[
49
]
=
submitJob
(
jobcmd
,
tag
+
'_'
+
task_name
,
log_dir
,
queue
=
cpuq
,
wait_for
=
[
job_ids
[
38
]],
array_task
=
False
,
jobram
=
jobram_low
,
jobtime
=
jobtime_low
)
...
...
@@ -1862,7 +1859,7 @@ if __name__ == "__main__":
task_count
+=
1
task_name
=
'{:03d}_nlnT_average_T1_brain_mask_weighted'
.
format
(
task_count
)
jobcmd
=
'fslmaths '
+
nln_template_path
+
' -thr 0.
1
-bin -mul 7 -add 1 -inm 1 '
+
tree
.
get
(
jobcmd
=
'fslmaths '
+
nln_template_path
+
' -thr 0.
5
-bin -mul 7 -add 1 -inm 1 '
+
tree
.
get
(
'T1_brain_mask_weighted_nln_template'
)
# job_ids[50] = submitJob(tag+'_'+task_name, log_dir, command=jobcmd, queue=cpuq, wait_for=[job_ids[49]])
job_ids
[
50
]
=
submitJob
(
jobcmd
,
tag
+
'_'
+
task_name
,
log_dir
,
queue
=
cpuq
,
wait_for
=
[
job_ids
[
49
]],
array_task
=
False
,
jobram
=
jobram_low
,
jobtime
=
jobtime_low
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment