Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Move class PETPipeline to new clinica.pipelines.pet module #1223

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions clinica/pipelines/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,28 +1001,3 @@ def _check_custom_dependencies(self) -> None:
@abc.abstractmethod
def _check_pipeline_parameters(self) -> None:
"""Check pipeline parameters."""


class PETPipeline(Pipeline):
def _check_pipeline_parameters(self) -> None:
"""Check pipeline parameters."""
if "acq_label" not in self.parameters.keys():
raise KeyError("Missing compulsory acq_label key in pipeline parameter.")
self.parameters.setdefault("reconstruction_method", None)

def _get_pet_scans_query(self) -> dict:
"""Return the query to retrieve PET scans."""
from clinica.utils.input_files import bids_pet_nii
from clinica.utils.pet import ReconstructionMethod, Tracer

pet_tracer = None
if self.parameters["acq_label"] is not None:
pet_tracer = Tracer(self.parameters["acq_label"])

reconstruction_method = None
if self.parameters["reconstruction_method"] is not None:
reconstruction_method = ReconstructionMethod(
self.parameters["reconstruction_method"]
)

return bids_pet_nii(pet_tracer, reconstruction_method)
Empty file.
26 changes: 26 additions & 0 deletions clinica/pipelines/pet/engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from clinica.pipelines.engine import Pipeline


class PETPipeline(Pipeline):
def _check_pipeline_parameters(self) -> None:
"""Check pipeline parameters."""
if "acq_label" not in self.parameters.keys():
raise KeyError("Missing compulsory acq_label key in pipeline parameter.")
self.parameters.setdefault("reconstruction_method", None)

def _get_pet_scans_query(self) -> dict:
"""Return the query to retrieve PET scans."""
from clinica.utils.input_files import bids_pet_nii
from clinica.utils.pet import ReconstructionMethod, Tracer

pet_tracer = None
if self.parameters["acq_label"] is not None:
pet_tracer = Tracer(self.parameters["acq_label"])

reconstruction_method = None
if self.parameters["reconstruction_method"] is not None:
reconstruction_method = ReconstructionMethod(
self.parameters["reconstruction_method"]
)

return bids_pet_nii(pet_tracer, reconstruction_method)
2 changes: 1 addition & 1 deletion clinica/pipelines/pet_linear/pet_linear_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from nipype import config

from clinica.pipelines.engine import PETPipeline
from clinica.pipelines.pet.engine import PETPipeline

cfg = dict(execution={"parameterize_dirs": False})
config.update_config(cfg)
Expand Down
2 changes: 1 addition & 1 deletion clinica/pipelines/pet_surface/pet_surface_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List

from clinica.pipelines.engine import PETPipeline
from clinica.pipelines.pet.engine import PETPipeline


class PetSurface(PETPipeline):
Expand Down
2 changes: 1 addition & 1 deletion clinica/pipelines/pet_volume/pet_volume_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from nipype import config

from clinica.pipelines.engine import PETPipeline
from clinica.pipelines.pet.engine import PETPipeline

# Use hash instead of parameters for iterables folder names
# Otherwise path will be too long and generate OSError
Expand Down
Loading