←Select platform

DefaultObject Property

Summary

Gets or sets the defaults used when calling ToAnnObject.

Syntax

C#
VB
C++
public object DefaultObject { get; set; } 
  
Public Property DefaultObject As Object 
public: 
property Object^ DefaultObject { 
   Object^ get(); 
   void set (    Object^ ); 
} 

Property Value

Contains defaults that are usedwhen calling ToAnnObject.

Remarks

A Leadtools.Dicom.DicomAnnotationObject can be filled, however it doesn't have fill color, pen color, text color or a font. An Leadtools.Annotations.AnnObject can have a fill color, a pen color, a text color, and a font. When calling ToAnnObject to convert a Leadtools.Dicom.DicomAnnotationObject, the DefaultObject is an AnnObject that is referenced when setting the default values. Note: for Silverlight users, the System.Object is of type Leadtools.Windows.Annotations.AnnObject

Example

This sample does the following:

  1. Creates a rectangle annotation object.
  2. Creates Leadtools.Dicom.DicomDataSet that is type GrayscaleSoftcopyPresentationState that will hold the annotations.
  3. Creates a converter
  4. Converts LEAD annotation to DICOM annotations, and automatically saves in the Leadtools.Dicom.DicomDataSet
    C#
    VB
    Silverlight C#
    Silverlight VB
    using Leadtools; 
    using Leadtools.Annotations; 
    using Leadtools.Dicom; 
    using Leadtools.Dicom.Annotations; 
     
    public void DicomDataSet_FromAnnObjectToDataSet(string outfile) 
    { 
       DicomEngine.Startup(); 
       // Create a dataset 
       DicomDataSet ds = new DicomDataSet(); 
       ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryElementsOnly | DicomDataSetInitializeFlags.AddMandatoryModulesOnly); 
     
       // Create an AnnRectangleObject 
       AnnRectangleObject annObject = new AnnRectangleObject(); 
       annObject.Pen = new AnnPen(Color.Purple, new AnnLength(5)); 
     
       annObject.Brush = new AnnSolidBrush(Color.White); 
       annObject.Bounds = new AnnRectangle(400, 100, 100, 100); 
     
       // Save in the dataset as DICOM annotation 
       DicomElement element = ds.FindFirstElement(null, DicomTag.GraphicAnnotationSequence, true); 
       if (null == element) 
       { 
          element = ds.InsertElement(null, false, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, true, 0); 
       } 
     
       DicomElement itemElement = ds.GetChildElement(element, true); 
       if (null == itemElement) 
       { 
          // Add Item Node 
          itemElement = ds.InsertElement(element, true, DicomTag.Item, DicomVRType.CS, true, -1); 
          if (null == itemElement) 
             return; 
     
          ds.InsertElement(itemElement, true, DicomTag.TextObjectSequence, DicomVRType.SQ, true, -1); 
          ds.InsertElement(itemElement, true, DicomTag.GraphicObjectSequence, DicomVRType.SQ, true, -1); 
          ds.InsertElement(itemElement, true, DicomTag.ReferencedImageSequence, DicomVRType.SQ, true, -1); 
          ds.InsertElement(itemElement, true, DicomTag.GraphicLayer, DicomVRType.CS, false, -1); 
          if (null != element) 
          { 
             ds.SetStringValue(element, "LEAD OBJECTS LAYER", DicomCharacterSetType.Default); 
          } 
     
          // Add graphic layer 
          DicomGraphicLayer GraphicLayer = new DicomGraphicLayer(); 
     
          GraphicLayer.LayerOrder = 1; 
          GraphicLayer.RgbLayerColor = 0; // null 
          GraphicLayer.LayerDescription = "Layer for LEAD objects"; 
          GraphicLayer.LayerName = "LEAD OBJECTS LAYER"; 
          GraphicLayer.Grayscale = 65535; 
          int index = ds.CreateLayer(GraphicLayer); 
       } 
     
       DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); 
       du.FromAnnObjectToDataSet(ds, annObject, itemElement); 
       ds.Save(outfile, DicomDataSetSaveFlags.None); 
     
       DicomEngine.Shutdown(); 
    } 
    Imports Leadtools 
    Imports Leadtools.Annotations 
    Imports Leadtools.Dicom 
    Imports Leadtools.Dicom.Annotations 
     
    Public Sub DicomDataSet_FromAnnObjectToDataSet(ByVal outfile As String) 
       DicomEngine.Startup() 
       ' Create a dataset 
       Dim ds As New DicomDataSet() 
       ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryElementsOnly Or DicomDataSetInitializeFlags.AddMandatoryModulesOnly) 
     
       ' Create an AnnRectangleObject 
       Dim annObject As New AnnRectangleObject() 
       annObject.Pen = New AnnPen(Color.Purple, New AnnLength(5)) 
     
       annObject.Brush = New AnnSolidBrush(Color.White) 
       annObject.Bounds = New AnnRectangle(400, 100, 100, 100) 
     
       ' Save in the dataset as DICOM annotation 
       Dim element As DicomElement = ds.FindFirstElement(Nothing, DicomTag.GraphicAnnotationSequence, True) 
       If Nothing Is element Then 
          element = ds.InsertElement(Nothing, False, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, True, 0) 
       End If 
     
       Dim itemElement As DicomElement = ds.GetChildElement(element, True) 
       If Nothing Is itemElement Then 
          ' Add Item Node 
          itemElement = ds.InsertElement(element, True, DicomTag.Item, DicomVRType.CS, True, -1) 
          If Nothing Is itemElement Then 
             Return 
          End If 
     
          ds.InsertElement(itemElement, True, DicomTag.TextObjectSequence, DicomVRType.SQ, True, -1) 
          ds.InsertElement(itemElement, True, DicomTag.GraphicObjectSequence, DicomVRType.SQ, True, -1) 
          ds.InsertElement(itemElement, True, DicomTag.ReferencedImageSequence, DicomVRType.SQ, True, -1) 
          ds.InsertElement(itemElement, True, DicomTag.GraphicLayer, DicomVRType.CS, False, -1) 
          If Nothing IsNot element Then 
             ds.SetStringValue(element, "LEAD OBJECTS LAYER", DicomCharacterSetType.Default) 
          End If 
     
          ' Add graphic layer 
          Dim GraphicLayer As New DicomGraphicLayer() 
     
          GraphicLayer.LayerOrder = 1 
          GraphicLayer.RgbLayerColor = 0 ' null 
          GraphicLayer.LayerDescription = "Layer for LEAD objects" 
          GraphicLayer.LayerName = "LEAD OBJECTS LAYER" 
          GraphicLayer.Grayscale = 65535 
          Dim index As Integer = ds.CreateLayer(GraphicLayer) 
       End If 
     
       Dim du As New DicomAnnotationsUtilities() 
       du.FromAnnObjectToDataSet(ds, annObject, itemElement) 
       ds.Save(outfile, DicomDataSetSaveFlags.None) 
    End Sub 
    using Leadtools; 
    using Leadtools.Dicom; 
    using Leadtools.Dicom.Annotations; 
    using Leadtools.Windows.Annotations; 
    using Leadtools.Examples; 
     
    public void DicomDataSet_FromAnnObjectToDataSet(Stream outputStream) 
    { 
       // Create a datset 
       DicomDataSet ds = new DicomDataSet(); 
       ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryElementsOnly | DicomDataSetInitializeFlags.AddMandatoryModulesOnly); 
     
       // Create an AnnRectangleObject 
       AnnRectangleObject annObject = new AnnRectangleObject(); 
       annObject.Stroke = Color.FromArgb(0xFF, 0x80, 0x00, 0x80); // purple 
       annObject.StrokeThickness = 5; 
     
       annObject.Fill = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); // white 
       annObject.Rect = new Rect(400, 100, 500, 200); 
     
       // Save in the dataset as DICOM annotation 
       DicomElement element = ds.FindFirstElement(null, DicomTag.GraphicAnnotationSequence, true); 
       if (null == element) 
       { 
          element = ds.InsertElement(null, false, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, true, 0); 
       } 
     
       DicomElement itemElement = ds.GetChildElement(element, true); 
       if (null == itemElement) 
       { 
          // Add Item Node 
          itemElement = ds.InsertElement(element, true, DicomTag.Item, DicomVRType.CS, true, -1); 
          if (null == itemElement) 
             return; 
     
          ds.InsertElement(itemElement, true, DicomTag.TextObjectSequence, DicomVRType.SQ, true, -1); 
          ds.InsertElement(itemElement, true, DicomTag.GraphicObjectSequence, DicomVRType.SQ, true, -1); 
          ds.InsertElement(itemElement, true, DicomTag.ReferencedImageSequence, DicomVRType.SQ, true, -1); 
          ds.InsertElement(itemElement, true, DicomTag.GraphicLayer, DicomVRType.CS, false, -1); 
          if (null != element) 
          { 
             ds.SetStringValue(element, "LEAD OBJECTS LAYER", DicomCharacterSetType.Default); 
          } 
     
          // Add graphic layer 
          DicomGraphicLayer GraphicLayer = new DicomGraphicLayer(); 
     
          GraphicLayer.LayerOrder = 1; 
          GraphicLayer.RgbLayerColor = 0; // null 
          GraphicLayer.LayerDescription = "Layer for LEAD objects"; 
          GraphicLayer.LayerName = "LEAD OBJECTS LAYER"; 
          GraphicLayer.Grayscale = 65535; 
          int index = ds.CreateLayer(GraphicLayer); 
       } 
     
       DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); 
       du.FromAnnObjectToDataSet(ds, annObject, itemElement); 
       ds.Save(outputStream, DicomDataSetSaveFlags.None); 
    } 
    Imports Leadtools 
    Imports Leadtools.Dicom 
    Imports Leadtools.Dicom.Annotations 
    Imports Leadtools.Windows.Annotations 
     
    Public Sub DicomDataSet_FromAnnObjectToDataSet(ByVal outputStream As Stream) 
       ' Create a datset 
       Dim ds As DicomDataSet = New DicomDataSet() 
       ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, 
       DicomDataSetInitializeFlags.AddMandatoryElementsOnly Or DicomDataSetInitializeFlags.AddMandatoryModulesOnly) 
     
       ' Create an AnnRectangleObject 
       Dim annObject As AnnRectangleObject = New AnnRectangleObject() 
       annObject.Stroke = Color.FromArgb(&HFF, &H80, &H0, &H80) ' purple 
       annObject.StrokeThickness = 5 
     
       annObject.Fill = Color.FromArgb(&HFF, &HFF, &HFF, &HFF) ' white 
       annObject.Rect = New Rect(400, 100, 500, 200) 
     
       ' Save in the dataset as DICOM annotation 
       Dim element As DicomElement = ds.FindFirstElement(Nothing, DicomTag.GraphicAnnotationSequence, True) 
       If Nothing Is element Then 
          element = ds.InsertElement(Nothing, False, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, True, 0) 
       End If 
     
       Dim itemElement As DicomElement = ds.GetChildElement(element, True) 
       If Nothing Is itemElement Then 
          ' Add Item Node 
          itemElement = ds.InsertElement(element, True, DicomTag.Item, DicomVRType.CS, True, -1) 
          If Nothing Is itemElement Then 
             Return 
          End If 
     
          ds.InsertElement(itemElement, True, DicomTag.TextObjectSequence, DicomVRType.SQ, True, -1) 
          ds.InsertElement(itemElement, True, DicomTag.GraphicObjectSequence, DicomVRType.SQ, True, -1) 
          ds.InsertElement(itemElement, True, DicomTag.ReferencedImageSequence, DicomVRType.SQ, True, -1) 
          ds.InsertElement(itemElement, True, DicomTag.GraphicLayer, DicomVRType.CS, False, -1) 
          If Not Nothing Is element Then 
             ds.SetStringValue(element, "LEAD OBJECTS LAYER", DicomCharacterSetType.Default) 
          End If 
     
          ' Add graphic layer 
          Dim GraphicLayer As DicomGraphicLayer = New DicomGraphicLayer() 
     
          GraphicLayer.LayerOrder = 1 
          GraphicLayer.RgbLayerColor = 0 ' null 
          GraphicLayer.LayerDescription = "Layer for LEAD objects" 
          GraphicLayer.LayerName = "LEAD OBJECTS LAYER" 
          GraphicLayer.Grayscale = 65535 
          Dim index As Integer = ds.CreateLayer(GraphicLayer) 
       End If 
     
       Dim du As DicomAnnotationsUtilities = New DicomAnnotationsUtilities() 
       du.FromAnnObjectToDataSet(ds, annObject, itemElement) 
       ds.Save(outputStream, DicomDataSetSaveFlags.None) 
    End Sub 
Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.