99# See the License for the specific language governing permissions and
1010# limitations under the License.
1111
12- from monai .deploy .operators .monai_bundle_inference_operator import MonaiBundleInferenceOperator , get_bundle_config
13- from monai .deploy .utils .importutil import optional_import
1412from typing import Any , Dict , Tuple , Union
13+
1514from monai .deploy .core import Image
15+ from monai .deploy .operators .monai_bundle_inference_operator import MonaiBundleInferenceOperator , get_bundle_config
16+ from monai .deploy .utils .importutil import optional_import
1617
1718MONAI_UTILS = "monai.utils"
1819nibabel , _ = optional_import ("nibabel" , "3.2.1" )
@@ -44,12 +45,12 @@ class MONetBundleInferenceOperator(MonaiBundleInferenceOperator):
4445 This operator extends the `MonaiBundleInferenceOperator` to support nnUNet-specific
4546 configurations and prediction logic. It initializes the nnUNet predictor and provides
4647 a method for performing inference on input data.
47-
48+
4849 Attributes
4950 ----------
5051 _nnunet_predictor : torch.nn.Module
5152 The nnUNet predictor module used for inference.
52-
53+
5354 Methods
5455 -------
5556 _init_config(config_names)
@@ -65,16 +66,14 @@ def __init__(
6566 ** kwargs ,
6667 ):
6768
68-
6969 super ().__init__ (* args , ** kwargs )
70-
71- self ._nnunet_predictor : torch .nn .Module = None
72-
73-
74- def _init_config (self , config_names ):
70+
71+ self ._nnunet_predictor : torch .nn .Module = None
72+
73+ def _init_config (self , config_names ):
7574
7675 super ()._init_config (config_names )
77- parser = get_bundle_config (str (self ._bundle_path ), config_names )
76+ parser = get_bundle_config (str (self ._bundle_path ), config_names )
7877 self ._parser = parser
7978
8079 self ._nnunet_predictor = parser .get_parsed_content ("network_def" )
@@ -83,7 +82,7 @@ def predict(self, data: Any, *args, **kwargs) -> Union[Image, Any, Tuple[Any, ..
8382 """Predicts output using the inferer."""
8483
8584 self ._nnunet_predictor .predictor .network = self ._model_network
86- #os.environ['nnUNet_def_n_proc'] = "1"
85+ # os.environ['nnUNet_def_n_proc'] = "1"
8786 if len (data .shape ) == 4 :
8887 data = data [None ]
8988 return self ._nnunet_predictor (data )
0 commit comments