Gets the number of overlays in the Data Set.
public int OverlayCount {get;} Public ReadOnly Property OverlayCount As Integer public int OverlayCount {get;} public int getOverlayCount() get_OverlayCount(); public:property int OverlayCount {int get();}
The number of overlays in the Data Set.
This property gets the number of overlays inside a Data Set by counting the number of repeating groups in the range (6000-601E).
This example will read a DICOM dataset and update its overlay attributes and overlay image.
using Leadtools;using Leadtools.Dicom;public void TestOverlay(){string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "Overlay.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);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 framesRasterImage 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 frameds1.Save(Path.Combine(LEAD_VARS.ImagesDir, "NewOverlay.dcm"), DicomDataSetSaveFlags.None);}}}}}DicomEngine.Shutdown();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.DicomPublic Sub TestOverlay()Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Overlay.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)If ds.OverlayCount > 0 ThenDim attributes As RasterOverlayAttributes = ds.GetOverlayAttributes(0)If Not attributes Is Nothing Then' 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 framesDim overlayImage As RasterImage = ds.GetOverlayImage(0)If Not overlayImage Is Nothing ThenDim ds1 As DicomDataSet = New DicomDataSet()Using (ds1)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 frameds1.Save(Path.Combine(LEAD_VARS.ImagesDir, "NewOverlay.dcm"), DicomDataSetSaveFlags.None)End UsingEnd IfEnd IfEnd IfEnd UsingDicomEngine.Shutdown()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Dicom;using Leadtools.Examples;public void TestOverlay(Stream dicomStream, Stream outputStream){//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(dicomStream, 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 framesRasterImage 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 frameds1.Save(outputStream, DicomDataSetSaveFlags.None);}}}}}DicomEngine.Shutdown();}
Imports LeadtoolsImports Leadtools.DicomPublic Sub TestOverlay(ByVal dicomStream As Stream, ByVal outputStream As Stream)'Make sure to initialize the DICOM engine, this needs to be done only once'In the whole applicationDicomEngine.Startup()Using ds As DicomDataSet = New DicomDataSet()'Load DICOM Fileds.Load(dicomStream, DicomDataSetLoadFlags.None)If ds.OverlayCount > 0 ThenDim attributes As RasterOverlayAttributes = ds.GetOverlayAttributes(0)If Not attributes Is Nothing Then' 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 framesDim overlayImage As RasterImage = ds.GetOverlayImage(0)If Not overlayImage Is Nothing ThenUsing ds1 As DicomDataSet = 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 frameds1.Save(outputStream, DicomDataSetSaveFlags.None)End UsingEnd IfEnd IfEnd IfEnd UsingDicomEngine.Shutdown()End Sub
|
Products |
Support |
Feedback: OverlayCount Property - Leadtools.Dicom |
Introduction |
Help Version 19.0.2017.6.16
|

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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.