Skip to content

Commit

Permalink
some more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGensollen committed Nov 7, 2024
1 parent eb5dba8 commit b951aad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
4 changes: 1 addition & 3 deletions clinica/pipelines/dwi/preprocessing/fmap/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def _build_input_node(self):
if len(self.subjects):
print_images_to_process(self.subjects, self.sessions)
cprint(
f"List available in {self.base_dir / self.name / 'participants.tsv'}"
)
cprint(
f"List available in {self.base_dir / self.name / 'participants.tsv'}\n"
"Computational time will depend of the number of volumes in your DWI dataset and the use of CUDA."
)

Expand Down
21 changes: 12 additions & 9 deletions clinica/pipelines/statistics_surface/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def get_output_fields(self) -> List[str]:
def _build_input_node(self):
"""Build and connect an input node to the pipeline."""
from clinica.utils.exceptions import ClinicaException
from clinica.utils.input_files import QueryPattern
from clinica.utils.inputs import clinica_list_of_files_reader

# Check if already present in CAPS
Expand All @@ -133,26 +134,28 @@ def _build_input_node(self):
)

# Check input files
surface_query = []
patterns: list[QueryPattern] = []
# clinica_files_reader expects regexp to start at subjects/ so sub-*/ses-*/ is removed here
fwhm = str(self.parameters["full_width_at_half_maximum"])
for direction, hemi in zip(["left", "right"], ["lh", "rh"]):
cut_pattern = "sub-*/ses-*/"
query = {"subject": "sub-*", "session": "ses-*", "hemi": hemi, "fwhm": fwhm}
pattern_hemisphere = self.parameters["custom_file"] % query
surface_based_info = {
"pattern": pattern_hemisphere[
pattern_hemisphere.find(cut_pattern) + len(cut_pattern) :
],
"description": f"surface-based features on {direction} hemisphere at FWHM = {fwhm}",
}
surface_query.append(surface_based_info)
patterns.append(
QueryPattern(
pattern_hemisphere[
pattern_hemisphere.find(cut_pattern) + len(cut_pattern) :
],
f"surface-based features on {direction} hemisphere at FWHM = {fwhm}",
"",
)
)
try:
clinica_list_of_files_reader(
self.subjects,
self.sessions,
self.caps_directory,
surface_query,
patterns,
)
except ClinicaException as e:
raise RuntimeError(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def _build_input_node(self):
import nipype.interfaces.utility as nutil
import nipype.pipeline.engine as npe

from clinica.utils.exceptions import ClinicaCAPSError, ClinicaException
from clinica.utils.input_files import t1_volume_template_tpm_in_mni
from clinica.utils.inputs import clinica_file_filter, clinica_file_reader
from clinica.utils.exceptions import ClinicaException
from clinica.utils.input_files import QueryPatternName, query_pattern_factory
from clinica.utils.inputs import clinica_file_filter
from clinica.utils.stream import cprint
from clinica.utils.ux import (
print_groups_in_caps_directory,
Expand All @@ -66,16 +66,16 @@ def _build_input_node(self):
f"Group {self.parameters['group_label']} does not exist. "
"Did you run t1-volume or t1-volume-create-dartel pipeline?"
)

pattern = query_pattern_factory(QueryPatternName.T1_VOLUME_TEMPLATE_TPM_IN_MNI)(
group_label=self.parameters["group_label"],
tissue_number=1,
modulation=self.parameters["modulate"],
)
gm_mni, self.subjects, self.sessions = clinica_file_filter(
self.subjects,
self.sessions,
self.caps_directory,
t1_volume_template_tpm_in_mni(
group_label=self.parameters["group_label"],
tissue_number=1,
modulation=self.parameters["modulate"],
),
pattern,
)

read_parameters_node = npe.Node(
Expand Down

0 comments on commit b951aad

Please sign in to comment.