Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Load DICOM file
using (var fileStream = new FileStream("DICOM.DCM", FileMode.Open, FileAccess.Read))
using (DicomImage image = new DicomImage(fileStream))
{
// Set the active page to be converted to JPEG
image.ActivePage = (DicomPage)image.Pages[95];
// Save as BMP
image.Save("DICOM to BMP.bmp", new BmpOptions());
}
// Load DICOM file
using (var fileStream = new FileStream("DICOM.DCM", FileMode.Open, FileAccess.Read))
using (DicomImage image = new DicomImage(fileStream))
{
// Save as GIF
image.Save("DICOM to GIF.gif", new GifOptions());
}
// Load DICOM file
using (var fileStream = new FileStream("DICOM.DCM", FileMode.Open, FileAccess.Read))
using (DicomImage image = new DicomImage(fileStream))
{
// Set the active page to be converted to JPEG
image.ActivePage = (DicomPage) image.Pages[95];
// Save as JPEG
image.Save("DICOM to JPEG.jpg", new JpegOptions());
}
// Load DICOM file
using (var fileStream = new FileStream("DICOM.DCM", FileMode.Open, FileAccess.Read))
using (DicomImage image = new DicomImage(fileStream))
{
// Set the active page to be converted to JPEG
image.ActivePage = (DicomPage)image.Pages[95];
// Save as PNG
image.Save("DICOM to PNG.png", new PngOptions());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment