def METHOD_NAME(images):
    # generate synthetic mask randomly
    mask = np.random.randint(0, 2, size=(images[0].shape[-2], images[0].shape[-1]))
    idx_zeros = np.where(mask == 0)
    idx_ones = np.where(mask == 1)
    img_masked = mask_img_stack(images, mask)
    n_samples = len(images)
    for i in range(n_samples):
        n_phases = images[i].shape[0]
        for j in range(n_phases):
            img = img_masked[i][j, ...]
            testing.assert_equal(np.sum(img[idx_zeros]), 0)
            img_orig = images[i][j, ...]
            testing.assert_equal(img[idx_ones], img_orig[idx_ones])