public DicomCodeSequenceItem MeasurementUnits { get; set; } @property (nonatomic, strong, nullable) LTDicomCodeSequenceItem *measurementUnits; public:property DicomCodeSequenceItem^ MeasurementUnits {DicomCodeSequenceItem^ get();void set ( DicomCodeSequenceItem^ value);}
The single item that is included under the "Measurement Units Code Sequence" (0040,08EA) in the "Waveform Annotation Module".
using Leadtools;using Leadtools.Dicom;public void InsertECGCWaveform(DicomDataSet inputDS, short[] samples, int count){// Our new waveform groupDicomWaveformGroup ECGWaveformGroup = new DicomWaveformGroup();// Reset the waveform group, we don't// really need to call this!ECGWaveformGroup.Reset();// Set the number of samples per channel. You can call// DicomWaveformGroup.GetNumberOfSamplesPerChannel to get// the number of samplesECGWaveformGroup.SetNumberOfSamplesPerChannel(count);// Set the sampling frequency. You can call// DicomWaveformGroup.GetSamplingFrequency to// get the sampling frequencyECGWaveformGroup.SetSamplingFrequency(240.00);// Set sample interpretationECGWaveformGroup.SetSampleInterpretation(DicomWaveformSampleInterpretationType.Signed16BitLinear);// Just in case!Debug.Assert(ECGWaveformGroup.GetSampleInterpretation() == DicomWaveformSampleInterpretationType.Signed16BitLinear);// No Multiplex Group Time Offset// You can call DicomWaveformGroup.GetMultiplexGroupTimeOffset// to get the time offsetECGWaveformGroup.SetMultiplexGroupTimeOffset(false, 0.0);// No Trigger Time Offset// You can call DicomWaveformGroup.GetTriggerTimeOffset// to get the trigger time offsetECGWaveformGroup.SetTriggerTimeOffset(false, 0.0);// No Trigger Sample Position// You can call DicomWaveformGroup.GetTriggerSamplePosition// to get the trigger sample positionECGWaveformGroup.SetTriggerSamplePosition(false, 0);// Waveform originality is originalECGWaveformGroup.SetWaveformOriginality(DicomWaveformOriginalityType.Original);// Just in case!Debug.Assert(ECGWaveformGroup.GetWaveformOriginality() == DicomWaveformOriginalityType.Original);// Set the multiplex group labelECGWaveformGroup.SetMultiplexGroupLabel("SCPECG Waveform");Debug.Assert(ECGWaveformGroup.GetMultiplexGroupLabel() == "SCPECG Waveform");// Set the Waveform padding value// You can call DicomWaveformGroup.GetWaveformPaddingValue// to get the waveform padding valueECGWaveformGroup.SetWaveformPaddingValue(true, 32768);InsertECGCChannel(ECGWaveformGroup, samples, count);// Delete any waveform groups that already exist in the datasetfor (int index = 0; index < inputDS.WaveformGroupCount; index++){inputDS.DeleteWaveformGroup(index);}// Insert the new waveform group into the datasetinputDS.AddWaveformGroup(ECGWaveformGroup, 0);}// Add an ECG channel to the groupvoid InsertECGCChannel(DicomWaveformGroup ECGWaveformGroup, short[] samples, int count){// Add a channel to the groupDicomWaveformChannel ECGChannel = ECGWaveformGroup.AddChannel(1);if (ECGChannel == null){return;}// 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 enoughif ((ECGWaveformGroup.ChannelCount != 1) ||(ECGWaveformGroup.GetChannel(0) == null)){return;}// We can call DicomWaveformChannel.GetWaveformGroup to access the waveform// group that the channel belongs toif (ECGChannel.Index != 0){return;}/*Set the channel samplesThe 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 dataas either 8-bit or 16-bit depending on the sample interpretation*/if (ECGChannel.SetChannelSamples16(samples, count) != count){return;}if ((ECGChannel.GetChannelSamples() == null) || (ECGChannel.GetChannelSamplesCount() == 0))return;// Set the channel source and sensitivitySetChannelSourceAndSensitivity(ECGChannel);// Set the channel statusECGChannel.SetChannelStatus(DicomChannelStatusType.OK);if (ECGChannel.GetChannelStatus() != DicomChannelStatusType.OK){return;}// 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 skewECGChannel.SetChannelTimeSkew(0.000000);// Set the waveform channel numberECGChannel.SetWaveformChannelNumber(true, 0);if (ECGChannel.GetWaveformChannelNumber() != 0)return;// Set the channel labelECGChannel.SetChannelLabel("First Channel");if (ECGChannel.GetChannelLabel() != "First Channel")return;// No channel offset// You can also call DicomWaveformChannel.GetChannelOffset// To get the channel offsetECGChannel.SetChannelOffset(false, 0.0);// Set filter low frequency// You can also call DicomWaveformChannel.GetFilterLowFrequency// To get the filter low frequencyECGChannel.SetFilterLowFrequency(true, 0.050);// Set filter high frequency// You can also call DicomWaveformChannel.GetFilterHighFrequency// To get the filter high frequencyECGChannel.SetFilterHighFrequency(true, 100.00);// Set the channel minimum valueECGChannel.SetChannelMinimumValue(true, -386);// Set the channel maximum valueECGChannel.SetChannelMaximumValue(true, 1264);if (ECGChannel.GetChannelMinimumValue() != -386)return;if (ECGChannel.GetChannelMaximumValue() != 1264)return;/*You can also call the following functions to set and get the notchfilter frequency and bandwidthDicomWaveformChannel.SetNotchFilterFrequencyDicomWaveformChannel.GetNotchFilterFrequencyDicomWaveformChannel.SetNotchFilterBandwidthDicomWaveformChannel.GetNotchFilterBandwidth*/// Last, but not least, set the channel annotations!SetChannelAnnotations(ECGChannel);}//Set the channel source and sensitivityvoid SetChannelSourceAndSensitivity(DicomWaveformChannel channel){// Let's use the DICOM context group tables!///////////////////////Channel Source/////////////////////////// Load the ECG Leads tableDicomContextGroupTable.Instance.Load(DicomContextIdentifierType.CID3001);DicomContextGroup ECGLeadsGroup = DicomContextGroupTable.Instance.Find(DicomContextIdentifierType.CID3001);Assert.IsNotNull(ECGLeadsGroup);DicomContextIdentifierType type = ECGLeadsGroup.ContextIdentifier;DicomCodedConcept codedConcept = DicomContextGroupTable.Instance.FindCodedConcept(ECGLeadsGroup, "MDC", "2:1");Assert.IsNotNull(codedConcept);using (DicomCodeSequenceItem codeSequenceItem = new DicomCodeSequenceItem()){codeSequenceItem.CodeValue = codedConcept.CodeValue;codeSequenceItem.CodingSchemeDesignator = codedConcept.CodingSchemeDesignator;codeSequenceItem.CodingSchemeVersion = codedConcept.CodingSchemeVersion;codeSequenceItem.CodeMeaning = codedConcept.CodeMeaning;// Set the channel sourcechannel.SetChannelSource(codeSequenceItem);}///////////////////////Channel Sensitivity////////////////////////using (DicomCodeSequenceItem sourceSequenceItem = new DicomCodeSequenceItem()){sourceSequenceItem.CodeValue = "mV";sourceSequenceItem.CodingSchemeDesignator = "UCUM";sourceSequenceItem.CodingSchemeVersion = string.Empty;sourceSequenceItem.CodeMeaning = "millivolt";// Set the channel sensitivitychannel.SetChannelSensitivity(true, 0.001220, sourceSequenceItem, 1.0, 0.0);}}// Add annotations for the channelvoid SetChannelAnnotations(DicomWaveformChannel channel){// Delete any existing channel annotationsfor (int index = 0; index < channel.GetAnnotationCount(); index++){if (channel.GetAnnotation(index) != null){channel.DeleteAnnotation(index);}}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.UnformattedTextValueDicomCodeSequenceItem 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);channel.AddAnnotation(waveformAnnotation);}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
