←Select platform

SetDoubleValueExt Method

Summary
Sets the double values, or any other numeric value representation of a Data Element.
Syntax
C#
C++/CLI
Java
public bool SetDoubleValueExt( 
   DicomElement element, 
   double[] value, 
   int count 
) 
public boolean setDoubleValueExt(DicomElement element, double[]doubleValue, int count) 
public: 
bool SetDoubleValueExt(  
   DicomElement^ element, 
   array<double>^ value, 
   int count 
)  

Parameters

element
An item in the Data Set.

value
Buffer that contains the numeric value(s) to set. If you want to set multiple values in the Value Field, put all numeric values in value and set count to the appropriate number of values.

count
Value that represents the number of values to set in the Value Field. If you want to set multiple values in the Value Field, put all the numeric values in value and set count to the appropriate number.

Return Value

true if the numeric values were set successfully; otherwise, it is false (the numeric values of the Data Element could not be set).

Remarks

If you want to set more than one value in the Value Field of the Data Element, put all the numeric values in the value and set count to the corresponding number of entries. For example, if you wish to set three numeric values in the Value Field of the Data Element, put the three numeric values in value and set count to three. If more than one value is stored in the Value Field of the Data Element, you must set all values at the same time.

This method differs from SetDoubleValue in that it can be called with any numeric value representation, including:

If you call this method on an integer VR, any fractional part of the input values will be truncated. If you call this method with an input value that is greater than largest maximum value of the VR, then the input value will be adjusted to be the maximum value of the VR. If you call this method with an input value that is less than the smallest minimum value of the VR, then the input value will be adjusted to be the minimum value of the VR. For more information about Value Representations, refer to Default Value Representation Table.

Example

This example will insert several elements into a DICOM dataset, and then set and retrieve the values.

C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
/// 
public void DicomDataSet_SetDoubleValueExtExample() 
{ 
   DicomDataSet ds = new DicomDataSet(); 
   DicomElement element = null; 
   double[] doubleValues = null; 
   double[] retrieveDoubleValues = null; 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorATValue, DicomVRType.AT, false, 0); 
   doubleValues = new double[] { DicomTag.PatientName, DicomTag.PatientID, DicomTag.DigitalSignaturesSequence }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorISValue, DicomVRType.IS, false, 0); 
   doubleValues = new double[] { -2147483648, 2147483647 }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorSLValue, DicomVRType.SL, false, 0); 
   doubleValues = new double[] { -2147483648, 2147483647 }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorULValue, DicomVRType.UL, false, 0); 
   doubleValues = new double[] { 0, 4294967295 }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorUSValue, DicomVRType.US, false, 0); 
   doubleValues = new double[] { 0, 65535 }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorSSValue, DicomVRType.SS, false, 0); 
   doubleValues = new double[] { -32768, 32767 }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorFLValue, DicomVRType.FL, false, 0); 
   doubleValues = new double[] { -1.2345F, +1.2345F }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   element = ds.InsertElement(null, true, DicomTag.SelectorFDValue, DicomVRType.FD, false, 0); 
   doubleValues = new double[] { -1.2345F, +1.2345F }; 
   ds.SetDoubleValueExt(element, doubleValues, doubleValues.Length); 
   retrieveDoubleValues = ds.GetDoubleValueExt(element, 0, doubleValues.Length); 
   CompareDoubleArrays(doubleValues, retrieveDoubleValues); 
 
   Console.WriteLine("Finished"); 
} 
 
public void CompareDoubleArrays(double[] d1, double[] d2) 
{ 
   if (d1 == null || d2 == null) 
      return; 
 
   if (d1.Length != d2.Length) 
   { 
      Console.WriteLine("Error: Not Equal"); 
      return; 
   } 
 
   for (int i = 0; i < d1.Length; i++) 
   { 
      if (d1[i] != d2[i]) 
      { 
         Console.WriteLine("Error: Not Equal"); 
         return; 
      } 
   } 
} 
Requirements

Target Platforms

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

Leadtools.Dicom Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.