code: def compute_two_dimensional_near_isotropic_downsampling_scales(
          size,
          voxel_size,
          max_scales=float('inf'),
          max_downsampling=DEFAULT_MAX_DOWNSAMPLING,
          max_downsampled_size=DEFAULT_MAX_DOWNSAMPLED_SIZE):
      
  
      max_scales = min(max_scales, 10)
  
      # First compute a set of 2-d downsamplings for XY, XZ, and YZ with a high
      # number of max_scales, and ignoring other criteria.
      scales_transpose = [
          compute_near_isotropic_downsampling_scales(
              size=size,
              voxel_size=voxel_size,
              dimensions_to_downsample=dimensions_to_downsample,
              max_scales=max_scales,
              max_downsampling=float('inf'),
              max_downsampled_size=0, ) for dimensions_to_downsample in [[0, 1], [0, 2], [1, 2]]
      ]
  
      # Truncate all list of scales to the same length, once the stopping criteria
      # is reached for all values of dimensions_to_downsample.
      scales = [((1, ) * 3, ) * 3]
      size = np.array(size)
  
      def scale_satisfies_criteria(scale):
          return np.prod(scale) < max_downsampling and (size / scale).max() > max_downsampled_size
  
      for i in range(1, max_scales):
          cur_scales = tuple(scales_transpose[d][i] for d in range(3))
          if all(not scale_satisfies_criteria(scale) for scale in cur_scales):
              break
          scales.append(cur_scales)
      return scales
docs: Compute a list of successive downsampling factors for 2-d tiles.