예제 #1
0
 def test_float_empty(self):
     """Test empty float VR value"""
     ds = Dataset()
     ds.ExaminedBodyThickness = None
     assert ('(0010,9431) FL (no value available)                     # 0'
             ' ExaminedBodyThickness') == pretty_element(
                 ds['ExaminedBodyThickness'])
예제 #2
0
 def test_float_vm_one(self):
     """Test single float VR value"""
     ds = Dataset()
     ds.ExaminedBodyThickness = 1.23456
     assert ('(0010,9431) FL [1.23456]                                # 1'
             ' ExaminedBodyThickness') == pretty_element(
                 ds['ExaminedBodyThickness'])
예제 #3
0
 def test_dsfloat_empty(self):
     """Test empty DSfloat VR value"""
     ds = Dataset()
     ds.EventElapsedTimes = None
     assert ('(0008,2130) DS (no value available)                     # 0'
             ' EventElapsedTimes') == pretty_element(
                 ds['EventElapsedTimes'])
예제 #4
0
 def test_dt_empty(self):
     """Test empty DT VR value"""
     ds = Dataset()
     ds.AcquisitionDateTime = None
     assert ('(0008,002A) DT (no value available)                     # 0'
             ' AcquisitionDateTime') == pretty_element(
                 ds['AcquisitionDateTime'])
예제 #5
0
 def test_bytes_long(self):
     """Test byte VRs containing lots of data"""
     ds = Dataset()
     ds.PixelData = b'\x00' * 128
     ds['PixelData'].VR = 'OB'
     assert ('(7FE0,0010) OB (128 bytes of binary data)               # 1'
             ' PixelData') == pretty_element(ds['PixelData'])
예제 #6
0
 def test_da_empty(self):
     """Test empty DA VR value"""
     ds = Dataset()
     ds.InstanceCreationDate = None
     assert ('(0008,0012) DA (no value available)                     # 0'
             ' InstanceCreationDate') == pretty_element(
                 ds['InstanceCreationDate'])
예제 #7
0
 def test_str_vm_multi(self):
     """Test multi string VR value"""
     ds = Dataset()
     ds.PatientAge = ["10", "11"]
     assert (
         r"(0010,1010) AS [10\11]                                  # 2 PatientAge"
     ) == pretty_element(ds["PatientAge"])
예제 #8
0
 def test_bytes_empty(self):
     """Test empty byte VRs"""
     ds = Dataset()
     ds.PixelData = b''
     ds['PixelData'].VR = 'OB'
     assert ('(7FE0,0010) OB (no value available)                     # 0'
             ' PixelData') == pretty_element(ds['PixelData'])
예제 #9
0
 def test_str_vm_one(self):
     """Test single string VR value"""
     ds = Dataset()
     ds.PatientAge = "10"
     assert (
         "(0010,1010) AS [10]                                     # 1 PatientAge"
     ) == pretty_element(ds["PatientAge"])
예제 #10
0
 def test_str_empty(self):
     """Test empty string VR value"""
     ds = Dataset()
     ds.PatientAge = None
     assert (
         "(0010,1010) AS (no value available)                     # 0 PatientAge"
     ) == pretty_element(ds["PatientAge"])
예제 #11
0
 def test_pn_vm_one(self):
     """Test single PersonName VR value"""
     ds = Dataset()
     ds.PatientName = "Citizen^Jan"
     assert (
         "(0010,0010) PN [Citizen^Jan]                            # 1 PatientName"
     ) == pretty_element(ds["PatientName"])
예제 #12
0
 def test_float_vm_multi(self):
     """Test multi float VR value"""
     ds = Dataset()
     ds.ExaminedBodyThickness = [1.23456, 0.00001]
     assert (r'(0010,9431) FL [1.23456\1e-05]                          # 2'
             ' ExaminedBodyThickness') == pretty_element(
                 ds['ExaminedBodyThickness'])
예제 #13
0
 def test_seq_empty(self):
     """Test empty sequence"""
     ds = Dataset()
     ds.EventCodeSequence = []
     assert ('(0008,2135) SQ (Sequence with 0 items)                  # 0'
             ' EventCodeSequence') == pretty_element(
                 ds['EventCodeSequence'])
예제 #14
0
 def test_is_empty(self):
     """Test empty IS VR value"""
     ds = Dataset()
     ds.StageNumber = None
     assert (
         "(0008,2122) IS (no value available)                     # 0 StageNumber"
     ) == pretty_element(ds["StageNumber"])
예제 #15
0
 def test_seq_vm_multi(self):
     """Test sequence with one item"""
     ds = Dataset()
     ds.EventCodeSequence = [Dataset(), Dataset()]
     assert ('(0008,2135) SQ (Sequence with 2 items)                  # 2'
             ' EventCodeSequence') == pretty_element(
                 ds['EventCodeSequence'])
예제 #16
0
 def test_pn_empty(self):
     """Test empty PersonName VR value"""
     ds = Dataset()
     ds.PatientName = None
     assert (
         "(0010,0010) PN (no value available)                     # 0 PatientName"
     ) == pretty_element(ds["PatientName"])
