Gets the images of a Pixel Data element.
public RasterImage GetImages(DicomElement element,int index,int count,int bitsPerPixel,RasterByteOrder order,DicomGetImageFlags flags,DicomGetImageCallback callback)
Public Overloads Function GetImages( _ByVal element As Leadtools.Dicom.DicomElement, _ByVal index As Integer, _ByVal count As Integer, _ByVal bitsPerPixel As Integer, _ByVal order As Leadtools.RasterByteOrder, _ByVal flags As Leadtools.Dicom.DicomGetImageFlags, _ByVal callback As Leadtools.Dicom.DicomGetImageCallback _) As Leadtools.RasterImage
public Leadtools.RasterImage GetImages(Leadtools.Dicom.DicomElement element,int index,int count,int bitsPerPixel,Leadtools.RasterByteOrder order,Leadtools.Dicom.DicomGetImageFlags flags,Leadtools.Dicom.DicomGetImageCallback callback)
function Leadtools.Dicom.DicomDataSet.GetImages(DicomElement,Int32,Int32,Int32,RasterByteOrder,DicomGetImageFlags,DicomGetImageCallback)(element ,index ,count ,bitsPerPixel ,order ,flags ,callback)
public:Leadtools.RasterImage^ GetImages(Leadtools.Dicom.DicomElement^ element,int index,int count,int bitsPerPixel,Leadtools.RasterByteOrder order,Leadtools.Dicom.DicomGetImageFlags flags,Leadtools.Dicom.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, "IMAGE1.dcm");//Make sure to initialize the DICOM engine, this needs to be done only once in the whole applicationDicomEngine.Startup();using (DicomDataSet ds = new DicomDataSet()){//Load DICOM Fileds.Load(dicomFileName, DicomDataSetLoadFlags.None);DicomElement pixelDataElement = ds.FindFirstElement(null, DicomTag.PixelData, true);if (pixelDataElement == null){MessageBox.Show("This dataset is missing the pixel data element", "Sample");return;}if (ds.GetImageCount(pixelDataElement) == 0){MessageBox.Show("This dataset has no images", "Sample");return;}DicomImageInformation imageInformation = ds.GetImageInformation(pixelDataElement, 0);if (imageInformation == null){MessageBox.Show("Can't retrieve image information", "Sample");return;}// Get all the frames into a RasterImage objectRasterImage image = ds.GetImages(pixelDataElement, 0, imageInformation.FrameCount, 0, RasterByteOrder.Gray,DicomGetImageFlags.AllowRangeExpansion | DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AutoApplyVoiLut,DicomTestGetImageCallback);if (image == null){MessageBox.Show("Can't retrieve image", "Sample");return;}System.Diagnostics.Debug.WriteLine(string.Format("Total Images: {0}", image.PageCount));}DicomEngine.Shutdown();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.DicomPrivate Function DicomTestGetImageCallback(index As Integer, count As Integer) As BooleanSystem.Diagnostics.Debug.WriteLine(String.Format("GetImage: {0} of {1}", index + 1, count))Return TrueEnd FunctionPublic Sub TestDicomGetImages()Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.dcm")' Make sure to initialize the DICOM engine, this needs to be done only once in the whole applicationDicomEngine.Startup()Dim ds As DicomDataSet = New DicomDataSet()Using (ds)'Load DICOM Fileds.Load(dicomFileName, DicomDataSetLoadFlags.None)Dim pixelDataElement As DicomElement = ds.FindFirstElement(Nothing, DicomTag.PixelData, True)If pixelDataElement Is Nothing ThenMessageBox.Show("This dataset is missing the pixel data element", "Sample")ReturnEnd IfIf ds.GetImageCount(pixelDataElement) = 0 ThenMessageBox.Show("This dataset has no images", "Sample")ReturnEnd IfDim imageInformation As DicomImageInformation = ds.GetImageInformation(pixelDataElement, 0)If imageInformation Is Nothing ThenMessageBox.Show("Can't retrieve image information", "Sample")ReturnEnd If' Get all the frames into a RasterImage objectDim image As RasterImage = ds.GetImages(pixelDataElement, 0, imageInformation.FrameCount, 0, RasterByteOrder.Gray,DicomGetImageFlags.AllowRangeExpansion Or DicomGetImageFlags.AutoApplyModalityLut Or DicomGetImageFlags.AutoApplyVoiLut,AddressOf DicomTestGetImageCallback)If image Is Nothing ThenMessageBox.Show("Can't retrieve image", "Sample")ReturnEnd IfSystem.Diagnostics.Debug.WriteLine(String.Format("Total Images: {0}", image.PageCount))End UsingDicomEngine.Shutdown()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
