diff --git a/PyNutil/coordinate_extraction.py b/PyNutil/coordinate_extraction.py index a58ae144afc2d95f0050d21a168a0b2c7af237f2..a459c0698b4fd805b6d6f3bcc1f5ef182020f453 100644 --- a/PyNutil/coordinate_extraction.py +++ b/PyNutil/coordinate_extraction.py @@ -243,13 +243,13 @@ def load_segmentation(segmentation_path: str): else: return cv2.imread(segmentation_path) -def remove_background(segmentation: np.array): +def detect_pixel_id(segmentation: np.array): """Remove the background from the segmentation and return the pixel id.""" segmentation_no_background = segmentation[~np.all(segmentation == 0, axis=2)] print("length of non background pixels: ", len(segmentation_no_background)) pixel_id = segmentation_no_background[0] print("detected pixel_id: ", pixel_id) - return segmentation_no_background, pixel_id + return pixel_id def get_region_areas(use_flat, atlas_labels, flat_file_atlas, seg_width, seg_height, slice_dict, atlas_volume, triangulation): if use_flat: @@ -299,7 +299,7 @@ def segmentation_to_atlas_space( ): segmentation = load_segmentation(segmentation_path) if pixel_id == "auto": - segmentation, pixel_id = remove_background(segmentation) + pixel_id = detect_pixel_id(segmentation) seg_height, seg_width = segmentation.shape[:2] reg_height, reg_width = slice_dict["height"], slice_dict["width"] if non_linear and "markers" in slice_dict: diff --git a/test/test10_PyNutil_web.json b/test/test10_PyNutil_web.json index 81a2f918ae4d0722187e92ac1a8eaaee82721db2..fd8a95a6250d2c287f91c94e3fca45b7fed26f2e 100644 --- a/test/test10_PyNutil_web.json +++ b/test/test10_PyNutil_web.json @@ -4,6 +4,6 @@ "segmentation_folder": "PyNutil/test_data/PyTest_web", "alignment_json": "PyNutil/test_data/PyNutil_test.waln", "nonlinear": true, - "colour": [0, 0, 0], + "colour": "auto", "points_json_path": "PyNutil/outputs/test.json" }