          :class:`numpy.ndarray`
              The (`left`, `top`, `right`, `bottom` location of the region of interest within an
              aligned face centered on the head for the given centering
          """
          with self._cache["cropped_roi"][1]:
              if centering not in self._cache["cropped_roi"][0]:
                  offset = self.pose.offset.get(centering, np.float32((0, 0)))  # legacy = 0.0
                  adjusted = offset - self.pose.offset["head"]
                  adjusted *= (self._head_size - (self._head_size * _EXTRACT_RATIOS["head"]))
  
                  center = np.rint(adjusted + self._head_size / 2).astype("int32")
                  padding = self.size // 2
                  roi = np.array([center - padding, center + padding]).ravel()
                  logger.trace("centering: '%s', center: %s, padding: %s, sub roi: %s",
                               centering, center, padding, roi)
                  self._cache["cropped_roi"][0][centering] = roi
          return self._cache["cropped_roi"][0][centering]
 
</s> remove                 logger.trace("centering: '%s', center: %s, padding: %s, sub roi: %s",
                             centering, center, padding, roi)
                self._cache["cropped_roi"][0][centering] = roi
        return self._cache["cropped_roi"][0][centering]

    def _get_cropped_slices(self):
        """ Obtain the slices to turn a full head extract into an alternatively centered extract.

        Returns
        -------
        dict
            The slices for an input full head image and output cropped image
        """
        with self._cache["cropped_slices"][1]:
            if not self._cache["cropped_slices"][0].get(self._centering):
                roi = self.get_cropped_roi(self._centering)
                slice_in = [slice(max(roi[1], 0), max(roi[3], 0)),
                            slice(max(roi[0], 0), max(roi[2], 0))]
                slice_out = [slice(max(roi[1] * -1, 0),
                                   self._size - min(self._size, max(0, roi[3] - self._head_size))),
                             slice(max(roi[0] * -1, 0),
                                   self._size - min(self._size, max(0, roi[2] - self._head_size)))]
                self._cache["cropped_slices"][0][self._centering] = {"in": slice_in,
                                                                     "out": slice_out}
                logger.trace("centering: %s, cropped_slices: %s",
                             self._centering, self._cache["cropped_slices"][0][self._centering])
        return self._cache["cropped_slices"][0][self._centering]
 </s> add                 logger.trace("centering: '%s', center: %s, padding: %s, "  # type: ignore
                             "sub roi: %s", centering, center, padding, roi)
                self._cache.cropped_roi[centering] = roi
        return self._cache.cropped_roi[centering] </s> remove         retval = {_type: round((size * (coverage_ratio - (1 - _EXTRACT_RATIOS[_type]))) / 2)
                  for _type in ("legacy", "face", "head")}
        logger.trace(retval)
        return retval

    def get_cropped_roi(self, centering):
 </s> add         with self._cache.lock("cropped_slices"):
            if not self._cache.cropped_slices.get(self._centering):
                roi = self.get_cropped_roi(image_size, target_size, self._centering)
                slice_in = (slice(max(roi[1], 0), max(roi[3], 0)),
                            slice(max(roi[0], 0), max(roi[2], 0)))
                slice_out = (slice(max(roi[1] * -1, 0),
                                   target_size - min(target_size, max(0, roi[3] - image_size))),
                             slice(max(roi[0] * -1, 0),
                                   target_size - min(target_size, max(0, roi[2] - image_size))))
                self._cache.cropped_slices[self._centering] = {"in": slice_in, "out": slice_out}
                logger.trace("centering: %s, cropped_slices: %s",  # type: ignore
                             self._centering, self._cache.cropped_slices[self._centering])
        return self._cache.cropped_slices[self._centering]

    def get_cropped_roi(self,
                        image_size: int,
                        target_size: int,
                        centering: CenteringType) -> np.ndarray: </s> remove                 logger.trace("original roi: %s", roi)
                self._cache["original_roi"][0] = roi
        return self._cache["original_roi"][0]
 </s> add                 logger.trace("original roi: %s", roi)  # type: ignore
                self._cache.original_roi = roi
        return self._cache.original_roi[0] </s> remove         with self._cache["original_roi"][1]:
            if self._cache["original_roi"][0] is None:
 </s> add         with self._cache.lock("original_roi"):
            if self._cache.original_roi is None: </s> remove                 logger.trace("adjusted_matrix: %s", mat)
                self._cache["adjusted_matrix"][0] = mat
        return self._cache["adjusted_matrix"][0]
 </s> add                 logger.trace("adjusted_matrix: %s", mat)  # type: ignore
                self._cache.adjusted_matrix = mat
        return self._cache.adjusted_matrix
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
          :class:`numpy.ndarray`
              The (`left`, `top`, `right`, `bottom` location of the region of interest within an
              aligned face centered on the head for the given centering
          """
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
        with self._cache.lock("cropped_roi"):
            if centering not in self._cache.cropped_roi:
                center = get_adjusted_center(image_size,
                                             self.pose.offset[self._source_centering],
                                             self.pose.offset[self.centering],
                                             self._source_centering)
                padding = target_size // 2
                  roi = np.array([center - padding, center + padding]).ravel()
                  logger.trace("centering: '%s', center: %s, padding: %s, sub roi: %s",
                               centering, center, padding, roi)
                  self._cache["cropped_roi"][0][centering] = roi
          return self._cache["cropped_roi"][0][centering]
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 lib.align.aligned_face updates
  - Typing
  - Legacy support for pre-aligned faces
  - Coverage support for pre-aligned faces
  - Standardized retrieval of sub-crops 
lib/align/aligned_face.py