Aspose.Imaging如何调整DICOM图像的对比度和亮度

作者:控件中国网   出处:控件中国网   2016-05-25 14:44:18   阅读:4

Aspose.Imaging是一款容易使用、具有高性能的图像、图片处理类库,提供最灵活的功能帮助开发人员创建、处理和保存图片。该控件支持大量的文件格式,无论是光栅图片还是矢量图片,控件还提供一系列压缩算法用于图像处理操作。利用该产品还可以转换图片为多种其他文件格式,绘制对象,对图片进行比例的控制,旋转,裁剪以及颜色处理。
 
在数字图像中,颜色调整是一个核心的功能,这篇文章主要介绍怎么利用Aspose.Imaging对DICOM图片进行亮度、对比度以及Gamma处理,具体可以参考下面的部分代码:
 
1.对图片进行亮度的调整
String inputFile = "1dicomEtalon.dicom";
String outputFile = "brightness.bmp";
//Load a DICOM image in an instance of DicomImage
com.Aspose.Imaging.fileformats.dicom.DicomImage image = new com.Aspose.Imaging.fileformats.dicom.DicomImage(inputFile);
//Adjust the brightness
image.adjustBrightness(50);
//Create an instance of BmpOptions for the resultant image and Save the resultant image
image.save(outputFile, new com.Aspose.Imaging.imageoptions.BmpOptions());
2.对图片进行对比度的调整
String inputFile = "1dicomEtalon.dicom";
String outputFile = "brightness.bmp";
 
//Load a DICOM image in an instance of DicomImage
com.Aspose.Imaging.fileformats.dicom.DicomImage image = new com.Aspose.Imaging.fileformats.dicom.DicomImage(inputFile);
        
//Adjust the contrast
image.adjustContrast(50);
 
//Create an instance of BmpOptions for the resultant image and Save the resultant image
image.save(outputFile, new com.Aspose.Imaging.imageoptions.BmpOptions());
3.对图片进行Gamma的调整
String inputFile = "1dicomEtalon.dicom";
String outputFile = "brightness.bmp";
 
//Load a DICOM image in an instance of DicomImage
com.Aspose.Imaging.fileformats.dicom.DicomImage image = new com.Aspose.Imaging.fileformats.dicom.DicomImage(inputFile);
 
//Adjust the gamma
image.adjustGamma(50);
//Create an instance of BmpOptions for the resultant image and Save the resultant image
image.save(outputFile, new com.Aspose.Imaging.imageoptions.BmpOptions());
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat