FindFirstElement Example for C#
//This example uses the predefined variable “LEADRasterView1”
of type “AxLEADRasterView” from “"LEADTOOLS Toolkit”. //LEADDICOM1
is a DICOM Dataset defined outside this method
private void TestFindFirstElement(object eventSender, System.EventArgs
eventArgs)
{
try
{
//Find the first image element and
display it
LEADDICOM1.EnableMethodErrors
= true;
//move to first element in Data Set
LEADDICOM1.MoveFirstElement(false);
LEADDICOM1.FindFirstElement((int)LTDICLib.DicomDataSetTagConstants9.TAG_PIXEL_DATA,
false);
LEADDICOM1.GetBitmapValue(0,
0, (short)LTDICLib.DicomColorOrderConstants.ORDER_RGB, 0);
LEADRasterView1.Raster.Bitmap = LEADDICOM1.Bitmap;
LEADDICOM1.Bitmap = 0;
LEADDICOM1.FindTag(LEADDICOM1.get_CurrentElement().Tag);
MessageBox.Show("Element: "
+ LEADDICOM1.get_CurrentTag().Name);
//find each image
while (true)
{
LEADDICOM1.FindNextElement(false);
LEADDICOM1.GetBitmapValue(0,
0, (short)LTDICLib.DicomColorOrderConstants.ORDER_RGB, 0);
LEADRasterView1.Raster.Bitmap
= LEADDICOM1.Bitmap;
LEADDICOM1.Bitmap
= 0;
LEADDICOM1.FindTag(LEADDICOM1.get_CurrentElement().Tag);
MessageBox.Show("Element:
" + LEADDICOM1.get_CurrentTag().Name);
}
}
catch
{
MessageBox.Show("No More Images");
}
}