Skip to content

Commit

Permalink
move PETSurface pipeline to new pet module
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGensollen committed Jul 24, 2024
1 parent f2ec11b commit c693a2a
Show file tree
Hide file tree
Showing 20 changed files with 3,052 additions and 1,482 deletions.
1 change: 0 additions & 1 deletion clinica/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
machine_learning,
machine_learning_spatial_svm,
pet,
pet_surface,
statistics_surface,
statistics_volume,
statistics_volume_correction,
Expand Down
2 changes: 1 addition & 1 deletion clinica/pipelines/pet/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import linear, volume
from . import linear, surface, volume
1 change: 1 addition & 0 deletions clinica/pipelines/pet/surface/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import cli, longitudinal_cli
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def cli(

from clinica.utils.ux import print_end_pipeline

from .pet_surface_pipeline import PetSurface
from .pipeline import PetSurface

parameters = {
"acq_label": acq_label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"version": ">=12"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def cli(

from clinica.utils.ux import print_end_pipeline

from .pet_surface_pipeline import PetSurface
from .pipeline import PetSurface

parameters = {
"acq_label": acq_label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,24 @@ def _build_input_node_longitudinal(self):
self.parameters["acq_label"],
skip_question=self.parameters["skip_question"],
)

# fmt: off
self.connect(
[
(read_parameters_node, self.input_node, [("pet", "pet"),
("orig_nu", "orig_nu"),
("white_surface_left", "white_surface_left"),
("white_surface_right", "white_surface_right"),
("destrieux_left", "destrieux_left"),
("destrieux_right", "destrieux_right"),
("desikan_left", "desikan_left"),
("desikan_right", "desikan_right")])
(
read_parameters_node,
self.input_node,
[
("pet", "pet"),
("orig_nu", "orig_nu"),
("white_surface_left", "white_surface_left"),
("white_surface_right", "white_surface_right"),
("destrieux_left", "destrieux_left"),
("destrieux_right", "destrieux_right"),
("desikan_left", "desikan_left"),
("desikan_right", "desikan_right"),
],
)
]
)
# fmt: on

def _build_input_node_cross_sectional(self):
import nipype.interfaces.utility as nutil
Expand Down Expand Up @@ -320,21 +323,24 @@ def _build_input_node_cross_sectional(self):
self.parameters["acq_label"],
skip_question=self.parameters["skip_question"],
)

# fmt: off
self.connect(
[
(read_parameters_node, self.input_node, [("pet", "pet"),
("orig_nu", "orig_nu"),
("white_surface_left", "white_surface_left"),
("white_surface_right", "white_surface_right"),
("destrieux_left", "destrieux_left"),
("destrieux_right", "destrieux_right"),
("desikan_left", "desikan_left"),
("desikan_right", "desikan_right")])
(
read_parameters_node,
self.input_node,
[
("pet", "pet"),
("orig_nu", "orig_nu"),
("white_surface_left", "white_surface_left"),
("white_surface_right", "white_surface_right"),
("destrieux_left", "destrieux_left"),
("destrieux_right", "destrieux_right"),
("desikan_left", "desikan_left"),
("desikan_right", "desikan_right"),
],
)
]
)
# fmt: on

def _build_output_node(self):
"""Build and connect an output node to the pipeline."""
Expand All @@ -355,7 +361,7 @@ def _build_core_nodes(self):
import nipype.interfaces.utility as niu
import nipype.pipeline.engine as npe

import clinica.pipelines.pet_surface.pet_surface_utils as utils
from clinica.pipelines.pet.surface.workflows import get_wf

full_pipe = npe.MapNode(
niu.Function(
Expand All @@ -380,7 +386,7 @@ def _build_core_nodes(self):
"is_longitudinal",
],
output_names=[],
function=utils.get_wf,
function=get_wf,
),
name="full_pipeline_mapnode",
iterfield=[
Expand Down Expand Up @@ -413,6 +419,7 @@ def _build_core_nodes(self):
os.path.dirname(os.path.realpath(__file__)),
"..",
"..",
"..",
"resources",
"label_conversion_gtmsegmentation.csv",
)
Expand All @@ -421,20 +428,21 @@ def _build_core_nodes(self):
os.path.dirname(os.path.realpath(__file__))
)
full_pipe.inputs.is_longitudinal = self.parameters["longitudinal"]

# Connection
# ==========
# fmt: off
self.connect(
[
(self.input_node, full_pipe, [("pet", "pet"),
("white_surface_left", "white_surface_left"),
("white_surface_right", "white_surface_right"),
("orig_nu", "orig_nu"),
("destrieux_left", "destrieux_left"),
("destrieux_right", "destrieux_right"),
("desikan_left", "desikan_left"),
("desikan_right", "desikan_right")])
(
self.input_node,
full_pipe,
[
("pet", "pet"),
("white_surface_left", "white_surface_left"),
("white_surface_right", "white_surface_right"),
("orig_nu", "orig_nu"),
("destrieux_left", "destrieux_left"),
("destrieux_right", "destrieux_right"),
("desikan_left", "desikan_left"),
("desikan_right", "desikan_right"),
],
)
]
)
# fmt: off
Loading

0 comments on commit c693a2a

Please sign in to comment.