public DicomElement GetLayerElementByName(
string layerName
)
public:
DicomElement^ GetLayerElementByName(
String^ layerName
)
layerName
Name of the graphic layer whose item element is to be retrieved.
The item element of the specified graphic layer.
This method gets the item element under the "Graphic Layer Sequence" (0070,0060), which corresponds, to the layer with the specified name.
using Leadtools;
using Leadtools.Dicom;
public void DicomLayerSample()
{
//Make sure to initialize the DICOM engine, this needs to be done only once
//In the whole application
DicomEngine.Startup();
using (DicomDataSet dicomDataset = new DicomDataSet())
{
// We can also initialize in here the "Grayscale Softcopy Presentation State" class
dicomDataset.Initialize(DicomClassType.Undefined, DicomDataSetInitializeType.ExplicitVRLittleEndian);
//We can remove individual layers by calling RemoveLayerByIndex and RemoveLayerByName
dicomDataset.RemoveAllLayers(true);
DicomGraphicLayer graphicLayer = new DicomGraphicLayer();
graphicLayer.LayerOrder = 1;
graphicLayer.LayerDescription = "First Layer";
graphicLayer.LayerName = "LAYER0";
graphicLayer.Grayscale = 0;
graphicLayer.RgbLayerColor[0] = 255;
dicomDataset.CreateLayer(graphicLayer);
Debug.Assert(dicomDataset.GetLayerIndex("LAYER0") == 0);
DicomGraphicLayer graphicLayer1 = dicomDataset.GetLayerInformation(0);
Debug.Assert(graphicLayer1 != null);
Debug.Assert(graphicLayer1.LayerOrder == 1);
graphicLayer.LayerName = "LAYER1";
dicomDataset.SetLayerInformation(0, graphicLayer);
Debug.Assert(dicomDataset.LayerCount == 1);
// We can also call GetLayerElementByName to get the layer element
DicomElement layer = dicomDataset.GetLayerElementByIndex(0);
Debug.Assert(layer != null);
dicomDataset.RemoveLayerGraphicObjects(layer);
Debug.Assert(dicomDataset.GetLayerGraphicObjectCount(layer) == 0);
dicomDataset.RemoveLayerTextObjects(layer);
Debug.Assert(dicomDataset.GetLayerTextObjectCount(layer) == 0);
dicomDataset.Save(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "PresentationState.dcm"), DicomDataSetSaveFlags.None);
}
DicomEngine.Shutdown();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
GetLayerGraphicObjectCount Method
RemoveLayerGraphicObjects Method
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
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.