class_docstr: The post-processing transform for HoVerNet model to generate nuclear type information.
  It updates the input instance info dictionary with information about types of the nuclei (value and probability).
  Also if requested (`return_type_map=True`), it generates a pixel-level type map.
  
  Args:
      activation: the activation layer to be applied on nuclear type branch. It can be "softmax" or "sigmoid" string,
          or any callable. Defaults to "softmax".
      threshold: an optional float value to threshold to binarize probability map.
          If not provided, defaults to 0.5 when activation is not "softmax", otherwise None.
      return_type_map: whether to calculate and return pixel-level type map.
      device: target device to put the output Tensor data.
class_docstr_tok: ["The","post-processing","transform","for","HoVerNet","model","to","generate","nuclear","type","information",".","It","updates","the","input","instance","info","dictionary","with","information","about","types","of","the","nuclei","(","value","and","probability",")",".","Also","if","requested","(","`","return_type_map=True","`",")",",","it","generates","a","pixel-level","type","map",".","Args",":","activation",":","the","activation","layer","to","be","applied","on","nuclear","type","branch",".","It","can","be","``","softmax","''","or","``","sigmoid","''","string",",","or","any","callable",".","Defaults","to","``","softmax","''",".","threshold",":","an","optional","float","value","to","threshold","to","binarize","probability","map",".","If","not","provided",",","defaults","to","0.5","when","activation","is","not","``","softmax","''",",","otherwise","None",".","return_type_map",":","whether","to","calculate","and","return","pixel-level","type","map",".","device",":","target","device","to","put","the","output","Tensor","data","."]
docstr: Process NC (type prediction) branch and combine it with instance segmentation
  It updates the instance_info with instance type and associated probability, and generate instance type map.
  
  Args:
      instance_info: instance information dictionary, the output of :py:class:`HoVerNetInstanceMapPostProcessing`
      instance_map: instance segmentation map, the output of :py:class:`HoVerNetInstanceMapPostProcessing`
      type_prediction: the output of NC (type prediction) branch of HoVerNet model
docstr_tok: ["Process","NC","(","type","prediction",")","branch","and","combine","it","with","instance","segmentation","It","updates","the","instance_info","with","instance","type","and","associated","probability",",","and","generate","instance","type","map",".","Args",":","instance_info",":","instance","information","dictionary",",","the","output","of",":","py",":","class",":","`","HoVerNetInstanceMapPostProcessing","`","instance_map",":","instance","segmentation","map",",","the","output","of",":","py",":","class",":","`","HoVerNetInstanceMapPostProcessing","`","type_prediction",":","the","output","of","NC","(","type","prediction",")","branch","of","HoVerNet","model"]
code: def __call__(  # type: ignore
      self,
      type_prediction: NdarrayOrTensor,
      instance_info: dict[int, dict],
      instance_map: NdarrayOrTensor,
  ) -> tuple[dict, NdarrayOrTensor | None]:
      """Process NC (type prediction) branch and combine it with instance segmentation
      It updates the instance_info with instance type and associated probability, and generate instance type map.
  
      Args:
          instance_info: instance information dictionary, the output of :py:class:`HoVerNetInstanceMapPostProcessing`
          instance_map: instance segmentation map, the output of :py:class:`HoVerNetInstanceMapPostProcessing`
          type_prediction: the output of NC (type prediction) branch of HoVerNet model
      """
      type_prediction = self.activation(type_prediction)
      type_prediction = self.as_discrete(type_prediction)
  
      type_map = None
      if self.return_type_map:
          type_map = convert_to_dst_type(
              torch.zeros(instance_map.shape), instance_map
          )[0]
  
      for inst_id in instance_info:
          (
              instance_type,
              instance_type_prob,
          ) = self.generate_instance_type(
              type_pred=type_prediction,
              seg_pred=instance_map,
              bbox=instance_info[inst_id]["bounding_box"],
              instance_id=inst_id,
          )
          # update instance info dict with type data
          instance_info[inst_id]["type_prob"] = instance_type_prob
          instance_info[inst_id]["type"] = instance_type
  
          # update instance type map
          if type_map is not None:
              type_map[instance_map == inst_id] = instance_type
              type_map = convert_to_tensor(type_map, device=self.device)
  
      return instance_info, type_map
  
imports: from __future__ import annotations
  import warnings
  from typing import Callable, Sequence
  import numpy
  import torch
  from monai.config.type_definitions import DtypeLike, NdarrayOrTensor
  from monai.transforms import Activations, AsDiscrete, BoundingRect, FillHoles, GaussianSmooth, RemoveSmallObjects, SobelGradients
  from monai.transforms.transform import Transform
  from monai.transforms.utils_pytorch_numpy_unification import max, maximum, min, sum, unique
  from monai.utils import TransformBackends, convert_to_numpy, optional_import
  from monai.utils.misc import ensure_tuple_rep
  from monai.utils.type_conversion import convert_to_dst_type, convert_to_tensor
label_desc: Use image node_id 2 for calling the HoVerNetNuclearTypePostProcessing obj's underlying member method code with example usage: obj.__call__(type_prediction, instance_info, instance_map) and returns: instance_info,  type_map