返回写入流的进度消息
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d78a42dead
commit
d2e3e4de86
|
|
@ -1,5 +1,8 @@
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using ExcelDataReader;
|
using ExcelDataReader;
|
||||||
|
using FellowOakDicom;
|
||||||
|
using FellowOakDicom.Imaging;
|
||||||
|
using FellowOakDicom.IO.Buffer;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Application.Interfaces;
|
using IRaCIS.Application.Interfaces;
|
||||||
using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson;
|
using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson;
|
||||||
|
|
@ -901,7 +904,12 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
var downloadInfo = (SubejctVisitDownload)rusult.OtherData;
|
var downloadInfo = (SubejctVisitDownload)rusult.OtherData;
|
||||||
|
|
||||||
|
|
||||||
|
long receivedsize = 0;
|
||||||
|
long receivedCount = 0;
|
||||||
|
|
||||||
long totalSize = downloadInfo.ImageSize;
|
long totalSize = downloadInfo.ImageSize;
|
||||||
|
long toTalCount = downloadInfo.ImageCount;
|
||||||
|
|
||||||
var abortToken = HttpContext.RequestAborted;
|
var abortToken = HttpContext.RequestAborted;
|
||||||
var lastNotify = DateTime.UtcNow;
|
var lastNotify = DateTime.UtcNow;
|
||||||
|
|
||||||
|
|
@ -939,6 +947,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
{
|
{
|
||||||
foreach (var instance in series.InstanceList)
|
foreach (var instance in series.InstanceList)
|
||||||
{
|
{
|
||||||
|
//当前完成大小
|
||||||
|
receivedsize = receivedsize + instance.FileSize ?? 0;
|
||||||
|
receivedCount++;
|
||||||
|
|
||||||
abortToken.ThrowIfCancellationRequested();
|
abortToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
var entryPath =
|
var entryPath =
|
||||||
|
|
@ -949,10 +961,44 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
await using var entryStream = entry.Open();
|
await using var entryStream = entry.Open();
|
||||||
await using var source = await _oSSService.GetStreamFromOSSAsync(instance.Path);
|
await using var source = await _oSSService.GetStreamFromOSSAsync(instance.Path);
|
||||||
|
|
||||||
await source.CopyToAsync(entryStream, 32 * 1024, abortToken);
|
#region 将多帧合并为一帧
|
||||||
|
|
||||||
|
// 如果你是从 stream 打开
|
||||||
|
var dicomFile = await DicomFile.OpenAsync(source);
|
||||||
|
|
||||||
|
// 获取 Pixel Data 标签
|
||||||
|
var pixelData = DicomPixelData.Create(dicomFile.Dataset);
|
||||||
|
//获取像素是否为封装形式
|
||||||
|
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
||||||
|
|
||||||
|
//对于封装像素的文件做转换
|
||||||
|
if (syntax.IsEncapsulated)
|
||||||
|
{
|
||||||
|
// 创建一个新的片段序列
|
||||||
|
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
||||||
|
// 获取每帧数据并封装为单独的片段
|
||||||
|
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
||||||
|
{
|
||||||
|
var frameData = pixelData.GetFrame(n);
|
||||||
|
newFragments.Fragments.Add(new MemoryByteBuffer(frameData.Data));
|
||||||
|
}
|
||||||
|
// 替换原有的片段序列
|
||||||
|
dicomFile.Dataset.AddOrUpdate(newFragments);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
await dicomFile.SaveAsync(entryStream);
|
||||||
|
//await source.CopyToAsync(entryStream, 32 * 1024, abortToken);
|
||||||
|
|
||||||
|
|
||||||
//await _downLoadHub.Clients.User(_userInfo.IdentityUserId.ToString()).ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount);
|
await _downLoadHub.Clients.User(_userInfo.IdentityUserId.ToString()).ReceivProgressAsync(inCommand.CurrentNoticeId,
|
||||||
|
(new
|
||||||
|
{
|
||||||
|
CountPercent = downloadInfo.ImageCount > 0 ? Math.Round(receivedCount * 100m / downloadInfo.ImageCount, 2) : 0m,
|
||||||
|
SizePercent = totalSize > 0 ? Math.Round(receivedsize * 100m / totalSize, 2) : 0m
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
public interface IDownloadClient
|
public interface IDownloadClient
|
||||||
{
|
{
|
||||||
Task ReceivProgressAsync(Guid downloadId, string percent);
|
Task ReceivProgressAsync(string downloadId, object percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -970,6 +970,9 @@ namespace IRaCIS.Application.Contracts
|
||||||
public List<Guid> PatientIdList { get; set; }
|
public List<Guid> PatientIdList { get; set; }
|
||||||
|
|
||||||
public List<Guid> SCPStudyIdList { get; set; }
|
public List<Guid> SCPStudyIdList { get; set; }
|
||||||
|
|
||||||
|
[NotDefault]
|
||||||
|
public string CurrentNoticeId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VisitImageDownloadQuery : PageInput
|
public class VisitImageDownloadQuery : PageInput
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue