排除库的原因,缩略图失败
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
4b9a277335
commit
274a8d2c21
|
|
@ -167,6 +167,9 @@ var app = builder.Build();
|
|||
//app.UseSwaggerUI();
|
||||
//}
|
||||
|
||||
//不需要 token 访问的静态文件 wwwroot css, JavaScript, and images don't require authentication.
|
||||
app.UseStaticFiles();
|
||||
|
||||
SwaggerSetup.Configure(app, app.Environment);
|
||||
|
||||
app.UseAuthorization();
|
||||
|
|
|
|||
|
|
@ -1,19 +1,22 @@
|
|||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Medallion.Threading;
|
||||
using FellowOakDicom;
|
||||
using FellowOakDicom;
|
||||
using FellowOakDicom.Imaging;
|
||||
using FellowOakDicom.Imaging.Codec;
|
||||
using System.Data;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using FellowOakDicom.Network;
|
||||
using IRaCIS.Core.SCP.Service;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using IRaCIS.Core.SCP.Service;
|
||||
using MassTransit;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
|
||||
namespace IRaCIS.Core.SCP.Service
|
||||
{
|
||||
|
|
@ -46,7 +49,53 @@ namespace IRaCIS.Core.SCP.Service
|
|||
_distributedLockProvider = distributedLockProvider;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> TestImage(string folderPath)
|
||||
{
|
||||
|
||||
if (!Directory.Exists(folderPath))
|
||||
return ResponseOutput.Ok("目录不存在");
|
||||
|
||||
// 获取所有 .dcm 文件
|
||||
var dicomFiles = Directory.GetFiles(folderPath);
|
||||
|
||||
foreach (var fileFullPath in dicomFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
public class AuToBindingStudyInfo
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue