DicomImage
Contents
[
Hide
]
DicomImage constructor (1 of 3)
Initializes a new instance of the DicomImage
class.
public DicomImage(DicomOptions dicomOptions, int width, int height)
Parameter | Type | Description |
---|---|---|
dicomOptions | DicomOptions | The dicom options. |
width | Int32 | The width. |
height | Int32 | The height. |
See Also
- class DicomOptions
- class DicomImage
- namespace Aspose.Imaging.FileFormats.Dicom
- assembly Aspose.Imaging
DicomImage constructor (2 of 3)
Initializes a new instance of the DicomImage
class.
public DicomImage(Stream stream, LoadOptions loadOptions)
Parameter | Type | Description |
---|---|---|
stream | Stream | The stream. |
loadOptions | LoadOptions | The load options. |
Examples
This example shows how to load a DICOM image from a file stream to stay within the specified memory limit.
[C#]
string dir = "c:\\temp\\";
// Load a DICOM image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "multiframe.dicom"))
{
// The max allowed size for all internal buffers is 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))
{
// 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("multiframe.{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
- class LoadOptions
- class DicomImage
- namespace Aspose.Imaging.FileFormats.Dicom
- assembly Aspose.Imaging
DicomImage constructor (3 of 3)
Initializes a new instance of the DicomImage
class.
public DicomImage(Stream stream)
Parameter | Type | Description |
---|---|---|
stream | Stream | The stream. |
Examples
This example shows how to load a DICOM image from a file stream.
[C#]
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
- class DicomImage
- namespace Aspose.Imaging.FileFormats.Dicom
- assembly Aspose.Imaging