←Select platform

GetOverlayImages Method

Summary
Loads the image(s) with frames from the "Overlay Data" (60xx, 3000) element.
Syntax
C#
C++/CLI
Java
public RasterImage GetOverlayImages( 
   int index, 
   int overlayFrameIndex, 
   int count 
) 
public RasterImage getOverlayImages(int index, int overlayFrameIndex, int count) 
public: 
RasterImage^ GetOverlayImages(  
   int index, 
   int overlayFrameIndex, 
   int count 
)  

Parameters

index
The zero-based index of the overlay whose frames are required.

overlayFrameIndex
The zero-based index of the first frame to load.

count
Value that represents the number of frames to load.

Return Value

Image(s) with frames from the "Overlay Data" (60xx, 3000) element.

Remarks

Before calling this method, you must call GetOverlayAttributes. The FramesInOverlay property will be updated with the number of frames under an overlay. As an example, To load 5 frames starting with the 1st frame in the "Overlay Data", call this method with overlayFrameIndex set to 0 and count set to 5.

Example
C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
public void TestOverlay() 
{ 
   string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "Overlay.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); 
 
      if (ds.OverlayCount > 0) 
      { 
         RasterOverlayAttributes attributes = ds.GetOverlayAttributes(0); 
         if (attributes != null) 
         { 
            // We can call in here methods like GetOverlayGroupNumber, IsOverlayInDataset  
            // and GetOverlayActivationLayer to get some further infromation about the overlay 
 
            //Let's get the overlay Image, If RasterOverlayAttributes.NumFramesInOverlay  
            //Is greater than 1 we can call GetOverlayImages to extract all the frames 
            RasterImage overlayImage = ds.GetOverlayImage(0); 
            if (overlayImage != null) 
            { 
               using (DicomDataSet ds1 = new DicomDataSet()) 
               { 
                  ds1.Initialize(DicomClassType.DXImageStoragePresentation, DicomDataSetInitializeType.ExplicitVRLittleEndian); 
                  ds1.SetOverlayAttributes(0, attributes, DicomSetOverlayFlags.None); 
                  ds1.SetOverlayImage(0, overlayImage);//We can call SetOverlayImages if the overlay has more than one frame 
                  ds1.Save(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "NewOverlay.dcm"), DicomDataSetSaveFlags.None); 
               } 
            } 
         } 
      } 
   } 
   DicomEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
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.