Skip to content

Commit

Permalink
Add no scribbles model (#1586)
Browse files Browse the repository at this point in the history
* Add no_scribbles model to remove the scribbles

Signed-off-by: Matthias Hadlich <[email protected]>

* Disable scribbles if flag is passed

Signed-off-by: Matthias Hadlich <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: Matthias Hadlich <[email protected]>

* Rework scribbles flag, now configurable via --conf

Signed-off-by: Matthias Hadlich <[email protected]>

* Update README for scribbles flag and change to MONAILabel semantics

Signed-off-by: Matthias Hadlich <[email protected]>

* Fix typos

Signed-off-by: Matthias Hadlich <[email protected]>

---------

Signed-off-by: Matthias Hadlich <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
matt3o and pre-commit-ci[bot] authored Nov 8, 2023
1 parent 5ef153f commit 071dc52
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
3 changes: 2 additions & 1 deletion sample-apps/radiology/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ the model to learn on new organ.
| Name | Values | Description |
|----------------------|--------------------|-----------------------------------------------------------------|
| use_pretrained_model | **true**, false | Disable this NOT to load any pretrained weights |
| preload | true, **false** | Preload model into GPU |
| preload | true, **false** | Preload model into GPU |
| scribbles | **true**, false | Don't load the scribble models, useful for user studies |

- Network: This model uses the [UNet](https://docs.monai.io/en/latest/networks.html#unet) as the default network. Researchers can define their own network or use one of the listed [here](https://docs.monai.io/en/latest/networks.html)
- Labels
Expand Down
43 changes: 23 additions & 20 deletions sample-apps/radiology/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __init__(self, app_dir, studies, conf):

models = models.split(",")
models = [m.strip() for m in models]
# Can be configured with --conf scribbles false or true
self.scribbles = conf.get("scribbles", "true") == "true"
invalid = [m for m in models if m != "all" and not configs.get(m)]
if invalid:
print("")
Expand Down Expand Up @@ -138,26 +140,27 @@ def init_infers(self) -> Dict[str, InferTask]:
#################################################
# Scribbles
#################################################
infers.update(
{
"Histogram+GraphCut": HistogramBasedGraphCut(
intensity_range=(-300, 200, 0.0, 1.0, True),
pix_dim=(2.5, 2.5, 5.0),
lamda=1.0,
sigma=0.1,
num_bins=64,
labels=task_config.labels,
),
"GMM+GraphCut": GMMBasedGraphCut(
intensity_range=(-300, 200, 0.0, 1.0, True),
pix_dim=(2.5, 2.5, 5.0),
lamda=5.0,
sigma=0.5,
num_mixtures=20,
labels=task_config.labels,
),
}
)
if self.scribbles:
infers.update(
{
"Histogram+GraphCut": HistogramBasedGraphCut(
intensity_range=(-300, 200, 0.0, 1.0, True),
pix_dim=(2.5, 2.5, 5.0),
lamda=1.0,
sigma=0.1,
num_bins=64,
labels=task_config.labels,
),
"GMM+GraphCut": GMMBasedGraphCut(
intensity_range=(-300, 200, 0.0, 1.0, True),
pix_dim=(2.5, 2.5, 5.0),
lamda=5.0,
sigma=0.5,
num_mixtures=20,
labels=task_config.labels,
),
}
)

#################################################
# Pipeline based on existing infers
Expand Down

0 comments on commit 071dc52

Please sign in to comment.