Класс ApplyDicomOverlaysCommand
 
            
                В этом разделе
            
            Применяет наложения к изображению DICOM.
            
            
Объектная модель
Синтаксис
Пример
Вот C#/VB.NET код, который демонстрирует, как получить необработанное изображение DICOM, применить VOI LUT к изображению DICOM, добавить наложения к изображению DICOM и сохранить изображение DICOM в виде файла PNG.
    
	
	    
	    
''' <summary>
''' Returns 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 frame As Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame = DirectCast(dicomFile.Pages(pageIndex), Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame)
        ' 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
        Using image As Vintasoft.Imaging.VintasoftImage = frame.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 = frame.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 Using
End Sub
	     
	 
 
    
	
	    
	    
/// <summary>
/// Returns 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 frame =
            (Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame)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
        using (Vintasoft.Imaging.VintasoftImage image = frame.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 = frame.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");
        }
    }
}
	     
	 
 
 
Иерархия наследования
System.Object
   Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
      Vintasoft.Imaging.ImageProcessing.ApplyDicomOverlaysCommand
 
Требования
Целевые платформы: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
 
Смотрите также