LEADTOOLS Medical (Leadtools.Dicom assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
GetModalityLutAttributes() Method
See Also 
Leadtools.Dicom Namespace > DicomDataSet Class > GetModalityLutAttributes Method : GetModalityLutAttributes() Method



Retrieves the attributes that describe the Modality LUT. Supported in Silverlight, Windows Phone 7.

Syntax

Visual Basic (Declaration) 
Overloads Public Function GetModalityLutAttributes() As DicomModalityLutAttributes
Visual Basic (Usage)Copy Code
Dim instance As DicomDataSet
Dim value As DicomModalityLutAttributes
 
value = instance.GetModalityLutAttributes()
C# 
public DicomModalityLutAttributes GetModalityLutAttributes()
C++/CLI 
public:
DicomModalityLutAttributes^ GetModalityLutAttributes(); 

Return Value

Modality LUT attributes.

Example

This example will extract the modality LUT information from a DICOM dataset.

Visual BasicCopy Code
Public Sub TestGetModalityLutAttributes()
   Dim dicomFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "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
C#Copy Code
public void TestGetModalityLutAttributes()
{
   string dicomFileName = LeadtoolsExamples.Common.ImagesPath.Path + "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();
}
SilverlightCSharpCopy Code
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();
}
SilverlightVBCopy Code
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

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.

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also

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