解决合并的冲突
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a13807ae5f
commit
40d035e7a7
|
@ -210,62 +210,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 后端处理某个中心缩略图有问题 先下载,生成缩略图上传,然后更新数据库
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<IResponseOutput> BackImageResize(Guid trialSiteId ,Guid subjectId/* , [FromServices] IRepository<>*/)
|
|
||||||
{
|
|
||||||
///${params.trialId}/ Image /${params.subjectId}/${params.subjectVisitId}/${ dicomInfo.studyUid}/${ v.seriesUid}.jpg
|
|
||||||
|
|
||||||
var dealSeriesList = await _dicomSeriesRepository.Where(t => t.DicomStudy.Subject.TrialSiteId == trialSiteId && t.SubjectId== subjectId).Select(t => new { t.Id, t.SubjectId, t.TrialId, t.SubjectVisitId, t.StudyInstanceUid, t.SeriesInstanceUid, t.ImageResizePath, t.UpdateUserId, FirstInstancePath = t.DicomInstanceList.First().Path }).ToListAsync();
|
|
||||||
|
|
||||||
//下载到本地
|
|
||||||
string tempFolderPath = Path.Combine(Directory.GetCurrentDirectory(), $"DownloadTemp_{NewId.NextGuid()}");
|
|
||||||
Directory.CreateDirectory(tempFolderPath);
|
|
||||||
|
|
||||||
foreach (var dealSeries in dealSeriesList)
|
|
||||||
{
|
|
||||||
var fileName = Path.GetFileNameWithoutExtension(dealSeries.FirstInstancePath);
|
|
||||||
|
|
||||||
var localFilePath = Path.Combine(tempFolderPath, fileName);
|
|
||||||
|
|
||||||
await _IOSSService.DownLoadFromOSSAsync(dealSeries.FirstInstancePath, localFilePath);
|
|
||||||
|
|
||||||
|
|
||||||
var resizePath = localFilePath + "_New.jpg";
|
|
||||||
|
|
||||||
//生成缩略图
|
|
||||||
|
|
||||||
// 读取 DICOM 文件
|
|
||||||
var dicomImage = new DicomImage(localFilePath);
|
|
||||||
|
|
||||||
|
|
||||||
// 渲染 DICOM 图像到 ImageSharp 格式
|
|
||||||
using (var image = dicomImage.RenderImage().AsSharpImage())
|
|
||||||
{
|
|
||||||
// 生成缩略图(调整大小)
|
|
||||||
image.Mutate(x => x.Resize(500, 500));
|
|
||||||
|
|
||||||
// 保存缩略图为 JPEG
|
|
||||||
image.Save(resizePath, new JpegEncoder());
|
|
||||||
}
|
|
||||||
|
|
||||||
var ossFolder = $"{dealSeries.TrialId}/Image/{dealSeries.SubjectId}/{dealSeries.SubjectVisitId}/{dealSeries.StudyInstanceUid}";
|
|
||||||
|
|
||||||
var relativePath = await _IOSSService.UploadToOSSAsync(resizePath, ossFolder, false);
|
|
||||||
|
|
||||||
await _dicomSeriesRepository.BatchUpdateNoTrackingAsync(t => t.Id == dealSeries.Id, u => new DicomSeries() { ImageResizePath = relativePath, UpdateUserId = dealSeries.UpdateUserId });
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 后端处理某个中心缩略图有问题 先下载,生成缩略图上传,然后更新数据库
|
/// 后端处理某个中心缩略图有问题 先下载,生成缩略图上传,然后更新数据库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue