Compare commits
No commits in common. "224382bf62739e2821bb9e8f4caf5844520dfcd2" and "5975004858ebc409168dc51e14cb3cfee9fd4d2d" have entirely different histories.
224382bf62
...
5975004858
|
|
@ -24,8 +24,6 @@ using IRaCIS.Core.Infrastructure;
|
|||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Newtonsoft.Json;
|
||||
using FellowOakDicom.Imaging.Codec;
|
||||
using FellowOakDicom.IO.Buffer;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace IRaCIS.Core.SCP.Service
|
||||
{
|
||||
|
|
@ -239,7 +237,7 @@ namespace IRaCIS.Core.SCP.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
Log.Logger.Warning($"未找到{g.Key.StudyInstanceUid}的Cmove记录");
|
||||
Log.Logger.Error($"未找到{g.Key.StudyInstanceUid}的Cmove记录");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +319,6 @@ namespace IRaCIS.Core.SCP.Service
|
|||
|
||||
|
||||
long fileSize = 0;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
|
@ -329,61 +326,7 @@ namespace IRaCIS.Core.SCP.Service
|
|||
{
|
||||
await request.File.SaveAsync(ms);
|
||||
|
||||
#region 1帧拆成多个固定大小的,方便移动端浏览
|
||||
|
||||
// 回到开头,读取 dicom
|
||||
ms.Position = 0;
|
||||
var dicomFile = DicomFile.Open(ms);
|
||||
|
||||
var pixelData = DicomPixelData.Create(dicomFile.Dataset);
|
||||
var syntax = pixelData.Syntax;
|
||||
|
||||
// 每个 fragment 固定大小 (64KB 示例,可以自己调整)
|
||||
int fragmentSize = 20 * 1024;
|
||||
|
||||
if (syntax.IsEncapsulated)
|
||||
{
|
||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
||||
|
||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
||||
{
|
||||
var frameData = pixelData.GetFrame(n); // 获取完整一帧
|
||||
var data = frameData.Data;
|
||||
int offset = 0;
|
||||
|
||||
while (offset < data.Length)
|
||||
{
|
||||
int size = Math.Min(fragmentSize, data.Length - offset);
|
||||
var buffer = new byte[size];
|
||||
Buffer.BlockCopy(data, offset, buffer, 0, size);
|
||||
|
||||
newFragments.Fragments.Add(new MemoryByteBuffer(buffer));
|
||||
offset += size;
|
||||
}
|
||||
}
|
||||
|
||||
// 替换原 PixelData
|
||||
dicomFile.Dataset.AddOrUpdate(newFragments);
|
||||
}
|
||||
|
||||
// 重新保存 dicom 到流
|
||||
ms.SetLength(0);
|
||||
dicomFile.Save(ms);
|
||||
ms.Position = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 本地测试
|
||||
//// --- 保存到本地文件测试 ---
|
||||
//var localPath = @"D:\TestDicom.dcm";
|
||||
//using (var fs = new FileStream(localPath, FileMode.Create, FileAccess.Write))
|
||||
//{
|
||||
// ms.CopyTo(fs);
|
||||
//}
|
||||
//return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//irc 从路径最后一截取Guid
|
||||
|
|
|
|||
Loading…
Reference in New Issue