2828 ScaleIntensityd ,
2929 ScaleIntensityRanged ,
3030)
31- from monai .utils import BundleProperty , set_determinism , CommonKeys
31+ from monai .utils import BundleProperty , CommonKeys , set_determinism
3232
3333
3434class NonConfigWorkflow (BundleWorkflow ):
@@ -184,8 +184,16 @@ class PythonicWorkflowImpl(PythonicWorkflow):
184184 Test class simulates the bundle workflow defined by Python script directly.
185185 """
186186
187- def __init__ (self , workflow_type : str = "inference" , config_file : str | None = None , properties_path : str | None = None , meta_file : str | None = None ):
188- super ().__init__ (workflow_type = workflow_type , properties_path = properties_path , config_file = config_file , meta_file = meta_file )
187+ def __init__ (
188+ self ,
189+ workflow_type : str = "inference" ,
190+ config_file : str | None = None ,
191+ properties_path : str | None = None ,
192+ meta_file : str | None = None ,
193+ ):
194+ super ().__init__ (
195+ workflow_type = workflow_type , properties_path = properties_path , config_file = config_file , meta_file = meta_file
196+ )
189197 self .dataflow = {}
190198
191199 def initialize (self ):
@@ -204,16 +212,8 @@ def initialize(self):
204212 ScaleIntensityRanged (keys = "image" , a_min = - 57 , a_max = 164 , b_min = 0.0 , b_max = 1.0 , clip = True ),
205213 ]
206214 )
207- self .dataset = Dataset (
208- data = [self .dataflow ],
209- transform = preprocessing ,
210- )
211- self .postprocessing = Compose (
212- [
213- Activationsd (keys = "pred" , softmax = True ),
214- AsDiscreted (keys = "pred" , argmax = True ),
215- ]
216- )
215+ self .dataset = Dataset (data = [self .dataflow ], transform = preprocessing )
216+ self .postprocessing = Compose ([Activationsd (keys = "pred" , softmax = True ), AsDiscreted (keys = "pred" , argmax = True )])
217217 self .inferer = SlidingWindowInferer (roi_size = self .parser .roi_size , sw_batch_size = 1 , overlap = 0 )
218218
219219 def run (self ):
@@ -232,6 +232,6 @@ def get_bundle_root(self):
232232
233233 def get_device (self ):
234234 return torch .device ("cuda" if torch .cuda .is_available () else "cpu" )
235-
235+
236236 def get_inferer (self ):
237237 return self .inferer
0 commit comments