Exemplo n.º 1
0
 def _align(self, frame, displacement):
     if displacement.ndim == 3:
         return _align_frame(frame.astype(float), displacement,
                             self._frame_shape)
     elif displacement.ndim == 2:
         out = np.nan * np.ones(self._frame_shape)
         s = frame.shape[1:]
         for p, (plane, disp) in enumerate(it.izip(frame, displacement)):
             out[p, disp[0]:(disp[0]+s[0]), disp[1]:(disp[1]+s[1])] = plane
         return out
Exemplo n.º 2
0
 def _align(self, frame, displacement):
     if displacement.ndim == 3:
         return _align_frame(frame.astype(float), displacement.astype(int),
                             self._frame_shape)
     elif displacement.ndim == 2:  # plane-wise displacement
         out = np.nan * np.ones(self._frame_shape)
         s = frame.shape
         for p, (plane, disp) in enumerate(zip(frame, displacement)):
             if len(disp) == 2:
                 disp = [0] + list(disp)
             out[p + disp[0], disp[1]:(disp[1] + s[1]),
                 disp[2]:(disp[2] + s[2])] = plane
         return out
     elif displacement.ndim == 1:  # frame-wise displacement
         out = np.nan * np.ones(self._frame_shape)
         s = frame.shape
         out[displacement[0]:(displacement[0] + s[0]),
             displacement[1]:(displacement[1] + s[1]),
             displacement[2]:(displacement[2] + s[2])] = frame
         return out
Exemplo n.º 3
0
 def _align(self, frame, displacement):
     if displacement.ndim == 3:
         return _align_frame(frame.astype(float), displacement.astype(int), self._frame_shape)
     elif displacement.ndim == 2:  # plane-wise displacement
         out = np.nan * np.ones(self._frame_shape)
         s = frame.shape
         for p, (plane, disp) in enumerate(zip(frame, displacement)):
             if len(disp) == 2:
                 disp = [0] + list(disp)
             out[p + disp[0], disp[1] : (disp[1] + s[1]), disp[2] : (disp[2] + s[2])] = plane
         return out
     elif displacement.ndim == 1:  # frame-wise displacement
         out = np.nan * np.ones(self._frame_shape)
         s = frame.shape
         out[
             displacement[0] : (displacement[0] + s[0]),
             displacement[1] : (displacement[1] + s[1]),
             displacement[2] : (displacement[2] + s[2]),
         ] = frame
         return out