From 4c8061a1b26b51ad2433daf6080f20199114d57e Mon Sep 17 00:00:00 2001 From: Anna Grim <108307071+anna-grim@users.noreply.github.com> Date: Fri, 11 Oct 2024 18:05:14 -0700 Subject: [PATCH] Add files via upload --- src/deep_neurographs/utils/img_util.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/deep_neurographs/utils/img_util.py b/src/deep_neurographs/utils/img_util.py index ebabe8c..db50b06 100644 --- a/src/deep_neurographs/utils/img_util.py +++ b/src/deep_neurographs/utils/img_util.py @@ -390,6 +390,15 @@ def get_minimal_bbox(voxels, buffer=0): return bbox +def get_fixed_bbox(voxels, shape): + centroid = np.round(np.mean(voxels, axis=0)).astype(int) + bbox = { + "min": [centroid[i] - shape[i] // 2 for i in range(3)], + "max": [centroid[i] + shape[i] // 2 for i in range(3)], + } + return bbox + + def find_img_path(bucket_name, img_root, dataset_name): """ Find the path of a specific dataset in a GCS bucket.