public RasterImage GetImages(
DicomElement element,
int index,
int count,
int bitsPerPixel,
RasterByteOrder order,
DicomGetImageFlags flags,
DicomGetImageCallback callback
)
public:
RasterImage^ GetImages(
DicomElement^ element,
int index,
int count,
int bitsPerPixel,
RasterByteOrder order,
DicomGetImageFlags flags,
DicomGetImageCallback^ callback
)
element
An item in the Data Set.
index
The zero-based index of the first frame to load.
count
Value that represents the number of frames to load.
bitsPerPixel
Value that represents the resulting image pixel depth. Possible values are:
Value | Meaning |
---|---|
0 | Keep the original file's pixel depth (do not convert). |
1 to 8 | Use the specified bits per pixel in the resulting image. |
12 | Use 12 bits per pixel in the resulting image. |
16 | Use 16 bits per pixel in the resulting image. |
24 | Use 24 bits per pixel in the resulting image. |
32 | Use 32 bits per pixel in the resulting image. |
order
This value is ignored.
flags
Flags that control the behavior of this method.
callback
DicomGetImageCallback which will be called for each image that is loaded. This parameter cannot be null.
The images of a Pixel Data element.
For more details, see GetImages
This example will read a DICOM dataset and get all the images from the pixel data element.
using Leadtools;
using Leadtools.Dicom;
private bool DicomTestGetImageCallback(int index, int count)
{
System.Diagnostics.Debug.WriteLine(string.Format("GetImage: {0} of {1}", index + 1, count));
return true;
}
public void TestDicomGetImages()
{
string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "IMAGE1.dcm");
//Make sure to initialize the DICOM engine, this needs to be done only once in the whole application
DicomEngine.Startup();
using (DicomDataSet ds = new DicomDataSet())
{
//Load DICOM File
ds.Load(dicomFileName, DicomDataSetLoadFlags.None);
DicomElement pixelDataElement = ds.FindFirstElement(null, DicomTag.PixelData, true);
if (pixelDataElement == null)
{
Console.WriteLine("Sample: This dataset is missing the pixel data element");
return;
}
if (ds.GetImageCount(pixelDataElement) == 0)
{
Console.WriteLine("Sample: This dataset has no images");
return;
}
DicomImageInformation imageInformation = ds.GetImageInformation(pixelDataElement, 0);
if (imageInformation == null)
{
Console.WriteLine("Sample: Can't retrieve image information");
return;
}
// Get all the frames into a RasterImage object
RasterImage image = ds.GetImages(pixelDataElement, 0, imageInformation.FrameCount, 0, RasterByteOrder.Gray,
DicomGetImageFlags.AllowRangeExpansion | DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AutoApplyVoiLut,
DicomTestGetImageCallback);
if (image == null)
{
Console.WriteLine("Sample: Can't retrieve image");
return;
}
Debug.WriteLine(string.Format("Total Images: {0}", image.PageCount));
}
DicomEngine.Shutdown();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
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