Mercurial > hg > orthanc-tests
changeset 5:19eb87a45685
test_images
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Database/README.txt Wed Jun 17 10:42:24 2015 +0200 @@ -0,0 +1,14 @@ +========================= +Source of the test images +========================= + +Many of the images that are used by the integration tests of Orthanc +come from the OsiriX samples available at: +http://www.osirix-viewer.com/datasets/ + +Other images were posted by external contributors or generated +manually. Here is the source of each set of sample images: + +- Brainix/* : From OsiriX, "BRAINIX". +- DummyCT.dcm : From Osirix, "KNEE" with PixelData removed. +- Phenix/* : From OsiriX, "PHENIX"
--- a/Tests/Run.py Wed Jun 17 10:05:27 2015 +0200 +++ b/Tests/Run.py Wed Jun 17 10:42:24 2015 +0200 @@ -25,8 +25,8 @@ import unittest import pprint -from Toolbox import * from Tests import * +from Toolbox import DoGet ## @@ -123,7 +123,7 @@ try: print('\nStarting the tests...') SetOrthancParameters(LOCAL, REMOTE) - unittest.main(argv = [ sys.argv[0] ]) #argv = args) + unittest.main(argv = [ sys.argv[0] ]) finally: print('\nDone')
--- a/Tests/Tests.py Wed Jun 17 10:05:27 2015 +0200 +++ b/Tests/Tests.py Wed Jun 17 10:42:24 2015 +0200 @@ -54,7 +54,7 @@ self.assertEqual('20070101', i['StudyDate']) - def test_rest_grid(self): + def test_upload_2(self): i = UploadInstance(_REMOTE, 'DummyCT.dcm')['ID'] instance = DoGet(_REMOTE, '/instances/%s' % i) self.assertEqual(i, instance['ID']) @@ -81,4 +81,35 @@ self.assertEqual('TWINOW', DoGet(_REMOTE, '/instances/%s/tags' % i)['0008,1010']['Value']) + def test_images(self): + i = UploadInstance(_REMOTE, 'Phenix/IM-0001-0001.dcm')['ID'] + self.assertEqual(1, len(DoGet(_REMOTE, '/instances/%s/frames' % i))) + im = GetImage(_REMOTE, '/instances/%s/preview' % i) + self.assertEqual("L", im.mode) + self.assertEqual(512, im.size[0]) + self.assertEqual(358, im.size[1]) + + im = GetImage(_REMOTE, '/instances/%s/image-uint8' % i) + self.assertEqual("L", im.mode) + self.assertEqual(512, im.size[0]) + self.assertEqual(358, im.size[1]) + + im = GetImage(_REMOTE, '/instances/%s/image-uint16' % i) + self.assertEqual(512, im.size[0]) + self.assertEqual(358, im.size[1]) + + im = GetImage(_REMOTE, '/instances/%s/frames/0/preview' % i) + self.assertEqual("L", im.mode) + self.assertEqual(512, im.size[0]) + self.assertEqual(358, im.size[1]) + + im = GetImage(_REMOTE, '/instances/%s/frames/0/image-uint8' % i) + self.assertEqual("L", im.mode) + self.assertEqual(512, im.size[0]) + self.assertEqual(358, im.size[1]) + + im = GetImage(_REMOTE, '/instances/%s/frames/0/image-uint16' % i) + self.assertEqual(512, im.size[0]) + self.assertEqual(358, im.size[1]) +