LEADTOOLS Medical (Leadtools.Dicom assembly)

GetModalityLutAttributes() Method

Show in webframe
Example 







Retrieves the attributes that describe the Modality LUT.
Syntax
public DicomModalityLutAttributes GetModalityLutAttributes()
'Declaration
 
Public Overloads Function GetModalityLutAttributes() As DicomModalityLutAttributes
'Usage
 
Dim instance As DicomDataSet
Dim value As DicomModalityLutAttributes
 
value = instance.GetModalityLutAttributes()
public DicomModalityLutAttributes GetModalityLutAttributes()

            
public DicomModalityLutAttributes getModalityLutAttributes()
 function Leadtools.Dicom.DicomDataSet.GetModalityLutAttributes()()
public:
DicomModalityLutAttributes^ GetModalityLutAttributes(); 

Return Value

Modality LUT attributes.
Remarks
If the method does not find any of the attributes of the "Modality LUT Module" it will set both IsModalityLutSequence and IsRescaleSlopeIntercept to false. In this case, the rest of the members of the DicomModalityLutAttributes class are undefined.

If the method finds the "Rescale Intercept" (0028,1052) and "Rescale Slope" (0028,1053) elements, it will set IsRescaleSlopeIntercept to true and populate RescaleIntercept, DicomModalityLutAttributes.RescaleSlope, and RescaleType with the values retrieved from the DICOM Data Set.

If the method finds "Modality LUT Sequence" (0028,3000), it will set IsModalityLutSequence to true and populate FirstStoredPixelValueMapped, NumberOfEntries, EntryBits, LutExplanation, and LutType with the values retrieved from the DICOM Data Set.

It is prohibited by the DICOM standard for both "Rescale Intercept" and "Modality LUT Sequence" to exist in the same DICOM Data Set. However, if this method encounters such a Data Set, it will ignore "Modality LUT Sequence" and assume that only "Rescale Intercept" exists.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Dicom

Public Sub TestGetModalityLutAttributes()
   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)
      'Load DICOM File
      ds.Load(dicomFileName, DicomDataSetLoadFlags.None)
      Dim modalityLutAttributes As DicomModalityLutAttributes = ds.GetModalityLutAttributes()
      If Not modalityLutAttributes Is Nothing AndAlso modalityLutAttributes.IsModalityLutSequence Then
         Dim ModalityLutData As Integer() = ds.GetModalityLutData()
      End If
   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 TestGetModalityLutAttributes()
{
   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())
   {
      //Load DICOM File
      ds.Load(dicomFileName, DicomDataSetLoadFlags.None);
      DicomModalityLutAttributes modalityLutAttributes = ds.GetModalityLutAttributes();
      if (modalityLutAttributes != null && modalityLutAttributes.IsModalityLutSequence)
      {
         int[] ModalityLutData = ds.GetModalityLutData();
      }
   }
   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 TestGetModalityLutAttributes()
{
   //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())
   {
      //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);
      DicomModalityLutAttributes modalityLutAttributes = ds.GetModalityLutAttributes();
      if (modalityLutAttributes != null && modalityLutAttributes.IsModalityLutSequence)
      {
         int[] ModalityLutData = ds.GetModalityLutData();
      }
   }
   DicomEngine.Shutdown();
}
using Leadtools;
using Leadtools.Dicom;
using Leadtools.Examples;

public void TestGetModalityLutAttributes(Stream dicomStream)
{
   //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())
   {
      //Load DICOM File
      ds.Load(dicomStream, DicomDataSetLoadFlags.None);
      DicomModalityLutAttributes modalityLutAttributes = ds.GetModalityLutAttributes();
      if (modalityLutAttributes != null && modalityLutAttributes.IsModalityLutSequence)
      {
         int[] ModalityLutData = ds.GetModalityLutData();
      }
   }
   DicomEngine.Shutdown();
}
Imports Leadtools
Imports Leadtools.Dicom

Public Sub TestGetModalityLutAttributes(ByVal dicomStream 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()
      'Load DICOM File
      ds.Load(dicomStream, DicomDataSetLoadFlags.None)
      Dim modalityLutAttributes As DicomModalityLutAttributes = ds.GetModalityLutAttributes()
      If Not modalityLutAttributes Is Nothing AndAlso modalityLutAttributes.IsModalityLutSequence Then
         Dim ModalityLutData As Integer() = ds.GetModalityLutData()
      End If
   End Using
   DicomEngine.Shutdown()
End Sub
Requirements

Target Platforms

See Also

Reference

DicomDataSet Class
DicomDataSet Members
Overload List
GetModalityLutData Method
SetModalityLut(DicomModalityLutAttributes,Int32[]) Method
DeleteModalityLut 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