Skip to content

Commit cc171a8

Browse files
Throw error with description when there are no valid user click/signals (#5598)
Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com> Fixes # . Throw error with description when there are no valid user click/signals ### Description Instead of torch.stack error, provide readable description when the signal is not valid, and no valid bounding boxes could be created based on user click points. A few sentences describing the changes proposed in this pull request. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Sachidanand Alle <sachidanand.alle@gmail.com>
1 parent 0c2fbac commit cc171a8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

monai/apps/nuclick/transforms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ def __call__(self, data):
437437
cy = [xy[1] for xy in pos]
438438

439439
click_map, bounding_boxes = self.get_clickmap_boundingbox(img, cx=cx, cy=cy, x=x, y=y, bb=self.bb_size)
440+
if not bounding_boxes:
441+
raise ValueError("Failed to create patches from given click points")
440442

441443
patches = self.get_patches_and_signals(
442444
img=img, click_map=click_map, bounding_boxes=bounding_boxes, cx=cx, cy=cy, x=x, y=y

0 commit comments

Comments
 (0)