DicomImage Constructor (Stream)
Initializes a new instance of the DicomImage class.

Namespace: Aspose.Imaging.FileFormats.Dicom
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
public DicomImage(
	Stream stream


Type: System.IOStream
The stream.
This example shows how to load a DICOM image from a file stream.

string dir = "c:\\temp\\";

// Load a DICOM image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.dicom"))
    using (Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = new Aspose.Imaging.FileFormats.Dicom.DicomImage(stream))
        // Save each page as an individual PNG image.                    
        foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage dicomPage in dicomImage.DicomPages)
            // Generate a file name based on the page index.
            string fileName = string.Format("sample.{0}.png", dicomPage.Index);

            // A DICOM page is a raster image, so all allowed operations with a raster image are applicable to a DICOM page.
            dicomPage.Save(dir + fileName, new Aspose.Imaging.ImageOptions.PngOptions());
See Also