GetDoubleValue Example for C#
//This example uses the predefined variable “Text1” of type
“TextBox” from “.NET Framework”.
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestGetDoubleValue()
{
int lCount = 0;
int x = 0;
short nRet = 0;
LEADDICOM1.EnableMethodErrors
= false;
//move to the root element
LEADDICOM1.MoveFirstElement(false);
LEADDICOM1.MoveRootElement();
//insert a new element for the Double Values
LEADDICOM1.InsertElement(false,
(int)LTDICLib.DicomDataSetTagConstants4.TAG_REFERENCE_PIXEL_PHYSICAL_VALUE_X,
(short)LTDICLib.DicomVRCodeConstants.VR_FD, false, 0);
Text1.Visible = true;
Text1.Text = "";
//insert some Double values into the element
LEADDICOM1.DoubleValueCount
= 5;
for (x = 0; x < 5; x++)
{
LEADDICOM1.set_DoubleValues(x,
10 * x * 199.77);
}
//set the floats
nRet = LEADDICOM1.SetDoubleValue(5);
if (nRet != 0)
{
MessageBox.Show("Error");
return;
}
LEADDICOM1.DoubleValueCount
= 0;
//free the values
Text1.Visible = true;
Text1.Text = "";
//get the value count
lCount = LEADDICOM1.GetValueCount();
MessageBox.Show("There are " + System.Convert.ToString(lCount)
+ " values!");
//get the values
nRet = LEADDICOM1.GetDoubleValue(0,
lCount);
if (nRet == 0)
{
for (x = 0; x < LEADDICOM1.DoubleValueCount;
x++)
{
//display each value separated by a " X "
Text1.Text = Text1.Text + " X " + System.Convert.ToString(LEADDICOM1.get_DoubleValues(x));
}
}
LEADDICOM1.EnableMethodErrors
= true;
}