Skip to content

Commit

Permalink
Add fetch automatically template for StatisticsVolumeCorrection pipel…
Browse files Browse the repository at this point in the history
…ine if it doesn't exist (#80)

* Add fetch automatically template for pipeline if it doesn't exist

* Fix code style issue

* Add T1_linear brief description on the cli

* Fix, add import statements

* Fix import statement syntax
  • Loading branch information
mdiazmel authored Apr 1, 2020
1 parent c665422 commit 60ba3e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ def build_output_node(self):
def build_core_nodes(self):
"""Build and connect the core nodes of the pipeline."""
import clinica.pipelines.statistics_volume_correction.statistics_volume_correction_utils as utils
from clinica.utils.inputs import fetch_file
import nipype.interfaces.utility as nutil
import nipype.pipeline.engine as npe
from os.path import join, abspath, pardir, dirname
from os.path import join, abspath, pardir, dirname, exists
import numpy as np

peak_correction_FWE = npe.Node(name='peak_correction_FWE',
Expand Down Expand Up @@ -91,7 +92,18 @@ def build_core_nodes(self):
output_names=['figs'],
function=utils.produce_figures))
produce_fig_FWE_peak_correction.inputs.n_cuts = self.parameters['n_cuts']
produce_fig_FWE_peak_correction.inputs.template = join(dirname(abspath(__file__)), pardir, pardir, 'resources', 'mni_icbm152_t1_tal_nlin_sym_09a.nii.gz')

root = dirname(abspath(join(abspath(__file__), pardir, pardir)))
path_to_mask = join(root, 'resources', 'masks')
produce_fig_FWE_peak_correction.inputs.template = join(path_to_mask, 'mni_icbm152_t1_tal_nlin_sym_09a.nii.gz')

url = "https://aramislab.paris.inria.fr/files/data/img_t1_linear/mni_icbm152_t1_tal_nlin_sym_09c.nii"

if not(exists(produce_fig_FWE_peak_correction.inputs.template)):
try:
fetch_file(url, produce_fig_FWE_peak_correction.inputs.template)
except IOError as err:
cprint('Unable to download required template (mni_icbm152) for processing:', err)

produce_fig_FDR_peak_correction = produce_fig_FWE_peak_correction.clone(name='produce_figure_FDR_peak_correction')
produce_fig_FWE_cluster_correction = produce_fig_FWE_peak_correction.clone(name='produce_figure_FWE_cluster_correction')
Expand Down
2 changes: 1 addition & 1 deletion clinica/pipelines/t1_linear/t1_linear_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def define_name(self):
def define_description(self):
"""Define a description of this pipeline.
"""
self._description = ('Brief description:\n'
self._description = ('Affine registration of T1w images to the MNI standard space:\n'
'http://clinica.run/doc/Pipelines/T1Linear/')

def define_options(self):
Expand Down

0 comments on commit 60ba3e2

Please sign in to comment.