Leadtools.Dicom Requires Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
VoiLutCount Property
See Also  Example
Leadtools.Dicom Namespace > DicomDataSet Class : VoiLutCount Property




Gets the number of items under the VOI LUT Sequence (0028,3010).

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property VoiLutCount As Integer
Visual Basic (Usage)Copy Code
Dim instance As DicomDataSet
Dim value As Integer
 
value = instance.VoiLutCount
C# 
public int VoiLutCount {get;}
Managed Extensions for C++ 
public: __property int get_VoiLutCount();
C++/CLI 
public:
property int VoiLutCount {
   int get();
}

Return Value

The number of items under the VOI LUT Sequence.

Example

This example will load a DICOM dataset, update its VOI LUT and then verify that it was updated properly.

Visual BasicCopy Code
Public Sub TestVoiLut()
  Dim dicomFileName As String = "C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 14.5\Images\IMAGE3.dic"
  '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)
       Dim VoiLutSize As Integer = 65536

       'Load DICOM File
       ds.Load(dicomFileName, DicomDataSetLoadFlags.None)
       ds.DeleteVoiLut()

       Dim VoiLutAttributes As DicomVoiLutAttributes = New DicomVoiLutAttributes()
       VoiLutAttributes.FirstStoredPixelValueMapped = 0
       VoiLutAttributes.EntryBits = 16
       VoiLutAttributes.NumberOfEntries = VoiLutSize

       Dim LutData As Integer() = New Integer(VoiLutSize - 1) {}
       Dim i As Integer = 0
       Do While i < VoiLutSize
          LutData(i) = i
          i += 1
       Loop
       ds.SetVoiLut(0, VoiLutAttributes, LutData)

       Dim attributes As DicomVoiLutAttributes = ds.GetVoiLut(0)
       If Not attributes Is Nothing Then
          Debug.Assert(attributes.FirstStoredPixelValueMapped = 0)
          Debug.Assert(attributes.EntryBits = 16)
          Debug.Assert(attributes.NumberOfEntries = VoiLutSize)

          Dim data As Integer() = ds.GetVoiLutData(0)
          ' Do something with the data
       End If
       ds.Save("C:\VOILut.dic", DicomDataSetSaveFlags.None)

    End Using

    DicomEngine.Shutdown()
 End Sub
C#Copy Code
public void TestVoiLut() 

   string dicomFileName = @"C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 14.5\Images\IMAGE3.dic"; 
   //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()) 
   { 
      int VoiLutSize = 65536; 
 
      //Load DICOM File 
      ds.Load(dicomFileName, DicomDataSetLoadFlags.None); 
      ds.DeleteVoiLut(); 
 
      DicomVoiLutAttributes VoiLutAttributes = new DicomVoiLutAttributes(); 
      VoiLutAttributes.FirstStoredPixelValueMapped = 0; 
      VoiLutAttributes.EntryBits = 16; 
      VoiLutAttributes.NumberOfEntries = VoiLutSize; 
 
      int[] LutData = new int[VoiLutSize]; 
      for (int i = 0; i < VoiLutSize; i++) 
      { 
         LutData[i] = i; 
      } 
      ds.SetVoiLut(0, VoiLutAttributes, LutData); 
 
      DicomVoiLutAttributes attributes = ds.GetVoiLut(0); 
      if (attributes != null) 
      { 
         Debug.Assert(attributes.FirstStoredPixelValueMapped == 0); 
         Debug.Assert(attributes.EntryBits == 16); 
         Debug.Assert(attributes.NumberOfEntries == VoiLutSize); 
 
         int[] data = ds.GetVoiLutData(0); 
         // Do something with the data 
      } 
      ds.Save(@"C:\VOILut.dic", DicomDataSetSaveFlags.None); 
 
   } 
   DicomEngine.Shutdown(); 
}

Remarks

This property gets the number of items under the VOI LUT Sequence (0028,3010). If this Sequence does not exist in the Data Set, the property specifies 0.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Dicom requires a Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features