Пример #1
0
 def test_no_waveform_sequence(self):
     """Test that missing waveform sequence raises exception."""
     ds = dcmread(ECG)
     del ds.WaveformSequence
     msg = (
         r"No \(5400,0100\) Waveform Sequence element found in the dataset")
     gen = generate_multiplex(ds)
     with pytest.raises(AttributeError, match=msg):
         next(gen)
Пример #2
0
 def test_unsupported_syntax_raises(self):
     """Test that an unsupported syntax raises exception."""
     ds = dcmread(ECG)
     ds.file_meta.TransferSyntaxUID = '1.2.3.4'
     msg = (r"Unable to convert the waveform data as the transfer syntax "
            r"is not supported by the waveform data handler")
     gen = generate_multiplex(ds)
     with pytest.raises(NotImplementedError, match=msg):
         next(gen)
Пример #3
0
 def test_not_as_raw(self):
     """Test that as_raw=False works as expected."""
     ds = dcmread(ECG)
     gen = generate_multiplex(ds, as_raw=False)
     arr = next(gen)
     assert [100, 81.25, 62.5, 43.75, 46.25] == arr[0:5, 0].tolist()
     assert [112.5, 106.25, 100, 93.75, 96.25] == arr[0:5, 1].tolist()
     assert arr.dtype == 'float'
     assert arr.flags.writeable
     assert (10000, 12) == arr.shape
Пример #4
0
 def test_as_raw(self):
     """Test that as_raw=True works as expected."""
     ds = dcmread(ECG)
     gen = generate_multiplex(ds, as_raw=True)
     arr = next(gen)
     assert [80, 65, 50, 35, 37] == arr[0:5, 0].tolist()
     assert [90, 85, 80, 75, 77] == arr[0:5, 1].tolist()
     assert arr.dtype == 'int16'
     assert arr.flags.writeable
     assert (10000, 12) == arr.shape
Пример #5
0
 def test_missing_required(self):
     """Test that missing required element in sequence raises exception."""
     ds = dcmread(ECG)
     item = ds.WaveformSequence[0]
     del item.NumberOfWaveformSamples
     msg = (f"Unable to convert the waveform multiplex group with index "
            f"0 as the following required elements are missing from "
            f"the sequence item: NumberOfWaveformSamples")
     gen = generate_multiplex(ds)
     with pytest.raises(AttributeError, match=msg):
         next(gen)