MoveFirstTag Example for C#
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestMoveFirstTag()
{
try
{
LEADDICOM1.EnableMethodErrors
= true;
LEADDICOM1.MoveFirstTag();
DisplayTagItem();
MessageBox.Show("wait");
LEADDICOM1.MoveNextTag();
DisplayTagItem();
MessageBox.Show("wait");
LEADDICOM1.MoveLastTag();
DisplayTagItem();
MessageBox.Show("wait");
LEADDICOM1.MovePrevTag();
DisplayTagItem();
MessageBox.Show("wait");
}
catch
{ }
}
//LEADDICOM1 is a DICOM Dataset defined outside this method
//This example uses the predefined variable “Text1” of type “TextBox” from
“.NET Framework”.
//This example uses the predefined variable “Text2” of type “TextBox” from
“.NET Framework”.
//This example uses the predefined variable “Text3” of type “TextBox” from
“.NET Framework”.
//This example uses the predefined variable “Text5” of type “TextBox” from
“.NET Framework”.
//This example uses the predefined variable “Text6” of type “TextBox” from
“.NET Framework”.
//This example uses the predefined variable “Text7” of type “TextBox” from
“.NET Framework”.
private void DisplayTagItem()
{
try
{
string szItem = null;
string szItemL = null;
string szItemR = null;
int nLen = 0;
int x = 0;
LEADDICOM1.EnableMethodErrors
= true;
szItem = System.Convert.ToString(LEADDICOM1.get_CurrentTag().Code, 16).ToUpper();
nLen = szItem.Length;
szItemR = szItem.Substring(szItem.Length
- 4);
szItemL = "";
for (x = nLen; x <= 7; x++)
{
szItemL = szItemL
+ System.Convert.ToString(0);
}
szItemL = szItemL + szItem.Substring(0,
nLen - 4);
Text1.Text = szItemL + ":"
+ szItemR;
szItem = System.Convert.ToString(LEADDICOM1.get_CurrentTag().Mask, 16).ToUpper();
nLen = szItem.Length;
szItemR = szItem.Substring(szItem.Length
- 4);
szItemL = "";
for (x = nLen; x <= 7; x++)
{
szItemL = szItemL
+ System.Convert.ToString(0);
}
szItemL = szItemL + szItem.Substring(0,
nLen - 4);
Text2.Text = szItemL + ":"
+ szItemR;
Text3.Text = LEADDICOM1.get_CurrentTag().Name;
switch ( LEADDICOM1.get_CurrentTag().VR
)
{
case (short)LTDICLib.DicomVRCodeConstants.VR_AE:
Text4.Text
= "AE";
break;
case (short)LTDICLib.DicomVRCodeConstants.VR_AS:
Text4.Text
= "AS";
break;
case (short)LTDICLib.DicomVRCodeConstants.VR_AT:
Text4.Text
= "AT";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_CS:
Text4.Text
= "CS";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_DA:
Text4.Text
= "DA";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_DS:
Text4.Text
= "DS";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_DT:
Text4.Text
= "DT";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_FD:
Text4.Text
= "FD";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_FL:
Text4.Text
= "FL";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_IS:
Text4.Text
= "IS";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_LO:
Text4.Text
= "LO";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_LT:
Text4.Text
= "LT";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_OB:
Text4.Text
= "OB";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_OW:
Text4.Text
= "OW";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_PN:
Text4.Text
= "PN";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_SH:
Text4.Text
= "SH";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_SL:
Text4.Text
= "SL";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_SQ:
Text4.Text
= "SQ";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_SS:
Text4.Text
= "SS";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_ST:
Text4.Text
= "ST";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_TM:
Text4.Text
= "TM";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_UI:
Text4.Text
= "UI";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_UL:
Text4.Text
= "UL";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_UN:
Text4.Text
= "UN";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_US:
Text4.Text
= "US";
break;
case
(short)LTDICLib.DicomVRCodeConstants.VR_UT:
Text4.Text
= "UT";
break;
default:
Text4.Text
= System.Convert.ToString(LEADDICOM1.get_CurrentTag().VR);
break;
}
Text5.Text = System.Convert.ToString(LEADDICOM1.get_CurrentTag().MinVM);
Text6.Text = System.Convert.ToString(LEADDICOM1.get_CurrentTag().MaxVM);
Text7.Text = System.Convert.ToString(LEADDICOM1.get_CurrentTag().DivideVM);
}
catch
{ }
}