def test_images_to_stack_with_scale(): """Test that 3-Image list is combined to stack with scale and translate.""" images = [ Image(np.random.randint(0, 255, (10, 128, 128))) for _ in range(3) ] stack = images_to_stack( images, 1, colormap='green', scale=(3, 1, 1, 1), translate=(1, 0, 2, 3) ) assert isinstance(stack, Image) assert stack.data.shape == (10, 3, 128, 128) assert stack.colormap.name == 'green' assert list(stack.scale) == [3, 1, 1, 1] assert list(stack.translate) == [1, 0, 2, 3]
def test_images_to_stack_none_scale(): """Test combining images using scale & translate from 1st image in list""" images = [ Image( np.random.randint(0, 255, (10, 128, 128)), scale=(4, 1, 1), translate=(0, -1, 2), ) for _ in range(3) ] stack = images_to_stack(images, 1, colormap='green') assert isinstance(stack, Image) assert stack.data.shape == (10, 3, 128, 128) assert stack.colormap.name == 'green' assert list(stack.scale) == [4, 1, 1, 1] assert list(stack.translate) == [0, 0, -1, 2]