DicomImage

DicomImage(DicomOptions, int, int)

初始化DicomImage类.

public DicomImage(DicomOptions dicomOptions, int width, int height)
范围类型描述
dicomOptionsDicomOptionsdicom 选项。
widthInt32宽度。
heightInt32高度。

也可以看看


DicomImage(Stream, LoadOptions)

初始化DicomImage类.

public DicomImage(Stream stream, LoadOptions loadOptions)
范围类型描述
streamStream流。
loadOptionsLoadOptions负载选项。

例子

此示例说明如何从文件流加载 DICOM 图像以保持在指定的内存限制内。

[C#]

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

// 从文件流中加载 DICOM 图像。
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "multiframe.dicom"))
{
    // 所有内部缓冲区的最大允许大小为 256KB。
    Aspose.Imaging.LoadOptions loadOptions = new Aspose.Imaging.LoadOptions();
    loadOptions.BufferSizeHint = 256 * 1024;

    using (Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = new Aspose.Imaging.FileFormats.Dicom.DicomImage(stream, loadOptions))
    {
        // 将每个页面保存为单独的 PNG 图像。
        foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage dicomPage in dicomImage.DicomPages)
        {
            // 根据页面索引生成文件名。
            string fileName = string.Format("multiframe.{0}.png", dicomPage.Index);

            // DICOM 页面是光栅图像,因此所有允许的光栅图像操作都适用于 DICOM 页面。
            dicomPage.Save(dir + fileName, new Aspose.Imaging.ImageOptions.PngOptions());
        }
    }
}

也可以看看


DicomImage(Stream)

初始化DicomImage类.

public DicomImage(Stream stream)
范围类型描述
streamStream流。

例子

此示例显示如何从文件流加载 DICOM 图像。

[C#]

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

// 从文件流中加载 DICOM 图像。
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))
    {
        // 将每个页面保存为单独的 PNG 图像。                    
        foreach (Aspose.Imaging.FileFormats.Dicom.DicomPage dicomPage in dicomImage.DicomPages)
        {
            // 根据页面索引生成文件名。
            string fileName = string.Format("sample.{0}.png", dicomPage.Index);

            // DICOM 页面是光栅图像,因此所有允许的光栅图像操作都适用于 DICOM 页面。
            dicomPage.Save(dir + fileName, new Aspose.Imaging.ImageOptions.PngOptions());
        }
    }
}

也可以看看