Skip to content

Commit

Permalink
add unit test and modify readme
Browse files Browse the repository at this point in the history
Signed-off-by: Yiheng Wang <[email protected]>
  • Loading branch information
yiheng-wang-nv committed Aug 24, 2023
1 parent baf8b25 commit 7aedfc9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
19 changes: 19 additions & 0 deletions ci/unit_tests/test_spleen_deepedit_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,25 @@ def test_infer_config(self, override):
)
check_workflow(inferrer, check_properties=True)

@parameterized.expand([TEST_CASE_2])
def test_infer_click_config(self, override):
override["dataset_dir"] = self.dataset_dir
override["use_click"] = True
override[
"dataset#data"
] = "$[{'image': i, 'background': [], 'spleen': [[6, 6, 6], [8, 8, 8]]} for i in @datalist]"
bundle_root = override["bundle_root"]
print(override)

inferrer = ConfigWorkflow(
workflow="infer",
config_file=os.path.join(bundle_root, "configs/inference.json"),
logging_file=os.path.join(bundle_root, "configs/logging.conf"),
meta_file=os.path.join(bundle_root, "configs/metadata.json"),
**override,
)
check_workflow(inferrer, check_properties=True)


if __name__ == "__main__":
loader = unittest.TestLoader()
Expand Down
2 changes: 1 addition & 1 deletion models/spleen_deepedit_annotation/configs/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"pytorch_version": "1.13.1",
"numpy_version": "1.22.2",
"optional_packages_version": {
"nibabel": "4.0.1",
"itk": "5.3.0",
"pytorch-ignite": "0.4.9",
"scikit-image": "0.19.3"
},
Expand Down
6 changes: 2 additions & 4 deletions models/spleen_deepedit_annotation/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,10 @@ For interactive segmentation mode, in which the user provides clicks, set the **
python -m monai.bundle run --config_file configs/inference.json --use_click true
```

Clicks should be added to the data dictionary that is passed to the preprocessing transforms. Label names are the keys and their values are the clicks coordinates.

Like the following format:
Clicks should be added to the data dictionary that is passed to the preprocessing transforms. The add keys are defined in `label_names` in `configs/inference.json`, and the corresponding values are the clicks coordinates. The following is an example of a data dictionary:

```
data_dict = {'background': [], 'spleen': [[I1, J1, K1], [I2, J2, K2]]}
{"image": "example.nii.gz", "background": [], "spleen": [[I1, J1, K1], [I2, J2, K2]]}
```
where **[I1,J1,K1]** and **[I2,J2,K2]** are the point coordinates

Expand Down

0 comments on commit 7aedfc9

Please sign in to comment.