Skip to content

Commit 071dc52

Browse files
Add no scribbles model (#1586)
* 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>
1 parent 5ef153f commit 071dc52

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

sample-apps/radiology/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ the model to learn on new organ.
188188
| Name | Values | Description |
189189
|----------------------|--------------------|-----------------------------------------------------------------|
190190
| use_pretrained_model | **true**, false | Disable this NOT to load any pretrained weights |
191-
| preload | true, **false** | Preload model into GPU |
191+
| preload | true, **false** | Preload model into GPU |
192+
| scribbles | **true**, false | Don't load the scribble models, useful for user studies |
192193

193194
- 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)
194195
- Labels

sample-apps/radiology/main.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ def __init__(self, app_dir, studies, conf):
6666

6767
models = models.split(",")
6868
models = [m.strip() for m in models]
69+
# Can be configured with --conf scribbles false or true
70+
self.scribbles = conf.get("scribbles", "true") == "true"
6971
invalid = [m for m in models if m != "all" and not configs.get(m)]
7072
if invalid:
7173
print("")
@@ -138,26 +140,27 @@ def init_infers(self) -> Dict[str, InferTask]:
138140
#################################################
139141
# Scribbles
140142
#################################################
141-
infers.update(
142-
{
143-
"Histogram+GraphCut": HistogramBasedGraphCut(
144-
intensity_range=(-300, 200, 0.0, 1.0, True),
145-
pix_dim=(2.5, 2.5, 5.0),
146-
lamda=1.0,
147-
sigma=0.1,
148-
num_bins=64,
149-
labels=task_config.labels,
150-
),
151-
"GMM+GraphCut": GMMBasedGraphCut(
152-
intensity_range=(-300, 200, 0.0, 1.0, True),
153-
pix_dim=(2.5, 2.5, 5.0),
154-
lamda=5.0,
155-
sigma=0.5,
156-
num_mixtures=20,
157-
labels=task_config.labels,
158-
),
159-
}
160-
)
143+
if self.scribbles:
144+
infers.update(
145+
{
146+
"Histogram+GraphCut": HistogramBasedGraphCut(
147+
intensity_range=(-300, 200, 0.0, 1.0, True),
148+
pix_dim=(2.5, 2.5, 5.0),
149+
lamda=1.0,
150+
sigma=0.1,
151+
num_bins=64,
152+
labels=task_config.labels,
153+
),
154+
"GMM+GraphCut": GMMBasedGraphCut(
155+
intensity_range=(-300, 200, 0.0, 1.0, True),
156+
pix_dim=(2.5, 2.5, 5.0),
157+
lamda=5.0,
158+
sigma=0.5,
159+
num_mixtures=20,
160+
labels=task_config.labels,
161+
),
162+
}
163+
)
161164

162165
#################################################
163166
# Pipeline based on existing infers

0 commit comments

Comments
 (0)