VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.ImageProcessing Namespace / GetDefaultVoiLutCommand Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс GetDefaultVoiLutCommand
    В этом разделе
    Вычисляет VOI LUT по умолчанию из изображения DICOM.
    Объектная модель
    DicomImageVoiLookupTable ProcessingCommandResults GetDefaultVoiLutCommand
    Синтаксис
    'Declaration
    
    Public Class GetDefaultVoiLutCommand
       Inherits ProcessingCommandBase
    
    
    public class GetDefaultVoiLutCommand : ProcessingCommandBase
    
    
    public __gc class GetDefaultVoiLutCommand : public ProcessingCommandBase*
    
    
    public ref class GetDefaultVoiLutCommand : public ProcessingCommandBase^
    
    
    Пример

    Вот C#/VB.NET код, который демонстрирует, как получить необработанное изображение DICOM, вычислить VOI LUT с указанным режимом, применить вычисленный VOI LUT к изображению DICOM и сохранить изображение DICOM в файл изображения.

    
    ''' <summary>
    ''' Gets raw DICOM image, calculates VOI LUT with specified mode,
    ''' applies calculated VOI LUT to the DICOM image,
    ''' saves DICOM image to an image file.
    ''' </summary>
    ''' <param name="dicomFilePath">Path to a DICOM file.</param>
    ''' <param name="dicomVoiLutSearchMode">The DICOM VOI LUT search mode.</param>
    Public Shared Sub ConvertDicomFrameToJpegFile(dicomFilePath As String, dicomVoiLutSearchMode As Vintasoft.Imaging.ImageProcessing.VoiLutSearchMode)
        ' open DICOM file
        Using dicomFile As New Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(dicomFilePath)
            ' if DICM file does not have frames
            If dicomFile.Pages.Count = 0 Then
                ' exit
                Return
            End If
    
    
            ' get raw DICOM image
    
            ' create settings for decoding DICOM image
            Dim decodingSettings As New Vintasoft.Imaging.Codecs.Decoders.DicomDecodingSettings()
            ' specify that pixel format of DICOM image should not be changed
            decodingSettings.OutputPixelFormat = Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomImagePixelFormat.Source
            ' 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 image of first DICOM frame
            Using rawImage As Vintasoft.Imaging.VintasoftImage = dicomFile.Pages(0).GetImage(decodingSettings, Nothing)
                ' calculate VOI LUT for raw DICOM image
    
                Dim getDefaultVoiLutCommand As New Vintasoft.Imaging.ImageProcessing.GetDefaultVoiLutCommand()
                getDefaultVoiLutCommand.VoiLutSearchMode = dicomVoiLutSearchMode
                getDefaultVoiLutCommand.ExecuteInPlace(rawImage)
    
    
                ' apply VOI LUT to the DICOM image
    
                Dim applyVoiLutCommand As New Vintasoft.Imaging.ImageProcessing.ApplyDicomImageVoiLutCommand()
                applyVoiLutCommand.VoiLut = getDefaultVoiLutCommand.ResultVoiLut
                applyVoiLutCommand.ExecuteInPlace(rawImage)
    
    
                ' save DICOM image to JPEG file
                rawImage.Save("result.jpg")
            End Using
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Gets raw DICOM image, calculates VOI LUT with specified mode,
    /// applies calculated VOI LUT to the DICOM image,
    /// saves DICOM image to an image file.
    /// </summary>
    /// <param name="dicomFilePath">Path to a DICOM file.</param>
    /// <param name="dicomVoiLutSearchMode">The DICOM VOI LUT search mode.</param>
    public static void ConvertDicomFrameToJpegFile(
        string dicomFilePath,
        Vintasoft.Imaging.ImageProcessing.VoiLutSearchMode dicomVoiLutSearchMode)
    {
        // open DICOM file
        using (Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile dicomFile =
            new Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(dicomFilePath))
        {
            // if DICM file does not have frames
            if (dicomFile.Pages.Count == 0)
                // exit
                return;
    
    
            // get raw DICOM image
    
            // create settings for decoding DICOM image
            Vintasoft.Imaging.Codecs.Decoders.DicomDecodingSettings decodingSettings =
                new Vintasoft.Imaging.Codecs.Decoders.DicomDecodingSettings();
            // specify that pixel format of DICOM image should not be changed
            decodingSettings.OutputPixelFormat = Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomImagePixelFormat.Source;
            // 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 image of first DICOM frame
            using (Vintasoft.Imaging.VintasoftImage rawImage = dicomFile.Pages[0].GetImage(decodingSettings, null))
            {
                // calculate VOI LUT for raw DICOM image
    
                Vintasoft.Imaging.ImageProcessing.GetDefaultVoiLutCommand getDefaultVoiLutCommand =
                    new Vintasoft.Imaging.ImageProcessing.GetDefaultVoiLutCommand();
                getDefaultVoiLutCommand.VoiLutSearchMode = dicomVoiLutSearchMode;
                getDefaultVoiLutCommand.ExecuteInPlace(rawImage);
    
    
                // apply VOI LUT to the DICOM image
    
                Vintasoft.Imaging.ImageProcessing.ApplyDicomImageVoiLutCommand applyVoiLutCommand =
                    new Vintasoft.Imaging.ImageProcessing.ApplyDicomImageVoiLutCommand();
                applyVoiLutCommand.VoiLut = getDefaultVoiLutCommand.ResultVoiLut;
                applyVoiLutCommand.ExecuteInPlace(rawImage);
    
    
                // save DICOM image to JPEG file
                rawImage.Save("result.jpg");
            }
        }
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
          Vintasoft.Imaging.ImageProcessing.GetDefaultVoiLutCommand

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также