コード例 #1
0
 def test_image_data(self):
     """Test if the image data info can be parsed."""
     data = {
         'position':
         mv(DSfloat, ['-275', '-524', '168.5593']),
         'orientation':
         mv(DSfloat, ['1', '0.0', '-1.224647e-16', '0.0', '1', '0.0']),
         'pixelspacing':
         mv(DSfloat, ['1.074219', '1.074219']),
         'rows':
         512,
         'columns':
         512,
         'samplesperpixel':
         1,
         'photometricinterpretation':
         'MONOCHROME2',
         'littlendian':
         True,
         'patientposition':
         'HFS',
         'frames':
         1
     }
     self.assertEqual(self.dp.GetImageData(), data)
コード例 #2
0
 def test_dose_data(self):
     """Test if the dose data can be parsed."""
     data = {
         'position': mv(DSfloat,
                        ['-228.6541915', '-419.2444776', '-122.4407']),
         'orientation': mv(DSfloat, ['1', '0.0', '0.0', '0.0', '1', '0.0']),
         'pixelspacing': mv(DSfloat, [2.5, 2.5]),
         'rows': 129,
         'columns': 194,
         'samplesperpixel': 1,
         'photometricinterpretation': 'MONOCHROME2',
         'littlendian': True,
         'frames': 98,
         'doseunits': 'GY',
         'dosetype': 'PHYSICAL',
         'dosecomment': '',
         'dosesummationtype': 'PLAN',
         'dosegridscaling': 1.4e-05,
         'dosemax': 1048626.0,
         'lut': 253.8458085,
         'fraction': ''
     }
     dosedata = self.dp.GetDoseData()
     # Pop the LUT numpy array
     assert_array_almost_equal(dosedata.pop('lut')[0][-1], data.pop('lut'))
     self.assertEqual(dosedata, data)
コード例 #3
0
 def test_dose_data(self):
     """Test if the dose data can be parsed."""
     data = {
         'position': mv(
             DSfloat, ['-228.6541915', '-419.2444776', '-122.4407']),
         'orientation':
             mv(DSfloat, ['1', '0.0', '0.0', '0.0', '1', '0.0']),
         'pixelspacing': mv(DSfloat, [2.5, 2.5]),
         'rows': 129,
         'columns': 194,
         'samplesperpixel': 1,
         'photometricinterpretation': 'MONOCHROME2',
         'littlendian': True,
         'frames': 98,
         'doseunits': 'GY',
         'dosetype': 'PHYSICAL',
         'dosecomment': '',
         'dosesummationtype': 'PLAN',
         'dosegridscaling': 1.4e-05,
         'dosemax': 1048626.0,
         'lut': 253.8458085,
         'fraction': ''
     }
     dosedata = self.dp.GetDoseData()
     # Pop the LUT numpy array
     assert_array_almost_equal(
         dosedata.pop('lut')[0][-1], data.pop('lut'))
     self.assertEqual(dosedata, data)
コード例 #4
0
 def test_image_data(self):
     """Test if the image data info can be parsed."""
     data = {
         'position': mv(DSfloat, ['-275', '-524', '168.5593']),
         'orientation':
             mv(DSfloat, ['1', '0.0', '-1.224647e-16', '0.0', '1', '0.0']),
         'pixelspacing': mv(DSfloat, ['1.074219', '1.074219']),
         'rows': 512,
         'columns': 512,
         'samplesperpixel': 1,
         'photometricinterpretation': 'MONOCHROME2',
         'littlendian': True,
         'patientposition': 'HFS',
         'frames': 1
     }
     self.assertEqual(self.dp.GetImageData(), data)
コード例 #5
0
ファイル: getData.py プロジェクト: zenglilililili/WriteDCM
def getData(root_Path, doc, pat):
    labels = ['doctor', 'patient', 'position', 'imgName', 'contour']
    dataList = []
    pos_list = getDir(root_Path + '/' + doc + '/' + pat)
    for pos in pos_list:  #对部位循环
        img_list = os.listdir(root_Path + '/' + doc + '/' + pat + '/' + pos)
        for img in img_list:  #对图片循环
            img_name = img.split('_')[0]
            img_path = root_Path + '/' + doc + '/' + pat + '/' + pos + '/' + img
            patPath = root_Path + '/' + doc + '/' + pat
            slicepoint = convert_to_dcm(img_path, img_name, patPath)

            contourData = slicepoint.split(',')
            point = mv(DSfloat, contourData)

            sliceList = []
            sliceList.append(doc)
            sliceList.append(pat)
            sliceList.append(pos)
            sliceList.append(img_name)  #包含了同一切片的所有连通区域
            sliceList.append(point)
            dataList.append(sliceList)
    return dataList