本文整理汇总了Python中pylinac.vmat.VMAT类的典型用法代码示例。如果您正苦于以下问题:Python VMAT类的具体用法?Python VMAT怎么用?Python VMAT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VMAT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test_DRGS_105
class Test_DRGS_105(VMATMixin, unittest.TestCase):
"""Tests of the result values of DRMLC images at 105cm SID."""
drgs_105_open = osp.join(_vmat_test_files_dir, 'DRGSopen-105-example.dcm')
drgs_105_dmlc = osp.join(_vmat_test_files_dir, 'DRGSmlc-105-example.dcm')
def setUp(self):
self.vmat = VMAT((self.drgs_105_dmlc, self.drgs_105_open))
self.vmat.settings.x_offset = 20
def test_overall_passed(self):
"""Test that the overall pass flag is true for default settings"""
super().test_overall_passed('drgs')
def test_segment_positions(self):
"""Test various values of the Segments."""
self.vmat.analyze('drgs')
segment_dict = {0: Point(371, 384), 2: Point(478, 384)}
super().test_segment_positions(segment_dict)
def test_segment_values(self):
self.vmat.analyze('drgs')
segment_dict = {
0: {'r_dev': 0.780, 'r_corr': 102.43},
4: {'r_dev': -0.282, 'r_corr': 101.357},
}
super().test_segment_values(segment_dict)
示例2: Test_MLCS_105
class Test_MLCS_105(VMATMixin, unittest.TestCase):
"""Tests of the result values of MLCS images at 105cm SID."""
drmlc_105_open = osp.join(_vmat_test_files_dir, 'DRMLCopen-105-example.dcm')
drmlc_105_dmlc = osp.join(_vmat_test_files_dir, 'DRMLCmlc-105-example.dcm')
def setUp(self):
self.vmat = VMAT((self.drmlc_105_dmlc, self.drmlc_105_open))
def test_overall_passed(self):
"""Test that the overall pass flag is true for default settings"""
super().test_overall_passed('mlcs')
def test_segment_positions(self):
"""Test various values of the Segments."""
self.vmat.analyze('mlcs')
segment_dict = {0: Point(391, 384), 2: Point(552, 384)}
super().test_segment_positions(segment_dict)
def test_segment_values(self):
self.vmat.analyze('mlcs')
segment_dict = {
0: {'r_dev': -0.040, 'r_corr': 100.83},
2: {'r_dev': -0.021, 'r_corr': 100.85},
}
super().test_segment_values(segment_dict)
示例3: test_loading_with_bad_names
def test_loading_with_bad_names(self):
one = osp.join(TEST_DIR, 'no_test_or_image_type_1.dcm')
two = osp.join(TEST_DIR, 'no_test_or_image_type_2.dcm')
with self.assertRaises(ValueError):
VMAT((one, two))
# but will work when everything is specified
v1 = VMAT(images=(one, two), delivery_types=['open', 'dmlc'])
v1.analyze(DRMLC)
示例4: test_analyze_without_test_type
def test_analyze_without_test_type(self):
dmlc = osp.join(TEST_DIR, 'no_test_type_dmlc.dcm')
opn = osp.join(TEST_DIR, 'no_test_type_open.dcm')
vmat = VMAT((dmlc, opn))
with self.assertRaises(ValueError):
vmat.analyze()
# but will run when test type is passed
vmat.analyze('drmlc')
示例5: Test_MLCS_demo
class Test_MLCS_demo(VMATMixin, unittest.TestCase):
"""Tests of the result values of the DRMLC demo images."""
def setUp(self):
self.vmat = VMAT()
self.vmat.load_demo_image('mlcs')
def test_demo(self):
self.vmat.run_demo_mlcs()
def test_overall_passed(self):
"""Test that the overall pass flag is true for default settings"""
super().test_overall_passed('mlcs')
def test_segment_positions(self):
"""Test various values of the Segments."""
self.vmat.analyze('mlcs')
segment_dict = {0: Point(170, 192), 2: Point(285, 192)}
super().test_segment_positions(segment_dict)
def test_segment_values(self):
self.vmat.analyze('mlcs')
segment_dict = {
0: {'r_dev': 0.437, 'r_corr': 100.89},
2: {'r_dev': -0.405, 'r_corr': 100.04},
}
super().test_segment_values(segment_dict)
示例6: Test_DRGS_demo
class Test_DRGS_demo(VMATMixin, unittest.TestCase):
"""Tests of the result values of the DRGS demo images."""
def setUp(self):
self.vmat = VMAT()
self.vmat.load_demo_image('drgs')
self.vmat.settings.x_offset = 20
def test_demo(self):
"""Run the demo; no errors should arise."""
self.vmat.run_demo_drgs()
def test_overall_passed(self):
"""Test that the overall pass flag is true for default settings"""
super().test_overall_passed('drgs')
def test_segment_positions(self):
"""Test various values of the Segments."""
self.vmat.analyze('drgs')
segment_dict = {0: Point(161, 192), 4: Point(314, 192)}
super().test_segment_positions(segment_dict)
def test_segment_values(self):
self.vmat.analyze('drgs')
segment_dict = {
0: {'r_dev': 0.965, 'r_corr': 101.85},
4: {'r_dev': -0.459, 'r_corr': 100.42},
}
super().test_segment_values(segment_dict)
示例7: Point
class VMATMixin:
filepaths = ('open', 'dmlc')
test_type = ''
x_offset = 0
segment_positions = {1: Point(100, 200)}
segment_values = {
0: {'r_dev': 0, 'r_corr': 100},
4: {'r_dev': 0, 'r_corr': 100},
}
avg_abs_r_deviation = 0
avg_r_deviation = 0
max_r_deviation = 0
def setUp(self):
self.vmat = VMAT(self.filepaths)
self.vmat.settings.x_offset = self.x_offset
self.vmat.analyze(self.test_type)
def test_overall_passed(self):
self.vmat.analyze(self.test_type)
self.assertTrue(self.vmat.passed)
def test_fail_with_tight_tolerance(self):
self.vmat.analyze(self.test_type, tolerance=0.01)
self.assertFalse(self.vmat.passed)
def test_segment_positions(self):
for key, value in self.segment_positions.items():
within_1(self.vmat.segments[key].center.x, value.x)
within_1(self.vmat.segments[key].center.y, value.y)
def test_segment_values(self):
for key, value in self.segment_values.items():
within_01(self.vmat.segments[key].r_dev, value['r_dev'])
within_01(self.vmat.segments[key].r_corr, value['r_corr'])
def test_plotting(self):
self.vmat.plot_analyzed_image('open')
self.vmat.plot_analyzed_image('dmlc')
def test_saving_images(self):
save_file('test.png', self.vmat.save_analyzed_image)
def test_deviations(self):
self.assertAlmostEqual(self.vmat.avg_abs_r_deviation, self.avg_abs_r_deviation, delta=0.05)
self.assertAlmostEqual(self.vmat.avg_r_deviation, self.avg_r_deviation, delta=0.02)
self.assertAlmostEqual(self.vmat.max_r_deviation, self.max_r_deviation, delta=0.1)
示例8: Point
class VMATMixin:
filepaths = ('open', 'dmlc')
is_zip = False
test_type = ''
x_offset = 0
segment_positions = {1: Point(100, 200)}
segment_values = {
0: {'r_dev': 0, 'r_corr': 100},
4: {'r_dev': 0, 'r_corr': 100},
}
avg_abs_r_deviation = 0
avg_r_deviation = 0
max_r_deviation = 0
passes = True
def setUp(self):
if self.is_zip:
self.vmat = VMAT.from_zip(self.filepaths)
else:
self.vmat = VMAT(self.filepaths)
self.vmat.analyze(self.test_type, x_offset=self.x_offset)
def test_overall_passed(self):
self.vmat.analyze(self.test_type, x_offset=self.x_offset)
self.assertEqual(self.vmat.passed, self.passes)
def test_fail_with_tight_tolerance(self):
self.vmat.analyze(self.test_type, tolerance=0.01, x_offset=self.x_offset)
self.assertFalse(self.vmat.passed)
def test_segment_positions(self):
for key, value in self.segment_positions.items():
within_1(self.vmat.segments[key].center.x, value.x)
within_1(self.vmat.segments[key].center.y, value.y)
def test_segment_values(self):
for key, value in self.segment_values.items():
within_01(self.vmat.segments[key].r_dev, value['r_dev'])
within_01(self.vmat.segments[key].r_corr, value['r_corr'])
def test_deviations(self):
self.assertAlmostEqual(self.vmat.avg_abs_r_deviation, self.avg_abs_r_deviation, delta=0.05)
self.assertAlmostEqual(self.vmat.avg_r_deviation, self.avg_r_deviation, delta=0.02)
self.assertAlmostEqual(self.vmat.max_r_deviation, self.max_r_deviation, delta=0.1)
示例9: setUpClass
def setUpClass(cls):
cls.vmat = VMAT.from_demo_images()
cls.vmat.analyze()
示例10: test_from_zip
def test_from_zip(self):
path = osp.join(TEST_DIR, 'DRMLC.zip')
v = VMAT.from_zip(path)
v.analyze()
示例11: setUp
def setUp(self):
self.vmat = VMAT.from_demo_images('drgs')
self.vmat.settings.x_offset = 20
示例12: test_from_urls
def test_from_urls(self):
VMAT.from_url('https://s3.amazonaws.com/assuranceqa-staging/uploads/imgs/DRMLC.zip') # shouldn't raise
示例13: test_demo_image_loads
def test_demo_image_loads(self):
"""Test the that demo images load properly."""
# shouldn't raise
VMAT.from_demo_images(DRGS)
VMAT.from_demo_images(DRMLC)
示例14: TestLoading
class TestLoading(TestCase):
"""Tests of the various loading schemas."""
def setUp(self):
self.vmat = VMAT()
def test_load_image(self):
good_name = osp.join(vmat_test_files_dir, 'no_test_type_dmlc.dcm')
bad_name = osp.join(vmat_test_files_dir, 'no_test_or_image_type_1.dcm')
# image type can be determined from a good name
self.vmat.load_image(good_name)
# but not a bad one
with self.assertRaises(ValueError):
self.vmat.load_image(bad_name)
def test_from_urls(self):
urls = ['https://s3.amazonaws.com/assuranceqa-staging/uploads/imgs/DRGS_dmlc.dcm',
'https://s3.amazonaws.com/assuranceqa-staging/uploads/imgs/DRGS_open.dcm']
VMAT.from_urls(urls) # shouldn't raise
def test_passing_3_images(self):
"""Test passing the wrong number of images."""
with self.assertRaises(ValueError):
self.vmat.load_images(('', '', ''))
def test_demo_image_loads(self):
"""Test the that demo images load properly."""
# shouldn't raise
self.vmat.load_demo_image(DRGS)
self.vmat.load_demo_image(DRMLC)
def test_from_zip(self):
path = osp.join(vmat_test_files_dir, 'DRMLC.zip')
v = VMAT.from_zip(path)
v.analyze()
def test_loading_with_bad_names(self):
one = osp.join(vmat_test_files_dir, 'no_test_or_image_type_1.dcm')
two = osp.join(vmat_test_files_dir, 'no_test_or_image_type_2.dcm')
with self.assertRaises(ValueError):
self.vmat.load_images((one, two))
# but will work when everything is specified
self.vmat.load_image(one, OPEN)
self.vmat.load_image(two, DMLC)
self.vmat.analyze(DRMLC)
示例15: setUp
def setUp(self):
self.vmat = VMAT()
self.vmat.load_demo_image('drgs')
self.vmat.settings.x_offset = 20