Example #1
0
    def test_JPEGBaselineColor3DPixelArray(self, color_3d_jpeg):
        assert "YBR_FULL_422" == color_3d_jpeg.PhotometricInterpretation
        a = color_3d_jpeg.pixel_array

        assert a.flags.writeable
        assert (120, 480, 640, 3) == a.shape
        a = _convert_YBR_FULL_to_RGB(a)
        # this test points were manually identified in Osirix viewer
        assert (41, 41, 41) == tuple(a[3, 159, 290, :])
        assert (57, 57, 57) == tuple(a[3, 169, 290, :])
        assert "YBR_FULL_422" == color_3d_jpeg.PhotometricInterpretation
Example #2
0
 def test_JPEGBaselineColor3DPixelArray(self):
     self.assertEqual(self.color_3d_jpeg.PhotometricInterpretation,
                      "YBR_FULL_422")
     a = self.color_3d_jpeg.pixel_array
     self.assertEqual(a.shape, (120, 480, 640, 3))
     a = _convert_YBR_FULL_to_RGB(a)
     # this test points were manually identified in Osirix viewer
     self.assertEqual(tuple(a[3, 159, 290, :]), (41, 41, 41))
     self.assertEqual(tuple(a[3, 169, 290, :]), (57, 57, 57))
     self.assertEqual(self.color_3d_jpeg.PhotometricInterpretation,
                      "YBR_FULL_422")
    def test_JPEGBaselineColor3DPixelArray(self, color_3d_jpeg):
        assert color_3d_jpeg.PhotometricInterpretation == "YBR_FULL_422"
        a = color_3d_jpeg.pixel_array

        assert a.flags.writeable

        assert a.shape == (120, 480, 640, 3)
        a = _convert_YBR_FULL_to_RGB(a)
        # this test points were manually identified in Osirix viewer
        assert tuple(a[3, 159, 290, :]) == (41, 41, 41)
        assert tuple(a[3, 169, 290, :]) == (57, 57, 57)
        assert color_3d_jpeg.PhotometricInterpretation == "YBR_FULL_422"
Example #4
0
def test_PI_RGB(test_with_gdcm, image, PhotometricInterpretation, results,
                convert_yuv_to_rgb):
    t = dcmread(image)
    assert t.PhotometricInterpretation == PhotometricInterpretation
    a = t.pixel_array
    assert a.shape == (100, 100, 3)
    if convert_yuv_to_rgb:
        a = _convert_YBR_FULL_to_RGB(a)
    # this test points are from the ImageComments tag
    assert tuple(a[5, 50, :]) == results[0]
    assert tuple(a[15, 50, :]) == results[1]
    assert tuple(a[25, 50, :]) == results[2]
    assert tuple(a[35, 50, :]) == results[3]
    assert tuple(a[45, 50, :]) == results[4]
    assert tuple(a[55, 50, :]) == results[5]
    assert tuple(a[65, 50, :]) == results[6]
    assert tuple(a[75, 50, :]) == results[7]
    assert tuple(a[85, 50, :]) == results[8]
    assert tuple(a[95, 50, :]) == results[9]
    assert t.PhotometricInterpretation == PhotometricInterpretation
Example #5
0
    def test_PI_RGB(self, image, pi, results, convert_yuv_to_rgb):
        t = dcmread(image)
        assert t.PhotometricInterpretation == pi
        a = t.pixel_array

        assert a.flags.writeable

        assert (100, 100, 3) == a.shape
        if convert_yuv_to_rgb:
            a = _convert_YBR_FULL_to_RGB(a)
        # this test points are from the ImageComments tag
        assert results[0] == tuple(a[5, 50, :])
        assert results[1] == tuple(a[15, 50, :])
        assert results[2] == tuple(a[25, 50, :])
        assert results[3] == tuple(a[35, 50, :])
        assert results[4] == tuple(a[45, 50, :])
        assert results[5] == tuple(a[55, 50, :])
        assert results[6] == tuple(a[65, 50, :])
        assert results[7] == tuple(a[75, 50, :])
        assert results[8] == tuple(a[85, 50, :])
        assert results[9] == tuple(a[95, 50, :])
        assert pi == t.PhotometricInterpretation
    def test_PI_RGB(self, image, PhotometricInterpretation, results,
                    convert_yuv_to_rgb):
        t = dcmread(image)
        assert t.PhotometricInterpretation == PhotometricInterpretation
        a = t.pixel_array

        assert a.flags.writeable

        assert a.shape == (100, 100, 3)
        if convert_yuv_to_rgb:
            a = _convert_YBR_FULL_to_RGB(a)
        # this test points are from the ImageComments tag
        assert tuple(a[5, 50, :]) == results[0]
        assert tuple(a[15, 50, :]) == results[1]
        assert tuple(a[25, 50, :]) == results[2]
        assert tuple(a[35, 50, :]) == results[3]
        assert tuple(a[45, 50, :]) == results[4]
        assert tuple(a[55, 50, :]) == results[5]
        assert tuple(a[65, 50, :]) == results[6]
        assert tuple(a[75, 50, :]) == results[7]
        assert tuple(a[85, 50, :]) == results[8]
        assert tuple(a[95, 50, :]) == results[9]
        assert t.PhotometricInterpretation == PhotometricInterpretation