Skip to content

Commit 029b6a0

Browse files
authored
[DLMED] update to adapt to MetaTensor and fixed a bug in customized component (#810)
Signed-off-by: Nic Ma <[email protected]>
1 parent 0dc8cae commit 029b6a0

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"train#preprocessing#transforms#6":
2+
"train#deterministic_transforms#0":
33
{
4-
"_target_": "scripts.custom_transforms.PrintEnsureTyped",
4+
"_target_": "scripts.custom_transforms.LoadImagePrintd",
55
"keys": ["image", "label"]
66
}
77
}

modules/bundle/custom_component/scripts/custom_transforms.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
# limitations under the License.
1111

1212
from monai.config import KeysCollection
13-
from monai.transforms import EnsureTyped
13+
from monai.transforms import LoadImaged
1414

1515

16-
class PrintEnsureTyped(EnsureTyped):
16+
class LoadImagePrintd(LoadImaged):
1717
"""
18-
Extend the `EnsureTyped` transform to print the image shape.
18+
Transform to load image and print the image shape.
1919
2020
Args:
2121
keys: keys of the corresponding items to be transformed.
2222
2323
"""
2424

25-
def __init__(self, keys: KeysCollection, data_type: str = "tensor") -> None:
26-
super().__init__(keys, data_type=data_type)
25+
def __init__(self, keys: KeysCollection) -> None:
26+
super().__init__(keys)
2727

2828
def __call__(self, data):
2929
d = dict(super().__call__(data=data))

modules/bundle/hybrid_programming/configs/data_loading.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
"b_min": 0,
3131
"b_max": 1,
3232
"clip": true
33-
},
34-
{
35-
"_target_": "EnsureTyped",
36-
"keys": "@image_key"
3733
}
3834
]
3935
},

modules/bundle/spleen_segmentation/configs/train.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@
6363
"b_min": 0,
6464
"b_max": 1,
6565
"clip": true
66-
},
67-
{
68-
"_target_": "EnsureTyped",
69-
"keys": ["image", "label"]
7066
}
7167
],
7268
"random_transforms": [

0 commit comments

Comments
 (0)