def test_write_dicom(self): c = DosCube() c.read(self.cube000) outdir = tempfile.mkdtemp() c.write_dicom(outdir) self.assertTrue(os.path.exists(os.path.join(outdir, "rtdose.dcm"))) self.assertTrue(os.path.exists(os.path.join(outdir, "rtplan.dcm"))) self.assertGreater(os.path.getsize(os.path.join(outdir, "rtdose.dcm")), 0) self.assertGreater(os.path.getsize(os.path.join(outdir, "rtplan.dcm")), 0) shutil.rmtree(outdir)
def test_write_dicom(self): c = DosCube() c.read(self.cube000) outdir = tempfile.mkdtemp() c.write_dicom(outdir) self.assertTrue(os.path.exists(os.path.join(outdir, "rtdose.dcm"))) self.assertTrue(os.path.exists(os.path.join(outdir, "rtplan.dcm"))) self.assertGreater(os.path.getsize(os.path.join(outdir, "rtdose.dcm")), 0) self.assertGreater(os.path.getsize(os.path.join(outdir, "rtplan.dcm")), 0) shutil.rmtree(outdir)
def test_dvh_simple(self): c = DosCube() c.read(self.cube000) v = create_sphere(c, name="sph", center=[10, 10, 10], radius=8) self.assertIsNotNone(v) logger.info("Calculating DVH simple") vh = VolHist(c, v) self.assertIsNotNone(vh.x) self.assertIsNotNone(vh.y) outdir = tempfile.mkdtemp() c.write_dicom(outdir) f1 = os.path.join(outdir, "foobar_1.dvh") vh.write(f1, header=True) self.assertTrue(os.path.exists(f1)) self.assertGreater(os.path.getsize(f1), 0) f2 = os.path.join(outdir, "foobar_2.dvh") vh.write(f2, header=False) self.assertTrue(os.path.exists(f2)) self.assertGreater(os.path.getsize(f2), 0) logger.info("Calculating DVH simple for entire cube") vh = VolHist(c) self.assertIsNotNone(vh.x) self.assertIsNotNone(vh.y) f3 = os.path.join(outdir, "foobar_3.dvh") vh.write(f3, header=True) self.assertTrue(os.path.exists(f3)) self.assertGreater(os.path.getsize(f3), 0) f4 = os.path.join(outdir, "foobar_4.dvh") vh.write(f4, header=False) self.assertTrue(os.path.exists(f4)) self.assertGreater(os.path.getsize(f4), 0) shutil.rmtree(outdir)
def test_dvh_simple(self): c = DosCube() c.read(self.cube000) v = create_sphere(c, name="sph", center=[10, 10, 10], radius=8) self.assertIsNotNone(v) logger.info("Calculating DVH simple") vh = VolHist(c, v) self.assertIsNotNone(vh.x) self.assertIsNotNone(vh.y) outdir = tempfile.mkdtemp() c.write_dicom(outdir) f1 = os.path.join(outdir, "foobar_1.dvh") vh.write(f1, header=True) self.assertTrue(os.path.exists(f1)) self.assertGreater(os.path.getsize(f1), 0) f2 = os.path.join(outdir, "foobar_2.dvh") vh.write(f2, header=False) self.assertTrue(os.path.exists(f2)) self.assertGreater(os.path.getsize(f2), 0) logger.info("Calculating DVH simple for entire cube") vh = VolHist(c) self.assertIsNotNone(vh.x) self.assertIsNotNone(vh.y) f3 = os.path.join(outdir, "foobar_3.dvh") vh.write(f3, header=True) self.assertTrue(os.path.exists(f3)) self.assertGreater(os.path.getsize(f3), 0) f4 = os.path.join(outdir, "foobar_4.dvh") vh.write(f4, header=False) self.assertTrue(os.path.exists(f4)) self.assertGreater(os.path.getsize(f4), 0) shutil.rmtree(outdir)