From 815e3ae60613b90dac5623a238bd8a2e4789a32b Mon Sep 17 00:00:00 2001 From: iback Date: Mon, 9 Sep 2024 09:25:48 +0000 Subject: [PATCH] refactored file structure. updated TPTBox requirements --- pyproject.toml | 2 +- spineps/models.py | 4 ++-- spineps/seg_model.py | 2 +- spineps/{ => utils}/auto_download.py | 0 spineps/{ => utils}/seg_modelconfig.py | 0 unit_tests/test_filepaths.py | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename spineps/{ => utils}/auto_download.py (100%) rename spineps/{ => utils}/seg_modelconfig.py (100%) diff --git a/pyproject.toml b/pyproject.toml index a9f9b8c..8be667f 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ torchmetrics = "^1.1.2" tqdm = "^4.66.1" einops= "^0.6.1" nnunetv2 = "2.4.2" -tptbox = "^0.1.4" +tptbox = "^0.1.6" antspyx = "0.4.2" rich = "^13.6.0" diff --git a/spineps/models.py b/spineps/models.py index 0580801..91c4d91 100755 --- a/spineps/models.py +++ b/spineps/models.py @@ -3,11 +3,11 @@ from TPTBox import Log_Type, No_Logger -from spineps.auto_download import download_if_missing, instances, semantic from spineps.seg_enums import Modality from spineps.seg_model import Segmentation_Model, modeltype2class -from spineps.seg_modelconfig import load_inference_config +from spineps.utils.auto_download import download_if_missing, instances, semantic from spineps.utils.filepaths import get_mri_segmentor_models_dir, search_path +from spineps.utils.seg_modelconfig import load_inference_config logger = No_Logger() logger.prefix = "Models" diff --git a/spineps/seg_model.py b/spineps/seg_model.py index fae4b08..37d8666 100755 --- a/spineps/seg_model.py +++ b/spineps/seg_model.py @@ -10,11 +10,11 @@ from typing_extensions import Self from spineps.seg_enums import Acquisition, InputType, Modality, ModelType, OutputType -from spineps.seg_modelconfig import Segmentation_Inference_Config, load_inference_config from spineps.Unet3D.pl_unet import PLNet from spineps.utils.citation_reminder import citation_reminder from spineps.utils.filepaths import search_path from spineps.utils.inference_api import load_inf_model, run_inference +from spineps.utils.seg_modelconfig import Segmentation_Inference_Config, load_inference_config threads_started = False diff --git a/spineps/auto_download.py b/spineps/utils/auto_download.py similarity index 100% rename from spineps/auto_download.py rename to spineps/utils/auto_download.py diff --git a/spineps/seg_modelconfig.py b/spineps/utils/seg_modelconfig.py similarity index 100% rename from spineps/seg_modelconfig.py rename to spineps/utils/seg_modelconfig.py diff --git a/unit_tests/test_filepaths.py b/unit_tests/test_filepaths.py index 788a4cc..7265351 100644 --- a/unit_tests/test_filepaths.py +++ b/unit_tests/test_filepaths.py @@ -41,7 +41,7 @@ def test_search_path_multi(self): print(package_path) predictor_search = search_path(package_path, query="seg_*.py") print(predictor_search) - self.assertTrue(len(predictor_search) == 6) + self.assertTrue(len(predictor_search) == 5, predictor_search) # self.assertEqual(predictor_search[0], package_path.joinpath("utils", "predictor.py")) def test_env_path(self):