Skip to content

Commit 30cd2c7

Browse files
committed
Update dictionary wrapper to accept et_label
Signed-off-by: Abdessamad <abdoomis6@gmail.com>
1 parent 63bc590 commit 30cd2c7

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

monai/transforms/utility/dictionary.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,19 +1297,27 @@ def __call__(self, data: Mapping[Hashable, Any]):
12971297
class ConvertToMultiChannelBasedOnBratsClassesd(MapTransform):
12981298
"""
12991299
Dictionary-based wrapper of :py:class:`monai.transforms.ConvertToMultiChannelBasedOnBratsClasses`.
1300-
Convert labels to multi channels based on brats18 classes:
1300+
Convert labels to multi channels based on brats classes:
13011301
label 1 is the necrotic and non-enhancing tumor core
13021302
label 2 is the peritumoral edema
13031303
label 4 is the GD-enhancing tumor
13041304
The possible classes are TC (Tumor core), WT (Whole tumor)
13051305
and ET (Enhancing tumor).
1306+
1307+
Args:
1308+
keys: keys of the corresponding items to be transformed.
1309+
et_label: the label used for the GD-enhancing tumor (ET).
1310+
- Use 4 for BraTS 2018-2022.
1311+
- Use 3 for BraTS 2023.
1312+
Defaults to 4.
1313+
allow_missing_keys: don't raise exception if key is missing.
13061314
"""
13071315

13081316
backend = ConvertToMultiChannelBasedOnBratsClasses.backend
13091317

1310-
def __init__(self, keys: KeysCollection, allow_missing_keys: bool = False):
1318+
def __init__(self, keys: KeysCollection, et_label: int = 4, allow_missing_keys: bool = False):
13111319
super().__init__(keys, allow_missing_keys)
1312-
self.converter = ConvertToMultiChannelBasedOnBratsClasses()
1320+
self.converter = ConvertToMultiChannelBasedOnBratsClasses(et_label=et_label)
13131321

13141322
def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
13151323
d = dict(data)

0 commit comments

Comments
 (0)