Пример #1
0
def median_intensity_projection(stack):
    """Return mean intensity projection of a stack.

    :param stack: 3D array from which to project third dimension
    :returns: :class:`jicbioimage.core.image.Image`
    """
    return reduce_stack(stack, np.median)
 def test_reduce_stack(self):
     from jicbioimage.core.util.array import reduce_stack
     zslice0 = np.array(
         [[0, 1, 2],
          [0, 1, 2],
          [0, 1, 2]], dtype=np.uint8)
     zslice1 = np.array(
         [[2, 1, 0],
          [2, 1, 0],
          [2, 1, 0]], dtype=np.uint8)
     zslice2 = np.array(
         [[0, 0, 0],
          [0, 0, 0],
          [3, 3, 3]], dtype=np.uint8)
     zstack = np.dstack([zslice0, zslice1, zslice2])
     expected = np.array(
         [[2, 1, 2],
          [2, 1, 2],
          [3, 3, 3]], dtype=np.uint8)
     max_projection = reduce_stack(zstack, max)
     self.assertTrue(np.array_equal(expected, max_projection))