public RasterOverlayAttributes GetOverlayAttributes(
int index
)
public RasterOverlayAttributes getOverlayAttributes(int index)
public:
RasterOverlayAttributes^ GetOverlayAttributes(
int index
)
index
The zero-based index of the overlay whose attributes are required.
The overlay attributes.
Most of the members of RasterOverlayAttributes are based on the "Overlay Plane Module Attributes" in the DICOM standard. If the overlay data is embedded in the "Image Pixel Data" (7FE0,0010), UseBitPlane will be set to true. If UseBitPlane is false, then the overlay data is stored in the "Overlay Data" (60xx,3000) element and in this case you can call GetOverlayImage to get the data for that overlay.
Origin will hold the value of the "Overlay Origin" (60xx,0050) element; however, the upper left pixel of the image will have the coordinate 0\0, instead of 1\1 (as in the DICOM standard).
This method will always set Color to black.
For multi-frame overlays, this method will update FramesInOverlay with the value of "Number of Frames in Overlay" (60xx,0015) element and ImageFrameOrigin with the value of "Image Frame Origin" (60xx,0051) element.
ActivationLayer will be updated with the value of the element "Overlay Activation Layer" (60xx,1001).
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";
}
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