Skip to content

Commit

Permalink
Merge pull request #134 from GalKepler/base_workflow
Browse files Browse the repository at this point in the history
Base workflow
  • Loading branch information
GalKepler authored Jul 29, 2024
2 parents ef19efc + 1b263df commit b5a172c
Show file tree
Hide file tree
Showing 24 changed files with 1,575 additions and 16 deletions.
26 changes: 15 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = "^3.10"
nipype = "^1.8.6"
nipype = {git = "https://github.com/nipy/nipype.git"}
templateflow = "^23.0.0"
psutil = "^5.9.5"
niworkflows = "^1.8.1"
Expand Down
23 changes: 23 additions & 0 deletions src/kepost/atlases/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@
]


def get_atlas_properties(atlas: str):
"""
A simple function to get the properties of an atlas.
Parameters
----------
atlas : str
The name of the atlas.
Returns
-------
dict
A dictionary with the properties of the atlas.
"""
from kepost.atlases.available_atlases.available_atlases import AVAILABLE_ATLASES

nifti, description, region_col, index_col = [
AVAILABLE_ATLASES.get(atlas).get(key) # type: ignore[union-attr]
for key in ["nifti", "description_file", "region_col", "index_col"]
]
return nifti, description, region_col, index_col


def generate_gm_mask_from_smriprep(
gm_probseg: Union[str, Path], out_file: Union[str, Path], force: bool = False
):
Expand Down
14 changes: 11 additions & 3 deletions src/kepost/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class nipype(_Config):
"""Estimation in GB of the RAM this workflow can allocate at any given time."""
nprocs = os.cpu_count()
"""Number of processes (compute tasks) that can be run in parallel (multiprocessing only)."""
omp_nthreads = None
omp_nthreads = 8
"""Number of CPUs a single process can access for multithreaded execution."""
plugin = "MultiProc"
"""NiPype's execution plugin."""
Expand Down Expand Up @@ -385,6 +385,9 @@ def init(cls):
cls.keprep_database_dir = _db_path
cls.layout = cls._layout

if cls.participant_label is None:
cls.participant_label = cls.layout.get_subjects()

if "all" in cls.debug:
cls.debug = list(DEBUG_MODES)

Expand All @@ -394,6 +397,9 @@ def init(cls):
if Path(cls.output_dir).name != "kepost":
cls.output_dir = Path(cls.output_dir) / "kepost"

if cls.fs_subjects_dir is None:
cls.fs_subjects_dir = Path(cls.keprep_dir).parent / "freesurfer"


# These variables are not necessary anymore
del _fs_license
Expand All @@ -409,8 +415,10 @@ def init(cls):
class workflow(_Config):
"""Configure the particular execution graph of this workflow."""

anat_only = False
"""Execute the anatomical preprocessing only."""
five_tissue_type_algorithm = "hsvs"
"""Algorithm to use for the generation of the five-tissue-type image. Available algorithms are: `hsvs`, `fsl`."""
gm_probseg_threshold = 0.0001
"""Threshold for the probabilistic segmentation of the gray matter."""
atlases: list = ["all"]
"""Parcellation atlas(es) to use for the parcellation step. Available atlases are: `all`, `fan2016`, `huang2022`, `schaefer2018_{n_regions}_{n_networks}`."""
dipy_reconstruction_method = "NLLS"
Expand Down
Empty file.
1 change: 1 addition & 0 deletions src/kepost/interfaces/bids/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from kepost.interfaces.bids.bids import DerivativesDataSink # noqa: F401
Loading

0 comments on commit b5a172c

Please sign in to comment.