Skip to content

Add ValueError in GenerateSuccinctContour#5719

Merged
wyli merged 5 commits intoProject-MONAI:devfrom
KumoLiu:generatesuccinctcontour
Dec 13, 2022
Merged

Add ValueError in GenerateSuccinctContour#5719
wyli merged 5 commits intoProject-MONAI:devfrom
KumoLiu:generatesuccinctcontour

Conversation

@KumoLiu
Copy link
Copy Markdown
Contributor

@KumoLiu KumoLiu commented Dec 13, 2022

Signed-off-by: KumoLiu [email protected]

Fixes #5714.

Description

Add ValueError when an invalid contour is generated.

Types of changes

  • 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: KumoLiu <[email protected]>
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Dec 13, 2022

/build

@wyli wyli enabled auto-merge (squash) December 13, 2022 10:21
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Dec 13, 2022

/build

@wyli wyli merged commit 2b160b3 into Project-MONAI:dev Dec 13, 2022
@KumoLiu KumoLiu deleted the generatesuccinctcontour branch December 13, 2022 13:25
@bhashemian
Copy link
Copy Markdown
Member

bhashemian commented Dec 13, 2022

@KumoLiu maybe it is not the best option to raise ValueError. It will interrupt the whole pipeline because of one faulty contour in one image. Also what the user should do with this information? For instance, I am getting this now:

2022-12-13 21:09:05,835 - ignite.engine.engine.SupervisedEvaluator - ERROR - Current run is terminating due to exception: applying transform <monai.transforms.compose.Compose object at 0x7f3490071b20>
2022-12-13 21:09:05,862 - ignite.engine.engine.SupervisedEvaluator - ERROR - Engine run is terminating due to exception: applying transform <monai.transforms.compose.Compose object at 0x7f3490071b20>
Traceback (most recent call last):
  File "/home/bhashemian/workspace/MONAI/monai/transforms/transform.py", line 102, in apply_transform
    return _apply_transform(transform, data, unpack_items)
  File "/home/bhashemian/workspace/MONAI/monai/transforms/transform.py", line 66, in _apply_transform
    return transform(parameters)
  File "/home/bhashemian/workspace/MONAI/monai/apps/pathology/transforms/post/dictionary.py", line 535, in __call__
    d[self.instance_info_key], d[self.instance_map_key] = self.instance_map_post_process(
  File "/home/bhashemian/workspace/MONAI/monai/apps/pathology/transforms/post/array.py", line 735, in __call__
    instance_contour = self.generate_instance_contour(instance_mask, offset)
  File "/home/bhashemian/workspace/MONAI/monai/apps/pathology/transforms/post/array.py", line 561, in __call__
    inst_contour = generate_contour(inst_contour_cv)
  File "/home/bhashemian/workspace/MONAI/monai/apps/pathology/transforms/post/array.py", line 462, in __call__
    raise ValueError(
ValueError: Invalid coutour coord [ 1.  13.5] is generated, areas may contain boundaries or small holes

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Dec 14, 2022

this value error might be too restrictive? shall we revert this PR? also there's a typo coutour -> contour.

wyli added a commit that referenced this pull request Dec 14, 2022
wyli added a commit that referenced this pull request Dec 14, 2022
This reverts commit 2b160b3.

Fixes
#5719 (comment)


### 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pixel variable can be undefined

3 participants