DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImage Class / BitmapImage Method
Forces a re-render of the BitmapImage, discarding any cached data
Example

In This Topic
    BitmapImage Method
    In This Topic
    Image rendered as a System.Windows.Media.Imaging.BitmapImage object
    Syntax
    'Declaration
     
    
    Public Function BitmapImage( _
       ByVal ForceRender As System.Boolean _
    ) As System.Windows.Media.Imaging.BitmapImage
    public System.Windows.Media.Imaging.BitmapImage BitmapImage( 
       System.bool ForceRender
    )

    Parameters

    ForceRender
    Forces a re-render of the BitmapImage, discarding any cached data

    Return Value

    Returns a WPF control compatible BitmapImage object
    Example
    DicomImage image = new DicomImage(@"path_to_your_dicom_image.dcm");
    var bitmap = image.BitmapImage(false);
                        
    string outputPath = @"path_to_image.png";
    string format = "png";
    using (FileStream outputStream = new FileStream(outputPath, FileMode.Create))
    {
        // Save BitmapImage to a file
        // Use the custom BitmapImage extension method to save the Bitmap to the specified output stream in the desired format.
        BitmapImage_Extensions.Save(bitmap, outputStream, format);
    }
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also