Skip to content

Commit b01a3a8

Browse files
Remove SimpleITK image handling from MonaiBundleInferenceOperator
Signed-off-by: Simone Bendazzoli <[email protected]>
1 parent 6496e55 commit b01a3a8

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

monai/deploy/operators/monai_bundle_inference_operator.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
from typing import Any, Dict, List, Optional, Tuple, Type, Union
2323

2424
import numpy as np
25-
2625
import SimpleITK
2726
from SimpleITK import Image as SimpleITKImage
27+
2828
from monai.deploy.core import AppContext, Fragment, Image, IOType, OperatorSpec
2929
from monai.deploy.utils.importutil import optional_import
3030

@@ -705,16 +705,6 @@ def _receive_input(self, name: str, op_input, context):
705705
logging.debug(f"Metadata of the converted input image: {metadata}")
706706
elif isinstance(value, np.ndarray):
707707
value = torch.from_numpy(value).to(self._device)
708-
elif isinstance(value, SimpleITKImage):
709-
metadata = {}
710-
metadata["pixdim"] = np.asarray(value.GetSpacing())
711-
metadata["origin"] = np.asarray(value.GetOrigin())
712-
metadata["direction"] = np.asarray(value.GetDirection())
713-
if len(value.GetSize()) == 3:
714-
metadata["pixdim"] = np.insert(np.asarray(value.GetSpacing()), 0, 1.0)
715-
value = np.transpose(SimpleITK.GetArrayFromImage(value), [2, 1, 0])
716-
else:
717-
value = np.transpose(SimpleITK.GetArrayFromImage(value), [0, 3, 2, 1])
718708

719709
# else value is some other object from memory
720710

0 commit comments

Comments
 (0)