←Select platform

WaveformGroupCount Property

Gets the number of waveform multiplex groups that are included in the dataset.
public int WaveformGroupCount { get; } 
property int WaveformGroupCount { 
   int get(); 

Property Value

Value that represents the number of waveform multiplex groups that are included in the dataset.


In DICOM, a waveform consists of one or more multiplex groups, each encoded into an item in the "Waveform Sequence" (5400,0100). Use this method to retrieve the number of items under that sequence. Once you know the total number of multiplex groups, call the GetWaveformGroup method to extract a specific group or the DeleteWaveformGroup method to delete it.


This is a comprehensive sample, which shows how to insert a waveform group with one ECG channel into a dataset. The main method is InsertECGCWaveform ,and the rest of the methods are helping methods.All these methods are assumed to be part of the same class. The main method that creates the waveform group and adds it to the dataset

using Leadtools; 
using Leadtools.Dicom; 
public void InsertECGCWaveform(DicomDataSet inputDS, short[] samples, int count) 
   // Our new waveform group 
   DicomWaveformGroup ECGWaveformGroup = new DicomWaveformGroup(); 
   // Reset the waveform group, we don't  
   // really need to call this!  
   // Set the number of samples per channel. You can call  
   // DicomWaveformGroup.GetNumberOfSamplesPerChannel to get  
   // the number of samples 
   // Set the sampling frequency. You can call  
   // DicomWaveformGroup.GetSamplingFrequency to  
   // get the sampling frequency 
   // Set sample interpretation 
   // Just in case!  
   Debug.Assert(ECGWaveformGroup.GetSampleInterpretation() == DicomWaveformSampleInterpretationType.Signed16BitLinear); 
   // No Multiplex Group Time Offset 
   // You can call DicomWaveformGroup.GetMultiplexGroupTimeOffset  
   // to get the time offset 
   ECGWaveformGroup.SetMultiplexGroupTimeOffset(false, 0.0); 
   // No Trigger Time Offset 
   // You can call DicomWaveformGroup.GetTriggerTimeOffset  
   // to get the trigger time offset 
   ECGWaveformGroup.SetTriggerTimeOffset(false, 0.0); 
   // No Trigger Sample Position 
   // You can call DicomWaveformGroup.GetTriggerSamplePosition 
   // to get the trigger sample position 
   ECGWaveformGroup.SetTriggerSamplePosition(false, 0); 
   // Waveform originality is original    
   // Just in case!  
   Debug.Assert(ECGWaveformGroup.GetWaveformOriginality() == DicomWaveformOriginalityType.Original); 
   // Set the multiplex group label 
   ECGWaveformGroup.SetMultiplexGroupLabel("SCPECG Waveform"); 
   Debug.Assert(ECGWaveformGroup.GetMultiplexGroupLabel() == "SCPECG Waveform"); 
   // Set the Waveform padding value 
   // You can call DicomWaveformGroup.GetWaveformPaddingValue 
   // to get the waveform padding value 
   ECGWaveformGroup.SetWaveformPaddingValue(true, 32768); 
   InsertECGCChannel(ECGWaveformGroup, samples, count); 
   // Delete any waveform groups that already exist in the dataset 
   for (int index = 0; index < inputDS.WaveformGroupCount; index++) 
   // Insert the new waveform group into the dataset 
   inputDS.AddWaveformGroup(ECGWaveformGroup, 0); 
// Add an ECG channel to the group 
void InsertECGCChannel(DicomWaveformGroup ECGWaveformGroup, short[] samples, int count) 
   // Add a channel to the group 
   DicomWaveformChannel ECGChannel = ECGWaveformGroup.AddChannel(1); 
   if (ECGChannel == null) 
   // If we want to update a channel, we can first call  
   // DicomWaveformGroup.DeleteChannel and then call  
   // DicomWaveformGroup.AddChannel with the same  
   // index we passed to DeleteChannel 
   // Make sure that the channel really got added  
   // This is for the purposes of this sample only, because  
   // the check we did in the previous statement is enough 
   if ((ECGWaveformGroup.ChannelCount != 1) || 
         (ECGWaveformGroup.GetChannel(0) == null)) 
   // We can call DicomWaveformChannel.GetWaveformGroup to access the waveform 
   // group that the channel belongs to 
   if (ECGChannel.Index != 0) 
      Set the channel samples 
      The data we are setting in here is 16 bit data. 
      We would call SetChannelSamples8 if the data were 8 bit. 
      We can also call SetChannelSamples32, which will set the data 
      as either 8-bit or 16-bit depending on the sample interpretation 
   if (ECGChannel.SetChannelSamples16(samples, count) != count) 
   if ((ECGChannel.GetChannelSamples() == null) || (ECGChannel.GetChannelSamplesCount() == 0)) 
   // Set the channel source and sensitivity 
   // Set the channel status 
   if (ECGChannel.GetChannelStatus() != DicomChannelStatusType.OK) 
   // Set the channel time skew. You can call  
   // LDicomWaveformChannel::GetChannelTimeSkew to get the time skew 
   // You can also call DicomWaveformChannel.SetChannelSampleSkew 
   // And DicomWaveformChannel.GetChannelSampleSkew to set and get  
   // the channel samples skew 
   // Set the waveform channel number 
   ECGChannel.SetWaveformChannelNumber(true, 0); 
   if (ECGChannel.GetWaveformChannelNumber() != 0) 
   // Set the channel label 
   ECGChannel.SetChannelLabel("First Channel"); 
   if (ECGChannel.GetChannelLabel() != "First Channel") 
   // No channel offset 
   // You can also call DicomWaveformChannel.GetChannelOffset 
   // To get the channel offset 
   ECGChannel.SetChannelOffset(false, 0.0); 
   // Set filter low frequency 
   // You can also call DicomWaveformChannel.GetFilterLowFrequency 
   // To get the filter low frequency 
   ECGChannel.SetFilterLowFrequency(true, 0.050); 
   // Set filter high frequency 
   // You can also call DicomWaveformChannel.GetFilterHighFrequency 
   // To get the filter high frequency 
   ECGChannel.SetFilterHighFrequency(true, 100.00); 
   // Set the channel minimum value 
   ECGChannel.SetChannelMinimumValue(true, -386); 
   // Set the channel maximum value 
   ECGChannel.SetChannelMaximumValue(true, 1264); 
   if (ECGChannel.GetChannelMinimumValue() != -386) 
   if (ECGChannel.GetChannelMaximumValue() != 1264) 
      You can also call the following functions to set and get the notch  
      filter frequency and bandwidth 
   // Last, but not least, set the channel annotations!  
//Set the channel source and sensitivity 
void SetChannelSourceAndSensitivity(DicomWaveformChannel channel) 
   // Let's use the DICOM context group tables!  
   ///////////////////////Channel Source///////////////////////// 
   // Load the ECG Leads table  
   DicomContextGroup ECGLeadsGroup = DicomContextGroupTable.Instance.Find(DicomContextIdentifierType.CID3001); 
   DicomContextIdentifierType type = ECGLeadsGroup.ContextIdentifier; 
   DicomCodedConcept codedConcept = DicomContextGroupTable.Instance.FindCodedConcept(ECGLeadsGroup, "MDC", "2:1"); 
   using (DicomCodeSequenceItem codeSequenceItem = new DicomCodeSequenceItem()) 
      codeSequenceItem.CodeValue = codedConcept.CodeValue; 
      codeSequenceItem.CodingSchemeDesignator = codedConcept.CodingSchemeDesignator; 
      codeSequenceItem.CodingSchemeVersion = codedConcept.CodingSchemeVersion; 
      codeSequenceItem.CodeMeaning = codedConcept.CodeMeaning; 
      // Set the channel source 
   ///////////////////////Channel Sensitivity//////////////////////// 
   using (DicomCodeSequenceItem sourceSequenceItem = new DicomCodeSequenceItem()) 
      sourceSequenceItem.CodeValue = "mV"; 
      sourceSequenceItem.CodingSchemeDesignator = "UCUM"; 
      sourceSequenceItem.CodingSchemeVersion = string.Empty; 
      sourceSequenceItem.CodeMeaning = "millivolt"; 
      // Set the channel sensitivity 
      channel.SetChannelSensitivity(true, 0.001220, sourceSequenceItem, 1.0, 0.0); 
// Add annotations for the channel 
void SetChannelAnnotations(DicomWaveformChannel channel) 
   // Delete any existing channel annotations 
   for (int index = 0; index < channel.GetAnnotationCount(); index++) 
      if (channel.GetAnnotation(index) != null) 
   DicomWaveformAnnotation waveformAnnotation = new DicomWaveformAnnotation(); 
   DicomCodeSequenceItem codedName = new DicomCodeSequenceItem(); 
   codedName.CodeValue = "8867-4"; 
   codedName.CodeMeaning = "Heart rate"; 
   codedName.CodingSchemeDesignator = "LN"; 
   codedName.CodingSchemeVersion = "19971101"; 
   waveformAnnotation.CodedName = codedName; 
   //Over here we can access other properties such as  
   // waveformAnnotation.CodedValue and waveformAnnotation.UnformattedTextValue  
   DicomCodeSequenceItem measurementUnits = new DicomCodeSequenceItem(); 
   measurementUnits.CodeValue = "{H.B.}/min"; 
   measurementUnits.CodeMeaning = "Heart beat per minute"; 
   measurementUnits.CodingSchemeDesignator = "UCUM"; 
   measurementUnits.CodingSchemeVersion = "1.4"; 
   waveformAnnotation.MeasurementUnits = measurementUnits; 
   waveformAnnotation.SetNumericValue(new double[] { 69.00 }, 1); 

Target Platforms

Help Version 22.0.2023.1.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly