changeset 6:6d645b3011e1

test_hierarchy
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 Jun 2015 11:31:11 +0200
parents 19eb87a45685
children 302f06f3bba2
files Database/Brainix/Epi/IM-0001-0001.dcm Database/Brainix/Epi/IM-0001-0002.dcm Database/Brainix/Epi/IM-0001-0003.dcm Database/Brainix/Epi/IM-0001-0004.dcm Database/Brainix/Epi/IM-0001-0005.dcm Database/Brainix/Epi/IM-0001-0006.dcm Database/Brainix/Epi/IM-0001-0007.dcm Database/Brainix/Epi/IM-0001-0008.dcm Database/Brainix/Epi/IM-0001-0009.dcm Database/Brainix/Epi/IM-0001-0010.dcm Database/Brainix/Epi/IM-0001-0011.dcm Database/Brainix/Epi/IM-0001-0012.dcm Database/Brainix/Epi/IM-0001-0013.dcm Database/Brainix/Epi/IM-0001-0014.dcm Database/Brainix/Epi/IM-0001-0015.dcm Database/Brainix/Epi/IM-0001-0016.dcm Database/Brainix/Epi/IM-0001-0017.dcm Database/Brainix/Epi/IM-0001-0018.dcm Database/Brainix/Epi/IM-0001-0019.dcm Database/Brainix/Epi/IM-0001-0020.dcm Database/Brainix/Epi/IM-0001-0021.dcm Database/Brainix/Epi/IM-0001-0022.dcm Database/Knee/T1/IM-0001-0001.dcm Database/Knee/T1/IM-0001-0002.dcm Database/Knee/T1/IM-0001-0003.dcm Database/Knee/T1/IM-0001-0004.dcm Database/Knee/T1/IM-0001-0005.dcm Database/Knee/T1/IM-0001-0006.dcm Database/Knee/T1/IM-0001-0007.dcm Database/Knee/T1/IM-0001-0008.dcm Database/Knee/T1/IM-0001-0009.dcm Database/Knee/T1/IM-0001-0010.dcm Database/Knee/T1/IM-0001-0011.dcm Database/Knee/T1/IM-0001-0012.dcm Database/Knee/T1/IM-0001-0013.dcm Database/Knee/T1/IM-0001-0014.dcm Database/Knee/T1/IM-0001-0015.dcm Database/Knee/T1/IM-0001-0016.dcm Database/Knee/T1/IM-0001-0017.dcm Database/Knee/T1/IM-0001-0018.dcm Database/Knee/T1/IM-0001-0019.dcm Database/Knee/T1/IM-0001-0020.dcm Database/Knee/T1/IM-0001-0021.dcm Database/Knee/T1/IM-0001-0022.dcm Database/Knee/T1/IM-0001-0023.dcm Database/Knee/T1/IM-0001-0024.dcm Database/Knee/T2/IM-0001-0001.dcm Database/Knee/T2/IM-0001-0002.dcm Database/Knee/T2/IM-0001-0003.dcm Database/Knee/T2/IM-0001-0004.dcm Database/Knee/T2/IM-0001-0005.dcm Database/Knee/T2/IM-0001-0006.dcm Database/Knee/T2/IM-0001-0007.dcm Database/Knee/T2/IM-0001-0008.dcm Database/Knee/T2/IM-0001-0009.dcm Database/Knee/T2/IM-0001-0010.dcm Database/Knee/T2/IM-0001-0011.dcm Database/Knee/T2/IM-0001-0012.dcm Database/Knee/T2/IM-0001-0013.dcm Database/Knee/T2/IM-0001-0014.dcm Database/Knee/T2/IM-0001-0015.dcm Database/Knee/T2/IM-0001-0016.dcm Database/Knee/T2/IM-0001-0017.dcm Database/Knee/T2/IM-0001-0018.dcm Database/Knee/T2/IM-0001-0019.dcm Database/Knee/T2/IM-0001-0020.dcm Database/Knee/T2/IM-0001-0021.dcm Database/Knee/T2/IM-0001-0022.dcm Database/Knee/T2/IM-0001-0023.dcm Database/Knee/T2/IM-0001-0024.dcm Database/Knee/T2/IM-0001-0025.dcm Database/Knee/T2/IM-0001-0026.dcm Database/README.txt Tests/Run.py Tests/Tests.py Tests/Toolbox.py
diffstat 76 files changed, 117 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
Binary file Database/Brainix/Epi/IM-0001-0001.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0002.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0003.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0004.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0005.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0006.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0007.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0008.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0009.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0010.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0011.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0012.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0013.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0014.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0015.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0016.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0017.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0018.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0019.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0020.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0021.dcm has changed
Binary file Database/Brainix/Epi/IM-0001-0022.dcm has changed
Binary file Database/Knee/T1/IM-0001-0001.dcm has changed
Binary file Database/Knee/T1/IM-0001-0002.dcm has changed
Binary file Database/Knee/T1/IM-0001-0003.dcm has changed
Binary file Database/Knee/T1/IM-0001-0004.dcm has changed
Binary file Database/Knee/T1/IM-0001-0005.dcm has changed
Binary file Database/Knee/T1/IM-0001-0006.dcm has changed
Binary file Database/Knee/T1/IM-0001-0007.dcm has changed
Binary file Database/Knee/T1/IM-0001-0008.dcm has changed
Binary file Database/Knee/T1/IM-0001-0009.dcm has changed
Binary file Database/Knee/T1/IM-0001-0010.dcm has changed
Binary file Database/Knee/T1/IM-0001-0011.dcm has changed
Binary file Database/Knee/T1/IM-0001-0012.dcm has changed
Binary file Database/Knee/T1/IM-0001-0013.dcm has changed
Binary file Database/Knee/T1/IM-0001-0014.dcm has changed
Binary file Database/Knee/T1/IM-0001-0015.dcm has changed
Binary file Database/Knee/T1/IM-0001-0016.dcm has changed
Binary file Database/Knee/T1/IM-0001-0017.dcm has changed
Binary file Database/Knee/T1/IM-0001-0018.dcm has changed
Binary file Database/Knee/T1/IM-0001-0019.dcm has changed
Binary file Database/Knee/T1/IM-0001-0020.dcm has changed
Binary file Database/Knee/T1/IM-0001-0021.dcm has changed
Binary file Database/Knee/T1/IM-0001-0022.dcm has changed
Binary file Database/Knee/T1/IM-0001-0023.dcm has changed
Binary file Database/Knee/T1/IM-0001-0024.dcm has changed
Binary file Database/Knee/T2/IM-0001-0001.dcm has changed
Binary file Database/Knee/T2/IM-0001-0002.dcm has changed
Binary file Database/Knee/T2/IM-0001-0003.dcm has changed
Binary file Database/Knee/T2/IM-0001-0004.dcm has changed
Binary file Database/Knee/T2/IM-0001-0005.dcm has changed
Binary file Database/Knee/T2/IM-0001-0006.dcm has changed
Binary file Database/Knee/T2/IM-0001-0007.dcm has changed
Binary file Database/Knee/T2/IM-0001-0008.dcm has changed
Binary file Database/Knee/T2/IM-0001-0009.dcm has changed
Binary file Database/Knee/T2/IM-0001-0010.dcm has changed
Binary file Database/Knee/T2/IM-0001-0011.dcm has changed
Binary file Database/Knee/T2/IM-0001-0012.dcm has changed
Binary file Database/Knee/T2/IM-0001-0013.dcm has changed
Binary file Database/Knee/T2/IM-0001-0014.dcm has changed
Binary file Database/Knee/T2/IM-0001-0015.dcm has changed
Binary file Database/Knee/T2/IM-0001-0016.dcm has changed
Binary file Database/Knee/T2/IM-0001-0017.dcm has changed
Binary file Database/Knee/T2/IM-0001-0018.dcm has changed
Binary file Database/Knee/T2/IM-0001-0019.dcm has changed
Binary file Database/Knee/T2/IM-0001-0020.dcm has changed
Binary file Database/Knee/T2/IM-0001-0021.dcm has changed
Binary file Database/Knee/T2/IM-0001-0022.dcm has changed
Binary file Database/Knee/T2/IM-0001-0023.dcm has changed
Binary file Database/Knee/T2/IM-0001-0024.dcm has changed
Binary file Database/Knee/T2/IM-0001-0025.dcm has changed
Binary file Database/Knee/T2/IM-0001-0026.dcm has changed
--- a/Database/README.txt	Wed Jun 17 10:42:24 2015 +0200
+++ b/Database/README.txt	Wed Jun 17 11:31:11 2015 +0200
@@ -6,9 +6,21 @@
 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:
+WARNING: The datasets from OsiriX are exclusively available for
+research and teaching! You are not authorized to redistribute or sell
+them, or use them for commercial purposes.
+
+Other images were publicly posted by external contributors to the
+Orthanc project, or were generated manually by the Orthanc team.
+
+
+-------
+Content
+-------
+
+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"
+- Phenix/* : From OsiriX, "PHENIX".
+- Knee/* : From OsiriX, "KNEE".
--- a/Tests/Run.py	Wed Jun 17 10:42:24 2015 +0200
+++ b/Tests/Run.py	Wed Jun 17 11:31:11 2015 +0200
@@ -56,6 +56,8 @@
                     help = 'Password to the REST API')
 parser.add_argument('--force', help = 'Do not warn the user',
                     action = 'store_true')
+parser.add_argument('options', metavar = 'N', nargs = '*',
+                    help='Arguments to Python unittest')
 
 args = parser.parse_args()
 
@@ -123,7 +125,7 @@
 try:
     print('\nStarting the tests...')
     SetOrthancParameters(LOCAL, REMOTE)
-    unittest.main(argv = [ sys.argv[0] ])
+    unittest.main(argv = [ sys.argv[0] ] + args.options)
 
 finally:
     print('\nDone')
--- a/Tests/Tests.py	Wed Jun 17 10:42:24 2015 +0200
+++ b/Tests/Tests.py	Wed Jun 17 11:31:11 2015 +0200
@@ -113,3 +113,101 @@
         self.assertEqual(512, im.size[0])
         self.assertEqual(358, im.size[1])
         
+
+    def test_hierarchy(self):
+        UploadFolder(_REMOTE, 'Brainix/Epi')
+        UploadFolder(_REMOTE, 'Brainix/Flair')
+        UploadFolder(_REMOTE, 'Knee/T1')
+        UploadFolder(_REMOTE, 'Knee/T2')
+
+        p = DoGet(_REMOTE, '/patients')
+        s = DoGet(_REMOTE, '/studies')
+        t = DoGet(_REMOTE, '/series')
+        self.assertEqual(2, len(p))
+        self.assertEqual(2, len(s))
+        self.assertEqual(4, len(t))
+        self.assertEqual(94, len(DoGet(_REMOTE, '/instances')))
+
+        brainixPatient = '16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0'
+        brainixStudy = '27f7126f-4f66fb14-03f4081b-f9341db2-53925988'
+        brainixEpi = '2ac1316d-3e432022-62eabff2-c59f5475-9b1ac3f8'
+        brainixFlair = '1e2c125c-411b8e86-3f4fe68e-a7584dd3-c6da78f0'
+
+        kneePatient = 'ca29faea-b6a0e17f-067743a1-8b778011-a48b2a17'
+        kneeStudy = '0a9b3153-2512774b-2d9580de-1fc3dcf6-3bd83918'
+        kneeT1 = '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285'
+        kneeT2 = 'bbf7a453-0d34251a-03663b55-46bb31b9-ffd74c59'
+
+        self.assertTrue(brainixPatient in p)
+        self.assertTrue(kneePatient in p)
+        self.assertTrue(brainixStudy in s)
+        self.assertTrue(kneeStudy in s)
+        self.assertTrue(brainixEpi in t)
+        self.assertTrue(brainixFlair in t)
+        self.assertTrue(kneeT1 in t)
+        self.assertTrue(kneeT2 in t)
+
+        self.assertEqual(44, len(DoGet(_REMOTE, '/patients/%s/instances' % brainixPatient)))
+        self.assertEqual(2, len(DoGet(_REMOTE, '/patients/%s/series' % brainixPatient)))
+        self.assertEqual(1, len(DoGet(_REMOTE, '/patients/%s/studies' % brainixPatient)))
+
+        self.assertEqual(50, len(DoGet(_REMOTE, '/patients/%s/instances' % kneePatient)))
+        self.assertEqual(2, len(DoGet(_REMOTE, '/patients/%s/series' % kneePatient)))
+        self.assertEqual(1, len(DoGet(_REMOTE, '/patients/%s/studies' % kneePatient)))
+
+        self.assertEqual(2, len(DoGet(_REMOTE, '/studies/%s/series' % brainixStudy)))
+        self.assertEqual(44, len(DoGet(_REMOTE, '/studies/%s/instances' % brainixStudy)))
+
+        self.assertEqual(2, len(DoGet(_REMOTE, '/studies/%s/series' % kneeStudy)))
+        self.assertEqual(50, len(DoGet(_REMOTE, '/studies/%s/instances' % kneeStudy)))
+
+        self.assertEqual(22, len(DoGet(_REMOTE, '/series/%s/instances' % brainixEpi)))
+        self.assertEqual(22, len(DoGet(_REMOTE, '/series/%s/instances' % brainixFlair)))
+        self.assertEqual(24, len(DoGet(_REMOTE, '/series/%s/instances' % kneeT1)))
+        self.assertEqual(26, len(DoGet(_REMOTE, '/series/%s/instances' % kneeT2)))
+
+        for patient in p:
+            for study in DoGet(_REMOTE, '/patients/%s/studies' % patient):
+                self.assertEqual(patient, study['ParentPatient'])
+                for series in DoGet(_REMOTE, '/studies/%s/series' % study['ID']):
+                    self.assertEqual(study['ID'], series['ParentStudy'])
+                    for instance in DoGet(_REMOTE, '/series/%s/instances' % series['ID']):
+                        self.assertEqual(series['ID'], instance['ParentSeries'])
+
+                        self.assertEqual(json.dumps(DoGet(_REMOTE, '/instances/%s/attachments/dicom-as-json/data' % instance['ID'])),
+                                         json.dumps(DoGet(_REMOTE, '/instances/%s/tags' % instance['ID'])))
+
+
+        r = DoDelete(_REMOTE, "/studies/%s" % brainixStudy)['RemainingAncestor']
+        self.assertEqual(1, len(DoGet(_REMOTE, '/patients')))
+        self.assertEqual(1, len(DoGet(_REMOTE, '/studies')))
+        self.assertEqual(2, len(DoGet(_REMOTE, '/series')))
+        self.assertEqual(50, len(DoGet(_REMOTE, '/instances')))
+        self.assertEqual(None, r)
+
+        r = DoDelete(_REMOTE, "/series/%s" % kneeT2)['RemainingAncestor']
+        self.assertEqual(1, len(DoGet(_REMOTE, '/patients')))
+        self.assertEqual(1, len(DoGet(_REMOTE, '/studies')))
+        self.assertEqual(1, len(DoGet(_REMOTE, '/series')))
+        self.assertEqual(24, len(DoGet(_REMOTE, '/instances')))
+        self.assertEqual('Study', r['Type'])
+        self.assertEqual(kneeStudy, r['ID'])
+
+        r = DoDelete(_REMOTE, "/instances/%s" % DoGet(_REMOTE, '/instances')[0])['RemainingAncestor']
+        self.assertEqual(1, len(DoGet(_REMOTE, '/patients')))
+        self.assertEqual(1, len(DoGet(_REMOTE, '/studies')))
+        self.assertEqual(1, len(DoGet(_REMOTE, '/series')))
+        self.assertEqual(23, len(DoGet(_REMOTE, '/instances')))
+        self.assertEqual('Series', r['Type'])
+        self.assertEqual(kneeT1, r['ID'])
+
+        r = DoDelete(_REMOTE, "/patients/%s" % kneePatient)['RemainingAncestor']
+        self.assertEqual(0, len(DoGet(_REMOTE, '/patients')))
+        self.assertEqual(0, len(DoGet(_REMOTE, '/studies')))
+        self.assertEqual(0, len(DoGet(_REMOTE, '/series')))
+        self.assertEqual(0, len(DoGet(_REMOTE, '/instances')))
+        self.assertEqual(None, r)
+
+        DropOrthanc(_REMOTE)
+        self.assertEqual('0', DoGet(_REMOTE, '/statistics')['TotalDiskSize'])
+        self.assertEqual('0', DoGet(_REMOTE, '/statistics')['TotalUncompressedSize'])
--- a/Tests/Toolbox.py	Wed Jun 17 10:42:24 2015 +0200
+++ b/Tests/Toolbox.py	Wed Jun 17 11:31:11 2015 +0200
@@ -144,7 +144,7 @@
 
 def UploadFolder(orthanc, path):
     global HERE
-    p = os.path.join(HERE, 'Database', path)
+    p = os.path.join(HERE, '..', 'Database', path)
     for i in os.listdir(p):
         try:
             UploadInstance(orthanc, os.path.join(path, i))