コード例 #1
0
ファイル: test_dictionary.py プロジェクト: darcymason/pydicom
 def test_add_entries_raises_for_private_tags(self):
     new_dict_items = {
         0x10021001: ('UL', '1', 'Test One', '', 'TestOne'),
         0x10011002: ('DS', '3', 'Test Two', '', 'TestTwo'),
     }
     with pytest.raises(ValueError, match='Private tags cannot be added '
                                          'using "add_dict_entries"'):
         add_dict_entries(new_dict_items)
コード例 #2
0
ファイル: test_dictionary.py プロジェクト: pydicom/pydicom
 def test_add_entries_raises_for_private_tags(self):
     new_dict_items = {
         0x10021001: ('UL', '1', 'Test One', '', 'TestOne'),
         0x10011002: ('DS', '3', 'Test Two', '', 'TestTwo'),
     }
     with pytest.raises(ValueError, match='Private tags cannot be added '
                                          'using "add_dict_entries"'):
         add_dict_entries(new_dict_items)
コード例 #3
0
 def testAddEntries(self):
     """dicom_dictionary: add and use a dict of new dictionary entries"""
     new_dict_items = {
         0x10011001: ('UL', '1', "Test One", '', 'TestOne'),
         0x10011002: ('DS', '3', "Test Two", '', 'TestTwo'),
     }
     add_dict_entries(new_dict_items)
     ds = Dataset()
     ds.TestOne = 'test'
     ds.TestTwo = ['1', '2', '3']
コード例 #4
0
ファイル: test_dictionary.py プロジェクト: jrkerns/pydicom
 def testAddEntries(self):
     """dicom_dictionary: add and use a dict of new dictionary entries"""
     new_dict_items = {
         0x10011001: ('UL', '1', "Test One", '', 'TestOne'),
         0x10011002: ('DS', '3', "Test Two", '', 'TestTwo'),
         }
     add_dict_entries(new_dict_items)
     ds = Dataset()
     ds.TestOne = 'test'
     ds.TestTwo = ['1', '2', '3']
コード例 #5
0
ファイル: test_filereader.py プロジェクト: tahirdme/pydicom
    def setup(self):
        ds = Dataset()
        ds.DoubleFloatPixelData = (b'\x00\x01\x02\x03\x04\x05\x06\x07'
                                   b'\x01\x01\x02\x03\x04\x05\x06\x07')  # OD
        ds.SelectorOLValue = (b'\x00\x01\x02\x03\x04\x05\x06\x07'
                              b'\x01\x01\x02\x03')  # VR of OL
        ds.PotentialReasonsForProcedure = ['A', 'B',
                                           'C']  # VR of UC, odd length
        ds.StrainDescription = 'Test'  # Even length
        ds.URNCodeValue = 'http://test.com'  # VR of UR
        ds.RetrieveURL = 'ftp://test.com  '  # Test trailing spaces ignored
        ds.DestinationAE = '    TEST  12    '  # 16 characters max for AE
        # 8-byte values
        ds.ExtendedOffsetTable = (  # VR of OV
            b'\x00\x00\x00\x00\x00\x00\x00\x00'
            b'\x01\x02\x03\x04\x05\x06\x07\x08')

        # No public elements with VR of SV or UV yet...
        add_dict_entries({
            0xFFFE0001:
            ('SV', '1', 'SV Element Minimum', '', 'SVElementMinimum'),
            0xFFFE0002:
            ('SV', '1', 'SV Element Maximum', '', 'SVElementMaximum'),
            0xFFFE0003:
            ('UV', '1', 'UV Element Minimum', '', 'UVElementMinimum'),
            0xFFFE0004:
            ('UV', '1', 'UV Element Maximum', '', 'UVElementMaximum'),
        })
        ds.SVElementMinimum = -2**63
        ds.SVElementMaximum = 2**63 - 1
        ds.UVElementMinimum = 0
        ds.UVElementMaximum = 2**64 - 1

        self.fp = BytesIO()  # Implicit little
        file_ds = FileDataset(self.fp, ds)
        file_ds.is_implicit_VR = True
        file_ds.is_little_endian = True
        file_ds.save_as(self.fp, write_like_original=True)

        self.fp_ex = BytesIO()  # Explicit little
        file_ds = FileDataset(self.fp_ex, ds)
        file_ds.is_implicit_VR = False
        file_ds.is_little_endian = True
        file_ds.save_as(self.fp_ex, write_like_original=True)