예제 #17
0
 def test_ui_vm_multi(self):
     """Test multi UI VR value"""
     ds = Dataset()
     ds.SOPInstanceUID = ['1.2.3.4', '1.2.3.4.5']
     assert (
         r'(0008,0018) UI [1.2.3.4\1.2.3.4.5]                      # 2'
         ' SOPInstanceUID'
     ) == pretty_element(ds['SOPInstanceUID'])
예제 #18
0
 def test_ui_vm_one(self):
     """Test single UI VR value"""
     ds = Dataset()
     ds.SOPInstanceUID = '1.2.3.4'
     assert (
         '(0008,0018) UI [1.2.3.4]                                # 1'
         ' SOPInstanceUID'
     ) == pretty_element(ds['SOPInstanceUID'])
예제 #19
0
 def test_ui_empty(self):
     """Test empty UI VR value"""
     ds = Dataset()
     ds.SOPInstanceUID = None
     assert (
         '(0008,0018) UI (no value available)                     # 0'
         ' SOPInstanceUID'
     ) == pretty_element(ds['SOPInstanceUID'])
예제 #20
0
 def test_tm_empty(self):
     """Test empty TM VR value"""
     ds = Dataset()
     ds.PatientBirthTime = None
     assert (
         '(0010,0032) TM (no value available)                     # 0'
         ' PatientBirthTime'
     ) == pretty_element(ds['PatientBirthTime'])
예제 #21
0
 def test_str_vm_multi(self):
     """Test multi string VR value"""
     ds = Dataset()
     ds.PatientAge = ['10', '11']
     assert (
         r'(0010,1010) AS [10\11]                                  # 2'
         ' PatientAge'
     ) == pretty_element(ds['PatientAge'])
예제 #22
0
 def test_str_vm_one(self):
     """Test single string VR value"""
     ds = Dataset()
     ds.PatientAge = '10'
     assert (
         '(0010,1010) AS [10]                                     # 1'
         ' PatientAge'
     ) == pretty_element(ds['PatientAge'])
예제 #23
0
 def test_pn_vm_multi(self):
     """Test multi PersonName VR value"""
     ds = Dataset()
     ds.PatientName = ['Citizen^Jan', 'Citizen^Snips']
     assert (
         r'(0010,0010) PN [Citizen^Jan\Citizen^Snips]              # 2'
         ' PatientName'
     ) == pretty_element(ds['PatientName'])
예제 #24
0
 def test_pn_vm_one(self):
     """Test single PersonName VR value"""
     ds = Dataset()
     ds.PatientName = 'Citizen^Jan'
     assert (
         '(0010,0010) PN [Citizen^Jan]                            # 1'
         ' PatientName'
     ) == pretty_element(ds['PatientName'])
예제 #25
0
 def test_int_vm_multi(self):
     """Test multi int VR value"""
     ds = Dataset()
     ds.BitsAllocated = [1234, 4]
     assert (
         r'(0028,0100) US [1234\4]                                 # 2'
         ' BitsAllocated'
     ) == pretty_element(ds['BitsAllocated'])
예제 #26
0
 def test_int_vm_one(self):
     """Test single int VR value"""
     ds = Dataset()
     ds.BitsAllocated = 1234
     assert (
         '(0028,0100) US [1234]                                   # 1'
         ' BitsAllocated'
     ) == pretty_element(ds['BitsAllocated'])
예제 #27
0
 def test_int_empty(self):
     """Test empty int VR value"""
     ds = Dataset()
     ds.BitsAllocated = None
     assert (
         '(0028,0100) US (no value available)                     # 0'
         ' BitsAllocated'
     ) == pretty_element(ds['BitsAllocated'])
예제 #28
0
 def test_tm_vm_multi(self):
     """Test multi TM VR value"""
     config.datetime_conversion = True
     ds = Dataset()
     ds.PatientBirthTime = ['120102', '235959']
     assert isinstance(ds.PatientBirthTime[0], TM)
     assert (r'(0010,0032) TM [120102\235959]                          # 2'
             ' PatientBirthTime') == pretty_element(ds['PatientBirthTime'])
예제 #29
0
 def test_tm_vm_one(self):
     """Test single TM VR value"""
     config.datetime_conversion = True
     ds = Dataset()
     ds.PatientBirthTime = '120102'
     assert isinstance(ds.PatientBirthTime, TM)
     assert ('(0010,0032) TM [120102]                                 # 1'
             ' PatientBirthTime') == pretty_element(ds['PatientBirthTime'])
예제 #30
0
 def test_is_vm_multi(self):
     """Test multi IS VR value"""
     config.datetime_conversion = True
     ds = Dataset()
     ds.StageNumber = ['20200102', '19851231']
     assert isinstance(ds.StageNumber[0], IS)
     assert (r'(0008,2122) IS [20200102\19851231]                      # 2'
             ' StageNumber') == pretty_element(ds['StageNumber'])