LEADTOOLS Medical (Leadtools.Dicom assembly)

VoiLutCount Property

Show in webframe
Example 







Gets the number of items under the VOI LUT Sequence (0028,3010).
Syntax
public int VoiLutCount {get;}
'Declaration
 
Public ReadOnly Property VoiLutCount As Integer
'Usage
 
Dim instance As DicomDataSet
Dim value As Integer
 
value = instance.VoiLutCount
public int VoiLutCount {get;}

            

            
 get_VoiLutCount(); 
public:
property int VoiLutCount {
   int get();
}

Property Value

The number of items under the VOI LUT Sequence.
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.
Example
Copy Code  
Imports Leadtools
Imports Leadtools.Dicom

Public Sub TestVoiLut()
   Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm")
   '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(Path.Combine(LEAD_VARS.ImagesDir, "VOILut.dcm"), DicomDataSetSaveFlags.None)

   End Using

   DicomEngine.Shutdown()
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Dicom;

public void TestVoiLut()
{
   string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm");
   //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(Path.Combine(LEAD_VARS.ImagesDir, "VOILut.dcm"), DicomDataSetSaveFlags.None);

   }
   DicomEngine.Shutdown();
}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
using Leadtools.Dicom.Constants;
using Leadtools;
using Leadtools.Dicom;

      
public async Task TestVoiLut()
{
   //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
      string filePath = @"Assets\IMAGE3.dcm";
      StorageFile file = await Tools.AppInstallFolder.GetFileAsync(filePath);
      ILeadStream stream = LeadStreamFactory.Create(file);
      bool success = await ds.LoadAsync(stream, DicomDataSetLoadFlags.None);
      Debug.Assert(success); 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
      }
      string dicomFileNameOutput = "VOILut.dcm";
      StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(dicomFileNameOutput);
      ILeadStream streamOutput = LeadStreamFactory.Create(saveFile);
      using (IDisposable disposableOUT = streamOutput as IDisposable)
      {
         await ds.SaveAsync(streamOutput, DicomDataSetSaveFlags.None);
      }
   }
   DicomEngine.Shutdown();
}
using Leadtools;
using Leadtools.Dicom;
using Leadtools.Examples;

public void TestVoiLut(Stream dicomStream, Stream outputStream)
{
   //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(dicomStream, 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(outputStream, DicomDataSetSaveFlags.None);

   }
   DicomEngine.Shutdown();
}
Imports Leadtools
Imports Leadtools.Dicom

Public Sub TestVoiLut(ByVal dicomStream As Stream, ByVal outputStream As Stream)
   'Make sure to initialize the DICOM engine, this needs to be done only once 
   'In the whole application
   DicomEngine.Startup()
   Using ds As DicomDataSet = New DicomDataSet()
      Dim VoiLutSize As Integer = 65536
      'Load DICOM File
      ds.Load(dicomStream, 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(outputStream, DicomDataSetSaveFlags.None)

   End Using
   DicomEngine.Shutdown()
End Sub
Requirements

Target Platforms

See Also

Reference

DicomDataSet Class
DicomDataSet Members
GetWindowCount Method
GetWindow(Int32) Method
SetWindow(Int32,DicomWindowAttributes) Method
DeleteWindow Method
GetVoiLut Method
SetVoiLut Method
GetVoiLutData Method
DeleteVoiLut Method

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

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