Gets or sets the defaults used when calling ToAnnObject.
public object DefaultObject { get; set; } Public Property DefaultObject As Object
Contains defaults that are usedwhen calling ToAnnObject.
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
This sample does the following:
using Leadtools;using Leadtools.Annotations;using Leadtools.Dicom;using Leadtools.Dicom.Annotations;public void DicomDataSet_FromAnnObjectToDataSet(string outfile){DicomEngine.Startup();// Create a datasetDicomDataSet ds = new DicomDataSet();ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryElementsOnly | DicomDataSetInitializeFlags.AddMandatoryModulesOnly);// Create an AnnRectangleObjectAnnRectangleObject 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 annotationDicomElement 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 NodeitemElement = 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 layerDicomGraphicLayer GraphicLayer = new DicomGraphicLayer();GraphicLayer.LayerOrder = 1;GraphicLayer.RgbLayerColor = 0; // nullGraphicLayer.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 LeadtoolsImports Leadtools.AnnotationsImports Leadtools.DicomImports Leadtools.Dicom.AnnotationsPublic Sub DicomDataSet_FromAnnObjectToDataSet(ByVal outfile As String)DicomEngine.Startup()' Create a datasetDim ds As New DicomDataSet()ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryElementsOnly Or DicomDataSetInitializeFlags.AddMandatoryModulesOnly)' Create an AnnRectangleObjectDim 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 annotationDim element As DicomElement = ds.FindFirstElement(Nothing, DicomTag.GraphicAnnotationSequence, True)If Nothing Is element Thenelement = ds.InsertElement(Nothing, False, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, True, 0)End IfDim itemElement As DicomElement = ds.GetChildElement(element, True)If Nothing Is itemElement Then' Add Item NodeitemElement = ds.InsertElement(element, True, DicomTag.Item, DicomVRType.CS, True, -1)If Nothing Is itemElement ThenReturnEnd Ifds.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 Thends.SetStringValue(element, "LEAD OBJECTS LAYER", DicomCharacterSetType.Default)End If' Add graphic layerDim GraphicLayer As New DicomGraphicLayer()GraphicLayer.LayerOrder = 1GraphicLayer.RgbLayerColor = 0 ' nullGraphicLayer.LayerDescription = "Layer for LEAD objects"GraphicLayer.LayerName = "LEAD OBJECTS LAYER"GraphicLayer.Grayscale = 65535Dim index As Integer = ds.CreateLayer(GraphicLayer)End IfDim 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 datsetDicomDataSet ds = new DicomDataSet();ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState, DicomDataSetInitializeFlags.AddMandatoryElementsOnly | DicomDataSetInitializeFlags.AddMandatoryModulesOnly);// Create an AnnRectangleObjectAnnRectangleObject annObject = new AnnRectangleObject();annObject.Stroke = Color.FromArgb(0xFF, 0x80, 0x00, 0x80); // purpleannObject.StrokeThickness = 5;annObject.Fill = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); // whiteannObject.Rect = new Rect(400, 100, 500, 200);// Save in the dataset as DICOM annotationDicomElement 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 NodeitemElement = 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 layerDicomGraphicLayer GraphicLayer = new DicomGraphicLayer();GraphicLayer.LayerOrder = 1;GraphicLayer.RgbLayerColor = 0; // nullGraphicLayer.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 LeadtoolsImports Leadtools.DicomImports Leadtools.Dicom.AnnotationsImports Leadtools.Windows.AnnotationsPublic Sub DicomDataSet_FromAnnObjectToDataSet(ByVal outputStream As Stream)' Create a datsetDim ds As DicomDataSet = New DicomDataSet()ds.Initialize(DicomClassType.GrayscaleSoftcopyPresentationState,DicomDataSetInitializeFlags.AddMandatoryElementsOnly Or DicomDataSetInitializeFlags.AddMandatoryModulesOnly)' Create an AnnRectangleObjectDim annObject As AnnRectangleObject = New AnnRectangleObject()annObject.Stroke = Color.FromArgb(&HFF, &H80, &H0, &H80) ' purpleannObject.StrokeThickness = 5annObject.Fill = Color.FromArgb(&HFF, &HFF, &HFF, &HFF) ' whiteannObject.Rect = New Rect(400, 100, 500, 200)' Save in the dataset as DICOM annotationDim element As DicomElement = ds.FindFirstElement(Nothing, DicomTag.GraphicAnnotationSequence, True)If Nothing Is element Thenelement = ds.InsertElement(Nothing, False, DicomTag.GraphicAnnotationSequence, DicomVRType.SQ, True, 0)End IfDim itemElement As DicomElement = ds.GetChildElement(element, True)If Nothing Is itemElement Then' Add Item NodeitemElement = ds.InsertElement(element, True, DicomTag.Item, DicomVRType.CS, True, -1)If Nothing Is itemElement ThenReturnEnd Ifds.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 Thends.SetStringValue(element, "LEAD OBJECTS LAYER", DicomCharacterSetType.Default)End If' Add graphic layerDim GraphicLayer As DicomGraphicLayer = New DicomGraphicLayer()GraphicLayer.LayerOrder = 1GraphicLayer.RgbLayerColor = 0 ' nullGraphicLayer.LayerDescription = "Layer for LEAD objects"GraphicLayer.LayerName = "LEAD OBJECTS LAYER"GraphicLayer.Grayscale = 65535Dim index As Integer = ds.CreateLayer(GraphicLayer)End IfDim du As DicomAnnotationsUtilities = New DicomAnnotationsUtilities()du.FromAnnObjectToDataSet(ds, annObject, itemElement)ds.Save(outputStream, DicomDataSetSaveFlags.None)End Sub
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
