diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 483ac12..b016bc2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,6 +12,6 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: "3.12" - run: pip3 install pre-commit - run: pre-commit run --files NiChart_DLMUSE/* diff --git a/NiChart_DLMUSE/SegmentImage.py b/NiChart_DLMUSE/SegmentImage.py index 7b4c2b3..6ddfd75 100644 --- a/NiChart_DLMUSE/SegmentImage.py +++ b/NiChart_DLMUSE/SegmentImage.py @@ -5,8 +5,12 @@ def run_dlicv( - in_dir: str, in_suff: Any, out_dir: str, out_suff: Any, device: str, - extra_args: str = "" + in_dir: str, + in_suff: Any, + out_dir: str, + out_suff: Any, + device: str, + extra_args: str = "", ) -> None: # Call DLICV print("Running DLICV") @@ -19,8 +23,12 @@ def run_dlicv( def run_dlmuse( - in_dir: str, in_suff: Any, out_dir: str, out_suff: Any, device: str, - extra_args: str = "" + in_dir: str, + in_suff: Any, + out_dir: str, + out_suff: Any, + device: str, + extra_args: str = "", ) -> None: # Call DLMUSE print("Running DLMUSE") diff --git a/NiChart_DLMUSE/__main__.py b/NiChart_DLMUSE/__main__.py index bb9c27c..b9c7bfc 100644 --- a/NiChart_DLMUSE/__main__.py +++ b/NiChart_DLMUSE/__main__.py @@ -145,7 +145,14 @@ def main() -> None: for i in range(len(subfolders)): curr_out_dir = out_dir + f"/split_{i}" curr_thread = threading.Thread( - target=run_pipeline, args=(subfolders[i], curr_out_dir, device, dlmuse_extra_args, dlicv_extra_args) + target=run_pipeline, + args=( + subfolders[i], + curr_out_dir, + device, + dlmuse_extra_args, + dlicv_extra_args, + ), ) curr_thread.start() threads.append(curr_thread) @@ -157,6 +164,5 @@ def main() -> None: remove_subfolders(in_data) - if __name__ == "__main__": main() diff --git a/NiChart_DLMUSE/dlmuse_pipeline.py b/NiChart_DLMUSE/dlmuse_pipeline.py index 4cb942f..4ebadb4 100644 --- a/NiChart_DLMUSE/dlmuse_pipeline.py +++ b/NiChart_DLMUSE/dlmuse_pipeline.py @@ -1,6 +1,6 @@ import os -from pathlib import Path -import pkg_resources + +import pkg_resources # type: ignore from .CalcROIVol import apply_create_roi_csv, combine_roi_csv from .MaskImage import apply_combine_masks, apply_mask_img @@ -25,14 +25,15 @@ # "dicts", # "MUSE_mapping_consecutive_indices.csv", # ) -#DICT_MUSE_NNUNET_MAP = os.path.join( +# DICT_MUSE_NNUNET_MAP = os.path.join( # Path(__file__).parent.parent, # "shared", # "dicts", # "MUSE_mapping_consecutive_indices.csv", -#) -DICT_MUSE_NNUNET_MAP = pkg_resources.resource_filename('NiChart_DLMUSE', - 'shared/dicts/MUSE_mapping_consecutive_indices.csv') +# ) +DICT_MUSE_NNUNET_MAP = pkg_resources.resource_filename( + "NiChart_DLMUSE", "shared/dicts/MUSE_mapping_consecutive_indices.csv" +) LABEL_FROM = "IndexConsecutive" LABEL_TO = "IndexMUSE" @@ -40,13 +41,21 @@ # DICT_MUSE_DERIVED = os.path.join( # os.path.dirname(os.getcwd()), "shared", "dicts", "MUSE_mapping_derived_rois.csv" # ) -#DICT_MUSE_DERIVED = os.path.join( +# DICT_MUSE_DERIVED = os.path.join( # Path(__file__).parent.parent, "shared", "dicts", "MUSE_mapping_derived_rois.csv" -#) -DICT_MUSE_DERIVED = pkg_resources.resource_filename('NiChart_DLMUSE', - 'shared/dicts/MUSE_mapping_derived_rois.csv') - -def run_pipeline(in_data: str, out_dir: str, device: str, dlmuse_extra_args: str, dlicv_extra_args: str) -> None: +# ) +DICT_MUSE_DERIVED = pkg_resources.resource_filename( + "NiChart_DLMUSE", "shared/dicts/MUSE_mapping_derived_rois.csv" +) + + +def run_pipeline( + in_data: str, + out_dir: str, + device: str, + dlmuse_extra_args: str, + dlicv_extra_args: str, +) -> None: """ NiChart pipeline """