MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / __call__

Method __call__

monai/handlers/probability_maps.py:98–115  ·  view source on GitHub ↗

This method assumes self.batch_transform will extract metadata from the input batch. Args: engine: Ignite Engine, it can be a trainer, validator or evaluator.

(self, engine: Engine)

Source from the content-addressed store, hash-verified

96 engine.add_event_handler(Events.COMPLETED, self.finalize)
97
98 def __call__(self, engine: Engine) -> None:
99 """
100 This method assumes self.batch_transform will extract metadata from the input batch.
101
102 Args:
103 engine: Ignite Engine, it can be a trainer, validator or evaluator.
104 """
105 if not isinstance(engine.state.batch, dict) or not isinstance(engine.state.output, dict):
106 raise ValueError("engine.state.batch and engine.state.output must be dictionaries.")
107 names = engine.state.batch[CommonKeys.IMAGE].meta[ProbMapKeys.NAME]
108 locs = engine.state.batch[CommonKeys.IMAGE].meta[ProbMapKeys.LOCATION]
109 probs = engine.state.output[self.prob_key]
110 for name, loc, prob in zip(names, locs, probs):
111 self.prob_map[name][tuple(loc)] = prob
112 with self.lock:
113 self.counter[name] -= 1
114 if self.counter[name] == 0:
115 self.save_prob_map(name)
116
117 def save_prob_map(self, name: str) -> None:
118 """

Callers

nothing calls this directly

Calls 1

save_prob_mapMethod · 0.95

Tested by

no test coverage detected