Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BIP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
BIP
Commits
eef1d636
Commit
eef1d636
authored
2 years ago
by
Fidel Alfaro Almagro
Browse files
Options
Downloads
Patches
Plain Diff
Fixing bugs in T1_brain_extract and dMRI_diff package
parent
44aea013
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bip/data/FileTree.tree
+2
-2
2 additions, 2 deletions
bip/data/FileTree.tree
bip/pipelines/dMRI_diff/__init__.py
+1
-1
1 addition, 1 deletion
bip/pipelines/dMRI_diff/__init__.py
bip/pipelines/struct_T1/T1_brain_extract.py
+13
-9
13 additions, 9 deletions
bip/pipelines/struct_T1/T1_brain_extract.py
with
16 additions
and
12 deletions
bip/data/FileTree.tree
LFS
+
2
−
2
View file @
eef1d636
No preview for this file type
This diff is collapsed.
Click to expand it.
bip/pipelines/dMRI_diff/__init__.py
+
1
−
1
View file @
eef1d636
...
...
@@ -52,5 +52,5 @@ def add_to_pipeline(ctx, pipe, tree):
submit
=
cuda_bedpostx_dict
,
kwargs
=
{
'
ctx
'
:
ctx
})
pipe
(
diff_autoptx
.
run
,
submit
=
dict
(
jobtime
=
200
,
name
=
job_name
(
diff_
bedpos
tx
.
run
,
subj
)),
submit
=
dict
(
jobtime
=
200
,
name
=
job_name
(
diff_
autop
tx
.
run
,
subj
)),
kwargs
=
{
'
ctx
'
:
ctx
})
This diff is collapsed.
Click to expand it.
bip/pipelines/struct_T1/T1_brain_extract.py
+
13
−
9
View file @
eef1d636
...
...
@@ -34,7 +34,6 @@ def run(ctx,
logs_dir
:
Ref
,
T1
:
Ref
,
tmp_dir
:
Ref
,
tmp_T1_prefix
:
Ref
,
T1_orig_to_MNI_warp
:
Out
,
T1_orig_ud_to_std_mat
:
Out
,
T1_to_MNI_warp_coef
:
Out
,
...
...
@@ -48,17 +47,20 @@ def run(ctx,
T1_tmp_1_brain
=
op
.
join
(
tmp_dir
,
'
T1_tmp_1_brain.nii.gz
'
)
T1_tmp_orig_ud_to_std_mat
=
op
.
join
(
tmp_dir
,
'
T1_tmp_to_std.mat
'
)
T1_tmp
=
op
.
join
(
tmp_dir
,
'
T1.nii.gz
'
)
T1_tmp_prefix
=
op
.
join
(
tmp_dir
,
'
T1
'
)
#Calculate where does the brain start in the z dimension and extract the roi
head_top
=
int
(
round
(
float
(
wrappers
.
robustfov
(
T1_orig_ud
).
stdout
[
0
].
split
()[
7
])))
wrappers
.
fslmaths
(
T1_orig_ud
).
roi
(
0
,
-
1
,
0
,
-
1
,
head_top
,
170
,
0
,
1
,).
run
(
T1_tmp_1
)
#Calculate where does the brain start in the z dimension and extract roi
head_top
=
int
(
round
(
float
(
wrappers
.
robustfov
(
T1_orig_ud
).
stdout
[
0
].
\
split
()[
7
])))
wrappers
.
fslmaths
(
T1_orig_ud
).
roi
(
0
,
-
1
,
0
,
-
1
,
head_top
,
170
,
0
,
1
,).
\
run
(
T1_tmp_1
)
#Run a (Recursive) brain extraction on the roi
wrappers
.
bet
(
T1_tmp_1
,
T1_tmp_1_brain
,
robust
=
True
)
#Reduce the FOV of T1_orig_ud by calculating a registration
#from T1_tmp_brain to ssref and apply it to T1_orig_ud
wrappers
.
standard_space_roi
(
T1_tmp_1_brain
,
tmp
_T1
_prefix
,
maskNONE
=
True
,
wrappers
.
standard_space_roi
(
T1_tmp_1_brain
,
T1_
tmp_prefix
,
maskNONE
=
True
,
ssref
=
ctx
.
MNI
+
'
_brain
'
,
altinput
=
T1_orig_ud
,
d
=
True
)
copyfile
(
src
=
T1_tmp
,
dst
=
T1
)
...
...
@@ -72,7 +74,7 @@ def run(ctx,
wrappers
.
concatxfm
(
atob
=
T1_to_T1_orig_ud_mat
,
btoc
=
T1_orig_ud_to_std_mat
,
atoc
=
T1_to_MNI_linear_mat
)
#Non
-
linear registration to MNI using the previously calculated alignment
#Nonlinear registration to MNI using the previously calculated alignment
wrappers
.
fnirt
(
src
=
T1
,
ref
=
ctx
.
MNI
,
aff
=
T1_to_MNI_linear_mat
,
config
=
ctx
.
get_data
(
'
fnirt/bb_fnirt.cnf
'
),
refmask
=
ctx
.
get_data
(
'
MNI/MNI152_T1_1mm_brain_mask_dil_GD7.nii.gz
'
),
...
...
@@ -81,10 +83,11 @@ def run(ctx,
jout
=
T1_to_MNI_warp_jac
,
iout
=
T1_tmp_2
,
interp
=
'
spline
'
)
#Combine all transforms (Gradient Distortion Unwarp and T1 to ctx.MNI)
into one
#Combine all transforms (Gradient Distortion Unwarp and T1 to ctx.MNI)
if
ctx
.
gdc
!=
''
:
wrappers
.
convertwarp
(
ref
=
ctx
.
MNI
,
warp1
=
T1_orig_ud_warp
,
midmat
=
T1_orig_ud_to_T1_mat
,
warp2
=
T1_to_MNI_warp
,
midmat
=
T1_orig_ud_to_T1_mat
,
warp2
=
T1_to_MNI_warp
,
out
=
T1_orig_to_MNI_warp
)
else
:
wrappers
.
convertwarp
(
ref
=
ctx
.
MNI
,
premat
=
T1_orig_ud_to_T1_mat
,
...
...
@@ -102,4 +105,5 @@ def run(ctx,
w
=
T1_to_MNI_warp_coef_inv
,
out
=
T1_brain_mask
,
rel
=
True
,
interp
=
'
trilinear
'
)
wrappers
.
fslmaths
(
T1
).
mul
(
T1_brain_mask
).
run
(
T1_brain
)
wrappers
.
fslmaths
(
T1_brain_to_MNI
).
mul
(
ctx
.
get_data
(
MNI_var_name
)).
run
(
T1_brain_to_MNI
)
wrappers
.
fslmaths
(
T1_brain_to_MNI
).
mul
(
ctx
.
get_data
(
MNI_var_name
)).
\
run
(
T1_brain_to_MNI
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment