Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
clinica
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aramislab
clinica
Commits
1ce6fdf2
Commit
1ce6fdf2
authored
Jan 09, 2018
by
Junhao WEN
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
6abdde16
3c948107
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
71 deletions
+76
-71
dwi_preprocessing_using_phasediff_fieldmap_pipeline.py
...ap/dwi_preprocessing_using_phasediff_fieldmap_pipeline.py
+0
-0
dwi_preprocessing_using_phasediff_fieldmap_workflows.py
...p/dwi_preprocessing_using_phasediff_fieldmap_workflows.py
+44
-44
dwi_preprocessing_using_t1_pipeline.py
...rocessing_using_t1/dwi_preprocessing_using_t1_pipeline.py
+25
-27
dwi_processing_dti_cli.py
...ca/pipelines/dwi_processing_dti/dwi_processing_dti_cli.py
+7
-0
dwi_processing_dti_pipeline.py
...pelines/dwi_processing_dti/dwi_processing_dti_pipeline.py
+0
-0
No files found.
clinica/pipelines/dwi_preprocessing_using_phasediff_fieldmap/dwi_preprocessing_using_phasediff_fieldmap_pipeline.py
View file @
1ce6fdf2
This diff is collapsed.
Click to expand it.
clinica/pipelines/dwi_preprocessing_using_phasediff_fieldmap/dwi_preprocessing_using_phasediff_fieldmap_workflows.py
View file @
1ce6fdf2
...
...
@@ -166,62 +166,62 @@ def susceptibility_distortion_correction_using_phasediff_fmap(
wf
=
pe
.
Workflow
(
name
=
name
)
wf
.
connect
([
(
inputnode
,
fsl_dir
,
[(
'phase_encoding_direction'
,
'bids_dir'
)]),
(
inputnode
,
pha2rads
,
[(
'in_fmap_phasediff'
,
'in_file'
)]),
(
inputnode
,
get_b0
,
[(
'in_dwi'
,
'in_file'
)]),
(
inputnode
,
first_mag
,
[(
'in_fmap_magnitude'
,
'in_file'
)]),
(
first_mag
,
n4
,
[(
'roi_file'
,
'input_image'
)]),
(
n4
,
bet
,
[(
'output_image'
,
'in_file'
)]),
(
bet
,
dilate
,
[(
'mask_file'
,
'in_file'
)]),
(
pha2rads
,
prelude
,
[(
'out_file'
,
'phase_file'
)]),
(
n4
,
prelude
,
[(
'output_image'
,
'magnitude_file'
)]),
(
dilate
,
prelude
,
[(
'out_file'
,
'mask_file'
)]),
(
prelude
,
rad2rsec
,
[(
'unwrapped_phase_file'
,
'in_file'
)]),
(
inputnode
,
rad2rsec
,
[(
'delta_echo_time'
,
'delta_te'
)]),
(
inputnode
,
fsl_dir
,
[(
'phase_encoding_direction'
,
'bids_dir'
)]),
# noqa
(
inputnode
,
pha2rads
,
[(
'in_fmap_phasediff'
,
'in_file'
)]),
# noqa
(
inputnode
,
get_b0
,
[(
'in_dwi'
,
'in_file'
)]),
# noqa
(
inputnode
,
first_mag
,
[(
'in_fmap_magnitude'
,
'in_file'
)]),
# noqa
(
first_mag
,
n4
,
[(
'roi_file'
,
'input_image'
)]),
# noqa
(
n4
,
bet
,
[(
'output_image'
,
'in_file'
)]),
# noqa
(
bet
,
dilate
,
[(
'mask_file'
,
'in_file'
)]),
# noqa
(
pha2rads
,
prelude
,
[(
'out_file'
,
'phase_file'
)]),
# noqa
(
n4
,
prelude
,
[(
'output_image'
,
'magnitude_file'
)]),
# noqa
(
dilate
,
prelude
,
[(
'out_file'
,
'mask_file'
)]),
# noqa
(
prelude
,
rad2rsec
,
[(
'unwrapped_phase_file'
,
'in_file'
)]),
# noqa
(
inputnode
,
rad2rsec
,
[(
'delta_echo_time'
,
'delta_te'
)]),
# noqa
])
if
register_fmap_on_b0
:
wf
.
connect
([
(
get_b0
,
fmm2b0
,
[(
'roi_file'
,
'fixed_image'
)]),
(
n4
,
fmm2b0
,
[(
'output_image'
,
'moving_image'
)]),
(
inputnode
,
fmm2b0
,
[(
'in_mask'
,
'fixed_image_mask'
)]),
(
dilate
,
fmm2b0
,
[(
'out_file'
,
'moving_image_mask'
)]),
(
get_b0
,
apply_xfm
,
[(
'roi_file'
,
'reference_image'
)]),
(
rad2rsec
,
apply_xfm
,
[(
'out_file'
,
'input_image'
)]),
(
fmm2b0
,
apply_xfm
,
[(
'forward_transforms'
,
'transforms'
),
(
'forward_invert_flags'
,
'invert_transform_flags'
)]),
(
apply_xfm
,
pre_fugue
,
[(
'output_image'
,
'fmap_in_file'
)]),
(
inputnode
,
pre_fugue
,
[(
'in_mask'
,
'mask_file'
)]),
(
get_b0
,
fmm2b0
,
[(
'roi_file'
,
'fixed_image'
)]),
# noqa
(
n4
,
fmm2b0
,
[(
'output_image'
,
'moving_image'
)]),
# noqa
(
inputnode
,
fmm2b0
,
[(
'in_mask'
,
'fixed_image_mask'
)]),
# noqa
(
dilate
,
fmm2b0
,
[(
'out_file'
,
'moving_image_mask'
)]),
# noqa
(
get_b0
,
apply_xfm
,
[(
'roi_file'
,
'reference_image'
)]),
# noqa
(
rad2rsec
,
apply_xfm
,
[(
'out_file'
,
'input_image'
)]),
# noqa
(
fmm2b0
,
apply_xfm
,
[(
'forward_transforms'
,
'transforms'
),
# noqa
(
'forward_invert_flags'
,
'invert_transform_flags'
)]),
# noqa
(
apply_xfm
,
pre_fugue
,
[(
'output_image'
,
'fmap_in_file'
)]),
# noqa
(
inputnode
,
pre_fugue
,
[(
'in_mask'
,
'mask_file'
)]),
# noqa
(
apply_xfm
,
outputnode
,
[(
'output_image'
,
'out_prepared_fmap'
)])
# noqa
])
else
:
wf
.
connect
([
(
get_b0
,
res_fmap
,
[(
'roi_file'
,
'in_b0'
)]),
(
rad2rsec
,
res_fmap
,
[(
'out_file'
,
'in_fmap'
)]),
(
res_fmap
,
pre_fugue
,
[(
'out_resampled_fmap'
,
'fmap_in_file'
)]),
(
inputnode
,
pre_fugue
,
[(
'in_mask'
,
'mask_file'
)]),
(
get_b0
,
res_fmap
,
[(
'roi_file'
,
'in_b0'
)]),
# noqa
(
rad2rsec
,
res_fmap
,
[(
'out_file'
,
'in_fmap'
)]),
# noqa
(
res_fmap
,
pre_fugue
,
[(
'out_resampled_fmap'
,
'fmap_in_file'
)]),
# noqa
(
inputnode
,
pre_fugue
,
[(
'in_mask'
,
'mask_file'
)]),
# noqa
(
res_fmap
,
outputnode
,
[(
'out_resampled_fmap'
,
'out_prepared_fmap'
)])
# noqa
])
wf
.
connect
([
(
pre_fugue
,
demean
,
[(
'fmap_out_file'
,
'in_file'
)]),
(
inputnode
,
demean
,
[(
'in_mask'
,
'in_mask'
)]),
(
demean
,
cleanup
,
[(
'out_file'
,
'inputnode.in_file'
)]),
(
inputnode
,
cleanup
,
[(
'in_mask'
,
'inputnode.in_mask'
)]),
(
cleanup
,
add_vol
,
[(
'outputnode.out_file'
,
'in_file'
)]),
(
inputnode
,
vsm
,
[(
'in_mask'
,
'mask_file'
)]),
(
add_vol
,
vsm
,
[(
'out_file'
,
'fmap_in_file'
)]),
(
inputnode
,
vsm
,
[(
'delta_echo_time'
,
'asym_se_time'
)]),
(
inputnode
,
vsm
,
[(
'effective_echo_spacing'
,
'dwell_time'
)]),
(
inputnode
,
split
,
[(
'in_dwi'
,
'in_file'
)]),
(
split
,
unwarp
,
[(
'out_files'
,
'in_file'
)]),
(
vsm
,
unwarp
,
[(
'shift_out_file'
,
'shift_in_file'
)]),
(
fsl_dir
,
unwarp
,
[(
'fsl_dir'
,
'unwarp_direction'
)]),
(
unwarp
,
thres
,
[(
'unwarped_file'
,
'in_file'
)]),
(
thres
,
merge
,
[(
'out_file'
,
'in_files'
)]),
(
merge
,
vsm2dfm
,
[(
'merged_file'
,
'inputnode.in_ref'
)]),
(
vsm
,
vsm2dfm
,
[(
'shift_out_file'
,
'inputnode.in_vsm'
)]),
(
fsl_dir
,
vsm2dfm
,
[(
'fsl_dir'
,
'inputnode.enc_dir'
)]),
(
pre_fugue
,
demean
,
[(
'fmap_out_file'
,
'in_file'
)]),
# noqa
(
inputnode
,
demean
,
[(
'in_mask'
,
'in_mask'
)]),
# noqa
(
demean
,
cleanup
,
[(
'out_file'
,
'inputnode.in_file'
)]),
# noqa
(
inputnode
,
cleanup
,
[(
'in_mask'
,
'inputnode.in_mask'
)]),
# noqa
(
cleanup
,
add_vol
,
[(
'outputnode.out_file'
,
'in_file'
)]),
# noqa
(
inputnode
,
vsm
,
[(
'in_mask'
,
'mask_file'
)]),
# noqa
(
add_vol
,
vsm
,
[(
'out_file'
,
'fmap_in_file'
)]),
# noqa
(
inputnode
,
vsm
,
[(
'delta_echo_time'
,
'asym_se_time'
)]),
# noqa
(
inputnode
,
vsm
,
[(
'effective_echo_spacing'
,
'dwell_time'
)]),
# noqa
(
inputnode
,
split
,
[(
'in_dwi'
,
'in_file'
)]),
# noqa
(
split
,
unwarp
,
[(
'out_files'
,
'in_file'
)]),
# noqa
(
vsm
,
unwarp
,
[(
'shift_out_file'
,
'shift_in_file'
)]),
# noqa
(
fsl_dir
,
unwarp
,
[(
'fsl_dir'
,
'unwarp_direction'
)]),
# noqa
(
unwarp
,
thres
,
[(
'unwarped_file'
,
'in_file'
)]),
# noqa
(
thres
,
merge
,
[(
'out_file'
,
'in_files'
)]),
# noqa
(
merge
,
vsm2dfm
,
[(
'merged_file'
,
'inputnode.in_ref'
)]),
# noqa
(
vsm
,
vsm2dfm
,
[(
'shift_out_file'
,
'inputnode.in_vsm'
)]),
# noqa
(
fsl_dir
,
vsm2dfm
,
[(
'fsl_dir'
,
'inputnode.enc_dir'
)]),
# noqa
(
rad2rsec
,
outputnode
,
[(
'out_file'
,
'out_native_fmap'
)]),
# noqa
(
merge
,
outputnode
,
[(
'merged_file'
,
'out_file'
)]),
# noqa
(
vsm
,
outputnode
,
[(
'shift_out_file'
,
'out_vsm'
)]),
# noqa
...
...
clinica/pipelines/dwi_preprocessing_using_t1/dwi_preprocessing_using_t1_pipeline.py
View file @
1ce6fdf2
# coding: utf8
import
clinica.pipelines.engine
as
cpe
__author__
=
[
"Thomas Jacquemont"
,
"Alexandre Routier"
]
...
...
@@ -31,14 +30,13 @@ class DWIPreprocessingUsingT1(cpe.Pipeline):
Example:
>>> from dwi_preprocessing_using_t1 import DWIPreprocessingUsingT1
>>> pipelines = DWIPreprocessingUsingT1('~/MYDATASET_BIDS',
>>> pipeline = DWIPreprocessingUsingT1('~/MYDATASET_BIDS',
>>> '~/MYDATASET_CAPS')
>>> pipeline
s
.parameters = {
>>> pipeline.parameters = {
>>> 'low_bval': 10
>>> }
>>> pipeline
s
.base_dir = '/tmp/'
>>> pipeline
s
.run()
>>> pipeline.base_dir = '/tmp/'
>>> pipeline.run()
"""
def
__init__
(
self
,
bids_directory
=
None
,
caps_directory
=
None
,
tsv_file
=
None
,
name
=
None
,
low_bval
=
5
):
...
...
@@ -347,36 +345,36 @@ class DWIPreprocessingUsingT1(cpe.Pipeline):
self
.
connect
([
# Preliminary step (possible computation of a mean b0):
(
self
.
input_node
,
prepare_b0
,
[(
'dwi'
,
'in_dwi'
),
(
'bval'
,
'in_bval'
),
(
'bvec'
,
'in_bvec'
)]),
(
self
.
input_node
,
prepare_b0
,
[(
'dwi'
,
'in_dwi'
),
# noqa
(
'bval'
,
'in_bval'
),
# noqa
(
'bvec'
,
'in_bvec'
)]),
# noqa
# Mask b0 before corrections
(
prepare_b0
,
mask_b0_pre
,
[(
'out_reference_b0'
,
'in_file'
)]),
(
prepare_b0
,
mask_b0_pre
,
[(
'out_reference_b0'
,
'in_file'
)]),
# noqa
# Head-motion correction
(
prepare_b0
,
hmc
,
[(
'out_b0_dwi_merge'
,
'inputnode.in_file'
),
(
'out_updated_bval'
,
'inputnode.in_bval'
),
(
'out_updated_bvec'
,
'inputnode.in_bvec'
)]),
(
mask_b0_pre
,
hmc
,
[(
'mask_file'
,
'inputnode.in_mask'
)]),
(
prepare_b0
,
hmc
,
[(
'out_b0_dwi_merge'
,
'inputnode.in_file'
),
# noqa
(
'out_updated_bval'
,
'inputnode.in_bval'
),
# noqa
(
'out_updated_bvec'
,
'inputnode.in_bvec'
)]),
# noqa
(
mask_b0_pre
,
hmc
,
[(
'mask_file'
,
'inputnode.in_mask'
)]),
# noqa
# Eddy-current correction
(
hmc
,
ecc
,
[(
'outputnode.out_xfms'
,
'inputnode.in_xfms'
)]),
(
prepare_b0
,
ecc
,
[(
'out_b0_dwi_merge'
,
'inputnode.in_file'
)]),
(
prepare_b0
,
ecc
,
[(
'out_updated_bval'
,
'inputnode.in_bval'
)]),
(
mask_b0_pre
,
ecc
,
[(
'mask_file'
,
'inputnode.in_mask'
)]),
(
hmc
,
ecc
,
[(
'outputnode.out_xfms'
,
'inputnode.in_xfms'
)]),
# noqa
(
prepare_b0
,
ecc
,
[(
'out_b0_dwi_merge'
,
'inputnode.in_file'
)]),
# noqa
(
prepare_b0
,
ecc
,
[(
'out_updated_bval'
,
'inputnode.in_bval'
)]),
# noqa
(
mask_b0_pre
,
ecc
,
[(
'mask_file'
,
'inputnode.in_mask'
)]),
# noqa
# Magnetic susceptibility correction
(
ecc
,
sdc
,
[(
'outputnode.out_file'
,
'inputnode.in_dwi'
)]),
(
self
.
input_node
,
sdc
,
[(
'T1w'
,
'inputnode.in_t1'
)]),
(
ecc
,
sdc
,
[(
'outputnode.out_file'
,
'inputnode.in_dwi'
)]),
# noqa
(
self
.
input_node
,
sdc
,
[(
'T1w'
,
'inputnode.in_t1'
)]),
# noqa
# Apply all corrections
(
prepare_b0
,
aac
,
[(
'out_b0_dwi_merge'
,
'inputnode.in_dwi'
)]),
(
hmc
,
aac
,
[(
'outputnode.out_xfms'
,
'inputnode.in_hmc'
)]),
(
ecc
,
aac
,
[(
'outputnode.out_xfms'
,
'inputnode.in_ecc'
)]),
(
sdc
,
aac
,
[(
'outputnode.out_warp'
,
'inputnode.in_sdc_syb'
)]),
(
self
.
input_node
,
aac
,
[(
'T1w'
,
'inputnode.in_t1'
)]),
(
prepare_b0
,
aac
,
[(
'out_b0_dwi_merge'
,
'inputnode.in_dwi'
)]),
# noqa
(
hmc
,
aac
,
[(
'outputnode.out_xfms'
,
'inputnode.in_hmc'
)]),
# noqa
(
ecc
,
aac
,
[(
'outputnode.out_xfms'
,
'inputnode.in_ecc'
)]),
# noqa
(
sdc
,
aac
,
[(
'outputnode.out_warp'
,
'inputnode.in_sdc_syb'
)]),
# noqa
(
self
.
input_node
,
aac
,
[(
'T1w'
,
'inputnode.in_t1'
)]),
# noqa
# Bias correction
(
aac
,
bias
,
[(
'outputnode.out_file'
,
'inputnode.in_file'
)]),
# Outputnode:
(
bias
,
self
.
output_node
,
[(
'outputnode.out_file'
,
'preproc_dwi'
)]),
# noqa
(
bias
,
self
.
output_node
,
[(
'outputnode.out_file'
,
'preproc_dwi'
)]),
# noqa
(
hmc
,
self
.
output_node
,
[(
'outputnode.out_bvec'
,
'preproc_bvec'
)]),
# noqa
(
prepare_b0
,
self
.
output_node
,
[(
'out_updated_bval'
,
'preproc_bval'
)]),
# noqa
(
bias
,
self
.
output_node
,
[(
'outputnode.b0_mask'
,
'b0_mask'
)])
# noqa
(
bias
,
self
.
output_node
,
[(
'outputnode.b0_mask'
,
'b0_mask'
)])
# noqa
])
clinica/pipelines/dwi_processing_dti/dwi_processing_dti_cli.py
View file @
1ce6fdf2
...
...
@@ -11,7 +11,14 @@ class DWIProcessingDTICLI(ce.CmdParser):
def
define_name
(
self
):
"""Define the sub-command name to run this pipeline.
"""
from
colorama
import
Fore
,
init
init
()
self
.
_name
=
'dwi-processing-dti'
self
.
_args
.
epilog
=
'Example: clinica run dwi-processing-dti BIDS CAPS'
self
.
_args
.
description
=
"
%
sDTI-based pipeline: http:://clinica.run/doc/DWIProcessing
%
s"
%
(
Fore
.
GREEN
,
Fore
.
RESET
)
self
.
_args
.
_positionals
.
title
=
'
%
sCompulsory arguments:
%
s'
%
(
Fore
.
BLUE
,
Fore
.
RESET
)
self
.
_args
.
_optionals
.
title
=
'
%
sOptional arguments:
%
s'
%
(
Fore
.
BLUE
,
Fore
.
RESET
)
def
define_options
(
self
):
"""Define the sub-command arguments
...
...
clinica/pipelines/dwi_processing_dti/dwi_processing_dti_pipeline.py
View file @
1ce6fdf2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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