←Select platform

GetLayerInformation Method

Summary
Retrieves the attributes of a layer at the specified index.
Syntax
C#
C++/CLI
public DicomGraphicLayer GetLayerInformation( 
   int layerIndex 
) 
public: 
DicomGraphicLayer^ GetLayerInformation(  
   int layerIndex 
)  

Parameters

layerIndex
The zero-based index of the layer whose attributes are required.

Return Value

The layer attributes.

Remarks

The members of the DicomGraphicLayer are based on the "Graphic Layer Module Attributes" in the DICOM standard. The index specified by layerIndex is based on the number of items under the "Graphic Layer Sequence" (0070,0060); for example, the index of the first item is zero.

Example
C#
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:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.8.20
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.