Ejemplo n.º 1
0
 def __call__(self, data):
     self.randomize()
     d = dict(data)
     if not self._do_transform:
         return d
     rotator = Rotate(self.angle, self.spatial_axes, self.reshape, self.order, self.mode, self.cval, self.prefilter)
     for key in self.keys:
         d[key] = rotator(d[key])
     return d
Ejemplo n.º 2
0
 def __call__(self, data):
     self.randomize()
     d = dict(data)
     if not self._do_transform:
         return d
     rotator = Rotate(
         angle=self.x if d[self.keys[0]].ndim == 3 else (self.x, self.y, self.z), keep_size=self.keep_size,
     )
     for idx, key in enumerate(self.keys):
         d[key] = rotator(
             d[key], mode=self.mode[idx], padding_mode=self.padding_mode[idx], align_corners=self.align_corners[idx],
         )
     return d
Ejemplo n.º 3
0
 def __init__(
     self, keys, angle, spatial_axes=(0, 1), reshape=True, order=1, mode="constant", cval=0, prefilter=True
 ):
     super().__init__(keys)
     self.rotator = Rotate(
         angle=angle,
         spatial_axes=spatial_axes,
         reshape=reshape,
         order=order,
         mode=mode,
         cval=cval,
         prefilter=prefilter,
     )
Ejemplo n.º 4
0
    def __init__(
        self,
        keys: KeysCollection,
        angle: Union[Sequence[float], float],
        keep_size: bool = True,
        mode: GridSampleModeSequence = GridSampleMode.BILINEAR,
        padding_mode: GridSamplePadModeSequence = GridSamplePadMode.BORDER,
        align_corners: Union[Sequence[bool], bool] = False,
    ):
        super().__init__(keys)
        self.rotator = Rotate(angle=angle, keep_size=keep_size)

        self.mode = ensure_tuple_rep(mode, len(self.keys))
        self.padding_mode = ensure_tuple_rep(padding_mode, len(self.keys))
        self.align_corners = ensure_tuple_rep(align_corners, len(self.keys))
Ejemplo n.º 5
0
 def __call__(self, data):
     self.randomize()
     d = dict(data)
     if not self._do_transform:
         return d
     rotator = Rotate(angle=self.angle,
                      spatial_axes=self.spatial_axes,
                      reshape=self.reshape)
     for idx, key in enumerate(self.keys):
         d[key] = rotator(d[key],
                          order=self.order[idx],
                          mode=self.mode[idx],
                          cval=self.cval[idx],
                          prefilter=self.prefilter[idx])
     return d
Ejemplo n.º 6
0
    def __init__(
        self,
        keys: KeysCollection,
        angle,
        keep_size: bool = True,
        interp_order: str = "bilinear",
        mode: str = "border",
        align_corners: bool = False,
    ):
        super().__init__(keys)
        self.rotator = Rotate(angle=angle,
                              keep_size=keep_size,
                              align_corners=align_corners)

        self.interp_order = ensure_tuple_rep(interp_order, len(self.keys))
        self.mode = ensure_tuple_rep(mode, len(self.keys))
Ejemplo n.º 7
0
    def __init__(self,
                 keys,
                 angle,
                 spatial_axes=(0, 1),
                 reshape=True,
                 order=1,
                 mode="constant",
                 cval=0,
                 prefilter=True):
        super().__init__(keys)
        self.rotator = Rotate(angle=angle,
                              spatial_axes=spatial_axes,
                              reshape=reshape)

        self.order = ensure_tuple_rep(order, len(self.keys))
        self.mode = ensure_tuple_rep(mode, len(self.keys))
        self.cval = ensure_tuple_rep(cval, len(self.keys))
        self.prefilter = ensure_tuple_rep(prefilter, len(self.keys))
Ejemplo n.º 8
0
    def __init__(
        self,
        keys,
        angle,
        spatial_axes=(0, 1),
        reshape=True,
        interp_order=InterpolationCode.LINEAR,
        mode="constant",
        cval=0,
        prefilter=True,
    ):
        super().__init__(keys)
        self.rotator = Rotate(angle=angle, spatial_axes=spatial_axes, reshape=reshape)

        self.interp_order = ensure_tuple_rep(interp_order, len(self.keys))
        self.mode = ensure_tuple_rep(mode, len(self.keys))
        self.cval = ensure_tuple_rep(cval, len(self.keys))
        self.prefilter = ensure_tuple_rep(prefilter, len(self.keys))