Exemple #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")
     with pytest.raises(AttributeError, match=msg):
         multiplex_array(ds, 0)
Exemple #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")
     with pytest.raises(NotImplementedError, match=msg):
         multiplex_array(ds, 0)
Exemple #3
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")
     with pytest.raises(AttributeError, match=msg):
         multiplex_array(ds, 0)
Exemple #4
0
    def test_as_raw(self):
        """Test that as_raw=True works as expected."""
        ds = dcmread(ECG)
        arr = multiplex_array(ds, index=0, as_raw=True)
        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

        arr = multiplex_array(ds, index=1, as_raw=True)
        assert [10, 10, 30, 35, 25] == arr[0:5, 0].tolist()
        assert [80, 80, 80, 85, 80] == arr[0:5, 1].tolist()
        assert arr.dtype == 'int16'
        assert arr.flags.writeable
        assert (1200, 12) == arr.shape
Exemple #5
0
 def test_not_as_raw(self):
     """Test that as_raw=False works as expected."""
     ds = dcmread(ECG)
     arr = multiplex_array(ds, index=0, as_raw=False)
     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