所需jar包: dcm4che-core-3.3.8.jar dcm4che-image-3.3.8.jar dcm4che-imageio-3.3.8.jar dcm4che-tool-dcm2jpg-3.3.8.jar ij.jar
/** * 输入一个dicom文件的绝对路径和名字 * 获取一个jpg文件 */ public static void uploadByObs(String filePath,String fileName) { try { DICOM dicom = new DICOM(); dicom.run(filePath); BufferedImage bi = (BufferedImage) dicom.getImage(); ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流 ImageIO.write(bi, "jpg", baos);//写入流中 byte[] bytes = baos.toByteArray();//转换成字节 BASE64Encoder encoder = new BASE64Encoder(); String png_base64 = encoder.encodeBuffer(bytes).trim();//转换成base64串 png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n Qiuyun.put64image(png_base64,fileName + ".jpg"); } catch (Exception e) { S
解析dcm文件生成jpg上传七牛云,及按比例的缩略图
最新推荐文章于 2023-08-03 17:46:24 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)