示例#1
0
 def __call__(self, data):
     d = dict(data)
     self.randomize()
     if not self._do_transform:
         return d
     scaler = ScaleIntensity(minv=None, maxv=None, factor=self.factor)
     for key in self.keys:
         d[key] = scaler(d[key])
     return d
示例#2
0
 def __call__(self, data: Mapping[Hashable, np.ndarray]) -> Dict[Hashable, np.ndarray]:
     d = dict(data)
     self.randomize()
     if not self._do_transform:
         return d
     scaler = ScaleIntensity(minv=None, maxv=None, factor=self.factor)
     for key in self.keys:
         d[key] = scaler(d[key])
     return d
示例#3
0
文件: dictionary.py 项目: w-j-p/MONAI
    def __init__(self, keys, minv=0.0, maxv=1.0, factor=None):
        """
        Args:
            keys (hashable items): keys of the corresponding items to be transformed.
                See also: :py:class:`monai.transforms.compose.MapTransform`
            minv (int or float): minimum value of output data.
            maxv (int or float): maximum value of output data.
            factor (float): factor scale by ``v = v * (1 + factor)``.

        """
        super().__init__(keys)
        self.scaler = ScaleIntensity(minv, maxv, factor)
示例#4
0
 def __init__(
     self,
     min_perc: float,
     max_perc: float,
     minmax: bool = False,
 ) -> None:
     super().__init__()
     self.min_perc = min_perc
     self.max_perc = max_perc
     if minmax:
         self.converter = ScaleIntensity(minv=0.0, maxv=1.0)
     else:
         self.converter = NormalizeIntensity()
示例#5
0
    def __init__(
        self, keys: KeysCollection, minv: float = 0.0, maxv: float = 1.0, factor: Optional[float] = None
    ) -> None:
        """
        Args:
            keys: keys of the corresponding items to be transformed.
                See also: :py:class:`monai.transforms.compose.MapTransform`
            minv: minimum value of output data.
            maxv: maximum value of output data.
            factor: factor scale by ``v = v * (1 + factor)``.

        """
        super().__init__(keys)
        self.scaler = ScaleIntensity(minv, maxv, factor)
示例#6
0
    def __init__(
        self,
        keys: KeysCollection,
        minv: Optional[float] = 0.0,
        maxv: Optional[float] = 1.0,
        factor: Optional[float] = None,
        allow_missing_keys: bool = False,
    ) -> None:
        """
        Args:
            keys: keys of the corresponding items to be transformed.
                See also: :py:class:`monai.transforms.compose.MapTransform`
            minv: minimum value of output data.
            maxv: maximum value of output data.
            factor: factor scale by ``v = v * (1 + factor)``. In order to use
                this parameter, please set `minv` and `maxv` into None.
            allow_missing_keys: don't raise exception if key is missing.

        """
        super().__init__(keys, allow_missing_keys)
        self.scaler = ScaleIntensity(minv, maxv, factor)