Skip to content

Commit

Permalink
Merge pull request #4 from Hendrik-code/tptbox_v0.0.6
Browse files Browse the repository at this point in the history
updated to tptbox v0.0.6
  • Loading branch information
Hendrik-code authored Mar 1, 2024
2 parents 2f3214b + 18c0997 commit 4873466
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ torchmetrics = "^1.1.2"
tqdm = "^4.66.1"
einops= "^0.6.1"
nnunetv2 = "2.2"
tptbox = "*"
tptbox = "^0.0.6"
antspyx = "*"
rich = "^13.6.0"

Expand Down
2 changes: 1 addition & 1 deletion spineps/seg_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def predict_centroids_from_both(
labelmap[i] = 0
vert_nii_4_centroids.map_labels_(labelmap, verbose=False)

ctd = poi.calc_centroids_from_subreg_vert(vert_nii_4_centroids, seg_nii, verbose=logger)
ctd = poi.calc_poi_from_subreg_vert(vert_nii_4_centroids, seg_nii, verbose=logger)

if v_name2idx["S1"] in vert_nii_cleaned.unique():
s1_nii = vert_nii_cleaned.extract_label(26, inplace=False)
Expand Down
2 changes: 1 addition & 1 deletion spineps/utils/filepaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path

spineps_environment_path_override = None # Path(
# "/DATA/NAS/ongoing_projects/hendrik/mri_usage/models/"
# "/DATA/NAS/ongoing_projects/hendrik/mri_usage/models/"
# ) # None # You can put an absolute path to the model weights here instead of using environment variable
spineps_environment_path_backup = Path(__file__).parent.parent.joinpath("models") # EDIT this to use this instead of environment variable

Expand Down
35 changes: 35 additions & 0 deletions unit_tests/test_filepaths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Call 'python -m unittest' on this folder # noqa: INP001
# coverage run -m unittest
# coverage report
# coverage html
import os
import unittest

from spineps.models import Segmentation_Model, get_segmentation_model
from spineps.utils.filepaths import (
filepath_model,
get_mri_segmentor_models_dir,
spineps_environment_path_backup,
spineps_environment_path_override,
)


class Test_filepaths(unittest.TestCase):
# def test_load_model_from_path(self):
# ms_p = "/DATA/NAS/ongoing_projects/hendrik/nako-segmentation/nnUNet/nnUNet_results/Dataset122_nako_wotest_spiderarcus/nnUNetTrainerNoMirroring__nnUNetPlans__3d_fullres_custom"
# mv_p = "/DATA/NAS/ongoing_projects/hendrik/nako-segmentation/nnUNet/unet3d_result/nakospider_highres_shiftposi"
# model_dir = "/DATA/NAS/ongoing_projects/hendrik/nako-segmentation/nnUNet/"
# ms = get_segmentation_model(in_config=filepath_model(ms_p, model_dir=model_dir))
# self.assertTrue(isinstance(ms, Segmentation_Model))
# mv = get_segmentation_model(in_config=filepath_model(mv_p, model_dir=model_dir))
# self.assertTrue(isinstance(mv, Segmentation_Model))
# self.assertTrue(True)

# def test_env_path(self):
# # no override
# p = get_mri_segmentor_models_dir()
# if spineps_environment_path_override is not None:
# self.assertEqual(p, spineps_environment_path_override)
# else:
# self.assertEqual(str(p) + "/", os.environ.get("SPINEPS_SEGMENTOR_MODELS"))
pass

0 comments on commit 4873466

Please sign in to comment.