def test_color_array_dimensions(self):

        from jicbioimage.core.util.array import color_array

        input_array = np.zeros((10,))
        color_dict = {0: 0}
        self.assertEqual(color_array(input_array, color_dict).shape, (10, 3))

        input_array = np.zeros((10, 20))
        self.assertEqual(color_array(input_array, color_dict).shape, (10, 20, 3))

        input_array = np.zeros((10, 20, 30))
        self.assertEqual(color_array(input_array, color_dict).shape, (10, 20, 30, 3))
    def test_color_array_dtype(self):

        from jicbioimage.core.util.array import color_array

        input_array = np.zeros((10, 20))
        color_dict = {0: 0}
        self.assertEqual(color_array(input_array, color_dict).dtype, np.uint8)
    def test_color_array(self):

        from jicbioimage.core.util.array import color_array

        input_array = np.array([[0, 0, 0],
                                [1, 1, 1],
                                [2, 2, 2]])

        c1 = [255, 0, 0]
        c2 = [0, 255, 0]
        c3 = [0, 0, 255]

        color_dict = {0 : c1, 1 : c2, 2 : c3}

        expected_output = np.array([[c1, c1, c1],
                                    [c2, c2, c2],
                                    [c3, c3, c3]], dtype=np.uint8)

        actual_output = color_array(input_array, color_dict)

        self.assertTrue(np.array_equal(actual_output, expected_output))