VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.ImageProcessing Namespace / ApplyDicomImageVoiLutCommand Class
Members Example



In This Topic
    ApplyDicomImageVoiLutCommand Class
    In This Topic
    Applies a VOI LUT (value of interest lookup table) to a DICOM image.
    Object Model
    ApplyDicomImageVoiLutCommand ClassDicomGroupedDataSetCollection ClassDicomGroupedDataSet ClassDicomImageModalityLookupTable ClassProcessingCommandResults ClassProcessingCommandResult ClassDicomImageVoiLookupTable Class
    Syntax
    'Declaration
     
    Public Class ApplyDicomImageVoiLutCommand 
       Inherits ProcessingCommandBase
    public class ApplyDicomImageVoiLutCommand : ProcessingCommandBase 
    public __gc class ApplyDicomImageVoiLutCommand : public ProcessingCommandBase 
    public ref class ApplyDicomImageVoiLutCommand : public ProcessingCommandBase 
    Example
    This example shows how to get raw DICOM image, apply VOI LUT to DICOM image, add overlays to DICOM image and save DICOM image as PNG file.
    ''' <summary>
    ''' Gets raw DICOM image, applies a VOI LUT to the DICOM image,
    ''' draws the overlay objects to the DICOM image, saves DICOM image to a PNG file.
    ''' </summary>
    ''' <param name="filePath">Path to DICOM file.</param>
    ''' <param name="pageIndex">Index of DICOM page.</param>
    Public Sub GetAndSaveDicomImageWithOverlaysAndAdjustImageWindow(filePath As String, pageIndex As Integer)
    	' open DICOM file
    	Using dicomFile As New Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(filePath)
    		' get DICOM page
    		Dim page As Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame = dicomFile.Pages(pageIndex)
                
                
    		' get raw DICOM image
                
    		' create settings for decoding DICOM image
    		Dim decodingSettings As New Vintasoft.Imaging.Codecs.Decoders.DicomDecodingSettings()
    		' specify that Modality LUT should not be applied to a DICOM image
    		decodingSettings.ApplyModalityLut = False
    		' specify that VOI LUT should not be applied to a DICOM image
    		decodingSettings.ApplyValueOfInterestLut = False
    		' specify that overlay objects should not be drawn on DICOM image
    		decodingSettings.ShowOverlayImages = False
    		' get raw DICOM image
    		Dim image As Vintasoft.Imaging.VintasoftImage = page.GetImage(decodingSettings, Nothing)
                
                
    		' apply VOI LUT to the DICOM image
                
    		Dim applyDicomImageVoiLutCommand As New Vintasoft.Imaging.ImageProcessing.ApplyDicomImageVoiLutCommand()
    		applyDicomImageVoiLutCommand.VoiLut = New Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomImageVoiLookupTable(128, 50)
    		applyDicomImageVoiLutCommand.ExecuteInPlace(image)
                
                
    		' draw overlay objects on DICOM image
                
    		Dim applyDicomOverlaysCommand As New Vintasoft.Imaging.ImageProcessing.ApplyDicomOverlaysCommand()
    		applyDicomOverlaysCommand.OverlayImages = page.OverlayImages
    		applyDicomOverlaysCommand.OverlayColor = New Vintasoft.Imaging.ImageColors.Rgb24Color(180, 180, 180)
    		applyDicomOverlaysCommand.ExecuteInPlace(image)
                
                
    		' save image to a PNG file
    		image.Save("E:\DicomImage.png")
    	End Using
    End Sub
    /// <summary>
    /// Gets raw DICOM image, applies a VOI LUT to the DICOM image,
    /// draws the overlay objects to the DICOM image, saves DICOM image to a PNG file.
    /// </summary>
    /// <param name="filePath">Path to DICOM file.</param>
    /// <param name="pageIndex">Index of DICOM page.</param>
    public void GetAndSaveDicomImageWithOverlaysAndAdjustImageWindow(string filePath, int pageIndex)
    {
        // open DICOM file
        using (Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile dicomFile =
            new Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(filePath))
        {
            // get DICOM page
            Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame page = dicomFile.Pages[pageIndex];
                
                
            // get raw DICOM image
                
            // create settings for decoding DICOM image
            Vintasoft.Imaging.Codecs.Decoders.DicomDecodingSettings decodingSettings =
                new Vintasoft.Imaging.Codecs.Decoders.DicomDecodingSettings();
            // specify that Modality LUT should not be applied to a DICOM image
            decodingSettings.ApplyModalityLut = false;
            // specify that VOI LUT should not be applied to a DICOM image
            decodingSettings.ApplyValueOfInterestLut = false;
            // specify that overlay objects should not be drawn on DICOM image
            decodingSettings.ShowOverlayImages = false;
            // get raw DICOM image
            Vintasoft.Imaging.VintasoftImage image = page.GetImage(decodingSettings, null);
                
                
            // apply VOI LUT to the DICOM image
                
            Vintasoft.Imaging.ImageProcessing.ApplyDicomImageVoiLutCommand applyDicomImageVoiLutCommand =
                new Vintasoft.Imaging.ImageProcessing.ApplyDicomImageVoiLutCommand();
            applyDicomImageVoiLutCommand.VoiLut = new Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomImageVoiLookupTable(128, 50);
            applyDicomImageVoiLutCommand.ExecuteInPlace(image);
                
                
            // draw overlay objects on DICOM image
                
            Vintasoft.Imaging.ImageProcessing.ApplyDicomOverlaysCommand applyDicomOverlaysCommand =
                new Vintasoft.Imaging.ImageProcessing.ApplyDicomOverlaysCommand();
            applyDicomOverlaysCommand.OverlayImages = page.OverlayImages;
            applyDicomOverlaysCommand.OverlayColor = new Vintasoft.Imaging.ImageColors.Rgb24Color(180, 180, 180);
            applyDicomOverlaysCommand.ExecuteInPlace(image);
                
                
            // save image to a PNG file
            image.Save(@"E:\DicomImage.png");
        }
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
          Vintasoft.Imaging.ImageProcessing.ApplyDicomImageVoiLutCommand

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also