From 4d8b43f8df20810135d51bbc99141f1d830c493b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Sun, 4 Jan 2026 16:23:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E6=94=B6=E6=96=87?= =?UTF-8?q?=E4=BB=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/Service/CStoreSCPService.cs | 2 +- IRaCIS.Core.Application/TestService.cs | 27 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/IRC.Core.SCP/Service/CStoreSCPService.cs b/IRC.Core.SCP/Service/CStoreSCPService.cs index ce84949a6..6390fc803 100644 --- a/IRC.Core.SCP/Service/CStoreSCPService.cs +++ b/IRC.Core.SCP/Service/CStoreSCPService.cs @@ -728,7 +728,7 @@ namespace IRaCIS.Core.SCP.Service // 上传缩略图到 OSS - var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, seriesId.ToString() + ".preview.jpg", false); + var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, $"{seriesId.ToString()}_{instanceId.ToString()}.preview.jpg", false); Console.WriteLine(seriesPath + " Id: " + seriesId); diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 9c061d9cb..87f938d98 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -1,4 +1,5 @@ using Aliyun.OSS; +using DocumentFormat.OpenXml.Bibliography; using FellowOakDicom; using FellowOakDicom.Imaging; using IRaCIS.Application.Contracts; @@ -27,6 +28,7 @@ using Microsoft.Extensions.Options; using MiniExcelLibs; using NPOI.SS.Formula.Functions; using NPOI.XWPF.UserModel; +using SixLabors.ImageSharp.Formats.Jpeg; using System.Globalization; using System.Runtime.InteropServices; using System.Text; @@ -57,6 +59,31 @@ namespace IRaCIS.Core.Application.Service public static int IntValue = 100; + public async Task TestImage(string fileFullPath) + { + var file = await DicomFile.OpenAsync(fileFullPath); + // 生成缩略图 + using (var memoryStream = new MemoryStream()) + { + DicomImage image = new DicomImage(file.Dataset); + + var sharpimage = image.RenderImage().AsSharpImage(); + sharpimage.Save(memoryStream, new JpegEncoder()); + + + // 关键点:一定要回到开头 + memoryStream.Position = 0; + + using (var fileStream = File.Create($"{fileFullPath}.jpg")) + { + await memoryStream.CopyToAsync(fileStream); + } + + } + + return ResponseOutput.Ok(); + } + /// /// 维护dir 需求新增的字段