接口撤回
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
9c3e72b1bb
commit
fb33acd827
|
|
@ -490,25 +490,9 @@ namespace IRaCIS.Core.SCP.Service
|
|||
|
||||
uint botOffset = 0;
|
||||
|
||||
//需要拆成固定片段的
|
||||
if (syntax.IsEncapsulated && fragmentCount == pixelData.NumberOfFrames)
|
||||
{
|
||||
//// ① 先复制 Dataset(非常关键)
|
||||
//var newDataset = dicomFile.Dataset.Clone();
|
||||
|
||||
//// ② 从“旧 dataset”读 PixelData
|
||||
//var srcPd = DicomPixelData.Create(dicomFile.Dataset);
|
||||
|
||||
//// ③ 在“新 dataset”中创建新的 PixelData
|
||||
//var dstPd = DicomPixelData.Create(newDataset, true);
|
||||
|
||||
//// ④ 重建 PixelData(自动 BOT)
|
||||
//for (int i = 0; i < srcPd.NumberOfFrames; i++)
|
||||
//{
|
||||
// var frame = srcPd.GetFrame(i);
|
||||
// dstPd.AddFrame(frame);
|
||||
//}
|
||||
|
||||
|
||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
||||
|
||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
||||
|
|
@ -555,9 +539,57 @@ namespace IRaCIS.Core.SCP.Service
|
|||
ms.SetLength(0);
|
||||
dicomFile.Save(ms);
|
||||
}
|
||||
//传递过来的就是拆分的,但是是没有偏移表的,我需要自己创建偏移表,不然生成缩略图失败
|
||||
else if (syntax.IsEncapsulated && fragmentCount > pixelData.NumberOfFrames && originOffsetTable.Count==0)
|
||||
{
|
||||
|
||||
uint offset = 0;
|
||||
|
||||
bot.Add(offset);
|
||||
|
||||
var fistSize = frag.Fragments.FirstOrDefault()?.Size??0;
|
||||
|
||||
//和上一个大小不一样
|
||||
var isDiffrentBefore = false;
|
||||
|
||||
// 假设你知道每帧对应的 fragment 数量
|
||||
foreach (var frameFragments in frag.Fragments)
|
||||
{
|
||||
if(frameFragments.Size== fistSize)
|
||||
{
|
||||
isDiffrentBefore = false;
|
||||
// 累加这一帧所有 fragment 的大小
|
||||
offset += (uint)frameFragments.Size;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset += (uint)frameFragments.Size;
|
||||
isDiffrentBefore = true;
|
||||
|
||||
}
|
||||
|
||||
if (isDiffrentBefore)
|
||||
{
|
||||
bot.Add(offset);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bot.RemoveAt(bot.Count - 1);
|
||||
// 设置到新的 PixelData
|
||||
frag.OffsetTable.AddRange(bot.ToArray());
|
||||
|
||||
|
||||
// 重新保存 DICOM 到流
|
||||
ms.SetLength(0);
|
||||
dicomFile.Save(ms);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
ms.Position = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -573,21 +605,11 @@ namespace IRaCIS.Core.SCP.Service
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
ms.Position = 0;
|
||||
//irc 从路径最后一截取Guid
|
||||
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false);
|
||||
|
||||
fileSize = ms.Length;
|
||||
}
|
||||
|
||||
Log.Logger.Information($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} {request.SOPInstanceUID} 上传完成 ");
|
||||
|
||||
}
|
||||
catch (Exception ec)
|
||||
{
|
||||
Log.Logger.Warning($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} 上传异常 {ec.Message}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var @lock = _distributedLockProvider.CreateLock($"{studyInstanceUid}");
|
||||
|
|
@ -596,7 +618,7 @@ namespace IRaCIS.Core.SCP.Service
|
|||
{
|
||||
try
|
||||
{
|
||||
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.File, storeRelativePath, Association.CallingAE, Association.CalledAE, fileSize);
|
||||
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(dicomFile, storeRelativePath, Association.CallingAE, Association.CalledAE, fileSize);
|
||||
|
||||
var series = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);
|
||||
|
||||
|
|
@ -607,7 +629,7 @@ namespace IRaCIS.Core.SCP.Service
|
|||
// 生成缩略图
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
DicomImage image = new DicomImage(request.Dataset);
|
||||
DicomImage image = new DicomImage(dicomFile.Dataset);
|
||||
|
||||
var sharpimage = image.RenderImage().AsSharpImage();
|
||||
sharpimage.Save(memoryStream, new JpegEncoder());
|
||||
|
|
@ -702,10 +724,22 @@ namespace IRaCIS.Core.SCP.Service
|
|||
//监控信息设置
|
||||
_upload.FileCount++;
|
||||
_upload.FileSize = _upload.FileSize + fileSize;
|
||||
return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||
}
|
||||
}
|
||||
|
||||
Log.Logger.Information($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} {request.SOPInstanceUID} 上传完成 ");
|
||||
|
||||
}
|
||||
catch (Exception ec)
|
||||
{
|
||||
Log.Logger.Warning($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} 上传异常 {ec.Message}");
|
||||
}
|
||||
|
||||
return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Task OnCStoreRequestExceptionAsync(string tempFileName, Exception e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ namespace IRaCIS.Core.SCP.Service
|
|||
SliceLocation = dataset.GetSingleValueOrDefault(DicomTag.SliceLocation, 0),
|
||||
|
||||
SliceThickness = dataset.GetSingleValueOrDefault(DicomTag.SliceThickness, string.Empty),
|
||||
NumberOfFrames = dataset.GetSingleValueOrDefault(DicomTag.NumberOfFrames, 0),
|
||||
NumberOfFrames = dataset.GetSingleValueOrDefault(DicomTag.NumberOfFrames, 1),
|
||||
PixelSpacing = dataset.GetSingleValueOrDefault(DicomTag.PixelSpacing, string.Empty),
|
||||
ImagerPixelSpacing = dataset.GetSingleValueOrDefault(DicomTag.ImagerPixelSpacing, string.Empty),
|
||||
FrameOfReferenceUID = dataset.GetSingleValueOrDefault(DicomTag.FrameOfReferenceUID, string.Empty),
|
||||
|
|
|
|||
|
|
@ -894,10 +894,10 @@ namespace IRaCIS.Core.API.Controllers
|
|||
#endregion
|
||||
|
||||
|
||||
[HttpGet("download/PatientStudyBatchDownload")]
|
||||
[HttpPost("download/PatientStudyBatchDownload")]
|
||||
public async Task<IActionResult> DownloadPatientStudyBatch([FromServices] IPatientService _patientService, [FromServices] IOSSService _oSSService,
|
||||
[FromServices] IHubContext<DownloadHub, IDownloadClient> _downLoadHub,
|
||||
[FromQuery] PatientImageDownloadCommand inCommand)
|
||||
PatientImageDownloadCommand inCommand)
|
||||
{
|
||||
inCommand.SCPStudyIdList = inCommand.SCPStudyIdList.Where(t => t != Guid.Empty).ToList();
|
||||
var rusult = await _patientService.GetDownloadPatientStudyInfo(inCommand);
|
||||
|
|
|
|||
|
|
@ -291,6 +291,8 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public List<PatientTagView> ViewPatientHospitalGroupTagList => PatientHospitalGroupTagList.Where(t => CurrentUserHospitalGroupList.Contains(t.HospitalGroupName)).ToList();
|
||||
|
||||
//public long? FileSize { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class PatientTagView
|
||||
|
|
|
|||
|
|
@ -776,8 +776,9 @@ namespace IRaCIS.Application.Services
|
|||
StudyHospitalGroupList = patient.SCPStudyList.SelectMany(t => t.HospitalGroupList).Select(t => t.HospitalGroup.Name).Distinct().ToList(),
|
||||
|
||||
PatientHospitalGroupTagList = patient.PatientHospitalGroupTagList
|
||||
.Select(t => new PatientTagView() { HospitalGroupName = t.HospitalGroupTag.HospitalGroup.Name, HospitalGroupTagName = t.HospitalGroupTag.Name }).ToList()
|
||||
.Select(t => new PatientTagView() { HospitalGroupName = t.HospitalGroupTag.HospitalGroup.Name, HospitalGroupTagName = t.HospitalGroupTag.Name }).ToList(),
|
||||
|
||||
//FileSize = patient.SCPStudyList.Where(t => isAdminOrOA ? true : t.HospitalGroupList.Any(c => currentUserHospitalGroupIdList.Contains(c.HospitalGroupId))).SelectMany(t => t.InstanceList).Sum(t => t.FileSize)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue