←Select platform

DicomGetImageCallback Delegate

Syntax
C#
C++/CLI
Java
public delegate bool DicomGetImageCallback( 
   int page, 
   int count 
) 
public interface DicomGetImageCallback  
{ 
  public boolean onDicomGetImageCallback(int page, int count); 
} 
public delegate bool DicomGetImageCallback(  
   int page, 
   int count 
) 

Parameters

page
Zero based index of the image being loaded from the DicomDataSet.

Return Value

true to continue, false to abort the load.

Example
C#
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"; 
} 
Requirements

Target Platforms

See Also

Reference

DicomGetImageCallback Members

Leadtools.Dicom Namespace

Help Version 23.0.2024.8.20
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.