Gets the number of overlays in the Data Set.
Supported in Silverlight, Windows Phone 7.
Syntax
Visual Basic (Declaration) | |
---|
Public ReadOnly Property OverlayCount As Integer |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As DicomDataSet
Dim value As Integer
value = instance.OverlayCount |
C# | |
---|
public int OverlayCount {get;} |
C++/CLI | |
---|
public:
property int OverlayCount {
int get();
} |
Property Value
The number of overlays in the Data Set.
Example
This example will read a DICOM dataset and update its overlay attributes and overlay image.
Visual Basic | Copy Code |
---|
Public Sub TestOverlay()
Dim dicomFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Overlay.dcm"
'Make sure to initialize the DICOM engine, this needs to be done only once
'In the whole application
DicomEngine.Startup()
Dim ds As DicomDataSet = New DicomDataSet()
Using (ds)
'Load DICOM File
ds.Load(dicomFileName, DicomDataSetLoadFlags.None)
If ds.OverlayCount > 0 Then
Dim 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 frames
Dim overlayImage As RasterImage = ds.GetOverlayImage(0)
If Not overlayImage Is Nothing Then
Dim 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 frame
ds1.Save(LeadtoolsExamples.Common.ImagesPath.Path + "NewOverlay.dcm", DicomDataSetSaveFlags.None)
End Using
End If
End If
End If
End Using
DicomEngine.Shutdown()
End Sub |
C# | Copy Code |
---|
public void TestOverlay()
{
string dicomFileName = LeadtoolsExamples.Common.ImagesPath.Path + "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(LeadtoolsExamples.Common.ImagesPath.Path + "NewOverlay.dcm", DicomDataSetSaveFlags.None);
}
}
}
}
}
DicomEngine.Shutdown();
} |
SilverlightCSharp | Copy Code |
---|
public void TestOverlay(Stream dicomStream, Stream outputStream)
{
//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(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 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(outputStream, DicomDataSetSaveFlags.None);
}
}
}
}
}
DicomEngine.Shutdown();
} |
SilverlightVB | Copy Code |
---|
Public 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 application
DicomEngine.Startup()
Using ds As DicomDataSet = New DicomDataSet()
'Load DICOM File
ds.Load(dicomStream, DicomDataSetLoadFlags.None)
If ds.OverlayCount > 0 Then
Dim 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 frames
Dim overlayImage As RasterImage = ds.GetOverlayImage(0)
If Not overlayImage Is Nothing Then
Using 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 frame
ds1.Save(outputStream, DicomDataSetSaveFlags.None)
End Using
End If
End If
End If
End Using
DicomEngine.Shutdown()
End Sub |
Remarks
Requirements
Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)
See Also