修改请求方式
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
2f701246ff
commit
40fd641210
|
|
@ -493,18 +493,24 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
//需要拆成固定片段的
|
//需要拆成固定片段的
|
||||||
if (syntax.IsEncapsulated && fragmentCount == pixelData.NumberOfFrames)
|
if (syntax.IsEncapsulated && fragmentCount == pixelData.NumberOfFrames)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
||||||
|
|
||||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
var newDataset = dicomFile.Dataset.Clone();
|
||||||
|
|
||||||
|
var dstPd = DicomPixelData.Create(newDataset, true);
|
||||||
|
|
||||||
|
for (int i = 0; i < pixelData.NumberOfFrames; i++)
|
||||||
{
|
{
|
||||||
var frameData = pixelData.GetFrame(n); // 获取完整一帧
|
var frame = pixelData.GetFrame(i);
|
||||||
var data = frameData.Data;
|
|
||||||
|
dstPd.AddFrame(frame);
|
||||||
|
|
||||||
|
var data = frame.Data;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
bot.Add(botOffset);
|
|
||||||
|
|
||||||
botOffset += (uint)data.Length +8 ; // 累加帧长度
|
|
||||||
|
|
||||||
while (offset < data.Length)
|
while (offset < data.Length)
|
||||||
{
|
{
|
||||||
int size = Math.Min(fragmentSize, data.Length - offset);
|
int size = Math.Min(fragmentSize, data.Length - offset);
|
||||||
|
|
@ -516,19 +522,53 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
offset += size;
|
offset += size;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//保留原始偏移表
|
|
||||||
|
|
||||||
if (originOffsetTable.Count == pixelData.NumberOfFrames)
|
|
||||||
{
|
|
||||||
newFragments.OffsetTable.AddRange(originOffsetTable.ToArray());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
var newOffsetTable = newDataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData).OffsetTable;
|
||||||
{
|
|
||||||
newFragments.OffsetTable.AddRange(bot.ToArray());
|
newFragments.OffsetTable.AddRange(newOffsetTable.ToArray());
|
||||||
}
|
|
||||||
|
#region 暂时废弃
|
||||||
|
|
||||||
|
//for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
||||||
|
//{
|
||||||
|
// var frameData = pixelData.GetFrame(n); // 获取完整一帧
|
||||||
|
// var data = frameData.Data;
|
||||||
|
// int offset = 0;
|
||||||
|
|
||||||
|
// bot.Add(botOffset);
|
||||||
|
|
||||||
|
// botOffset += (uint)data.Length + 8; // 累加帧长度
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
////保留原始偏移表
|
||||||
|
|
||||||
|
//if (originOffsetTable.Count == pixelData.NumberOfFrames)
|
||||||
|
//{
|
||||||
|
// newFragments.OffsetTable.AddRange(originOffsetTable.ToArray());
|
||||||
|
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// newFragments.OffsetTable.AddRange(bot.ToArray());
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 替换原 PixelData
|
// 替换原 PixelData
|
||||||
|
|
@ -543,6 +583,8 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
else if (syntax.IsEncapsulated && fragmentCount > pixelData.NumberOfFrames && originOffsetTable.Count == 0)
|
else if (syntax.IsEncapsulated && fragmentCount > pixelData.NumberOfFrames && originOffsetTable.Count == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint offset = 0;
|
uint offset = 0;
|
||||||
|
|
||||||
bot.Add(offset);
|
bot.Add(offset);
|
||||||
|
|
|
||||||
|
|
@ -1080,26 +1080,34 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
//获取像素是否为封装形式
|
//获取像素是否为封装形式
|
||||||
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
||||||
|
|
||||||
//对于封装像素的文件做转换
|
try
|
||||||
if (syntax.IsEncapsulated)
|
|
||||||
{
|
{
|
||||||
// 创建一个新的片段序列
|
//对于封装像素的文件做转换
|
||||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
if (syntax.IsEncapsulated)
|
||||||
// 获取每帧数据并封装为单独的片段
|
|
||||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
|
||||||
{
|
{
|
||||||
var frameData = pixelData.GetFrame(n);
|
|
||||||
newFragments.Fragments.Add(new MemoryByteBuffer(frameData.Data));
|
// 创建一个新的片段序列
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
var frag = dicomFile.Dataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData);
|
||||||
|
|
||||||
|
var originOffsetTable = frag?.OffsetTable;
|
||||||
|
|
||||||
|
newFragments.OffsetTable.AddRange(originOffsetTable?.ToArray());
|
||||||
|
// 替换原有的片段序列
|
||||||
|
dicomFile.Dataset.AddOrUpdate(newFragments);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
Log.Logger.Warning($"处理多帧合并{instance.Path}失败: {ex.Message}");
|
||||||
var frag = dicomFile.Dataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData);
|
|
||||||
|
|
||||||
var originOffsetTable = frag?.OffsetTable;
|
|
||||||
|
|
||||||
newFragments.OffsetTable.AddRange(originOffsetTable?.ToArray());
|
|
||||||
// 替换原有的片段序列
|
|
||||||
dicomFile.Dataset.AddOrUpdate(newFragments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -1149,10 +1157,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpPost("download/PatientStudyBatchDownload")]
|
[HttpGet("download/PatientStudyBatchDownload")]
|
||||||
public async Task<IActionResult> DownloadPatientStudyBatch([FromServices] IPatientService _patientService, [FromServices] IOSSService _oSSService,
|
public async Task<IActionResult> DownloadPatientStudyBatch([FromServices] IPatientService _patientService, [FromServices] IOSSService _oSSService,
|
||||||
[FromServices] IHubContext<DownloadHub, IDownloadClient> _downLoadHub,
|
[FromServices] IHubContext<DownloadHub, IDownloadClient> _downLoadHub,
|
||||||
PatientImageDownloadCommand inCommand)
|
[FromQuery] PatientImageDownloadCommand inCommand)
|
||||||
{
|
{
|
||||||
inCommand.SCPStudyIdList = inCommand.SCPStudyIdList.Where(t => t != Guid.Empty).ToList();
|
inCommand.SCPStudyIdList = inCommand.SCPStudyIdList.Where(t => t != Guid.Empty).ToList();
|
||||||
var rusult = await _patientService.GetDownloadPatientStudyInfo(inCommand);
|
var rusult = await _patientService.GetDownloadPatientStudyInfo(inCommand);
|
||||||
|
|
@ -1292,27 +1300,36 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
//获取像素是否为封装形式
|
//获取像素是否为封装形式
|
||||||
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
||||||
|
|
||||||
//对于封装像素的文件做转换
|
try
|
||||||
if (syntax.IsEncapsulated)
|
|
||||||
{
|
{
|
||||||
// 创建一个新的片段序列
|
//对于封装像素的文件做转换
|
||||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
if (syntax.IsEncapsulated)
|
||||||
// 获取每帧数据并封装为单独的片段
|
|
||||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
|
||||||
{
|
{
|
||||||
var frameData = pixelData.GetFrame(n);
|
|
||||||
newFragments.Fragments.Add(new MemoryByteBuffer(frameData.Data));
|
// 创建一个新的片段序列
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
var frag = dicomFile.Dataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData);
|
||||||
|
|
||||||
|
var originOffsetTable = frag?.OffsetTable;
|
||||||
|
|
||||||
|
newFragments.OffsetTable.AddRange(originOffsetTable?.ToArray());
|
||||||
|
// 替换原有的片段序列
|
||||||
|
dicomFile.Dataset.AddOrUpdate(newFragments);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frag = dicomFile.Dataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData);
|
|
||||||
|
|
||||||
var originOffsetTable = frag?.OffsetTable;
|
|
||||||
|
|
||||||
newFragments.OffsetTable.AddRange(originOffsetTable?.ToArray());
|
|
||||||
// 替换原有的片段序列
|
|
||||||
dicomFile.Dataset.AddOrUpdate(newFragments);
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
Log.Logger.Warning($"处理多帧合并{instance.Path}失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
await dicomFile.SaveAsync(entryStream);
|
await dicomFile.SaveAsync(entryStream);
|
||||||
|
|
@ -1361,11 +1378,11 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost("download/VisitImageDownload")]
|
[HttpGet("download/VisitImageDownload")]
|
||||||
public async Task<IActionResult> VisitImageDownload([FromServices] IPatientService _patientService, [FromServices] IOSSService _oSSService,
|
public async Task<IActionResult> VisitImageDownload([FromServices] IPatientService _patientService, [FromServices] IOSSService _oSSService,
|
||||||
[FromServices] IHubContext<DownloadHub, IDownloadClient> _downLoadHub,
|
[FromServices] IHubContext<DownloadHub, IDownloadClient> _downLoadHub,
|
||||||
[FromServices] IRepository<Trial> _trialRepository,
|
[FromServices] IRepository<Trial> _trialRepository,
|
||||||
VisitImageDownloadCommand inCommand)
|
[FromQuery] VisitImageDownloadCommand inCommand)
|
||||||
{
|
{
|
||||||
var rusult = await _patientService.GetDownloadSubjectVisitStudyInfo(inCommand);
|
var rusult = await _patientService.GetDownloadSubjectVisitStudyInfo(inCommand);
|
||||||
|
|
||||||
|
|
@ -1505,19 +1522,34 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
//获取像素是否为封装形式
|
//获取像素是否为封装形式
|
||||||
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
||||||
|
|
||||||
//对于封装像素的文件做转换
|
try
|
||||||
if (syntax.IsEncapsulated)
|
|
||||||
{
|
{
|
||||||
// 创建一个新的片段序列
|
//对于封装像素的文件做转换
|
||||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
if (syntax.IsEncapsulated)
|
||||||
// 获取每帧数据并封装为单独的片段
|
|
||||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
|
||||||
{
|
{
|
||||||
var frameData = pixelData.GetFrame(n);
|
|
||||||
newFragments.Fragments.Add(new MemoryByteBuffer(frameData.Data));
|
// 创建一个新的片段序列
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
var frag = dicomFile.Dataset.GetDicomItem<DicomOtherByteFragment>(DicomTag.PixelData);
|
||||||
|
|
||||||
|
var originOffsetTable = frag?.OffsetTable;
|
||||||
|
|
||||||
|
newFragments.OffsetTable.AddRange(originOffsetTable?.ToArray());
|
||||||
|
// 替换原有的片段序列
|
||||||
|
dicomFile.Dataset.AddOrUpdate(newFragments);
|
||||||
}
|
}
|
||||||
// 替换原有的片段序列
|
}
|
||||||
dicomFile.Dataset.AddOrUpdate(newFragments);
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
Log.Logger.Warning($"处理多帧合并{instance.Path}失败: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -1572,7 +1604,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
public async Task<IActionResult> ClinicalDataDownload([FromServices] IReadingClinicalDataService _readingClinicalDataService, [FromServices] IOSSService _oSSService,
|
public async Task<IActionResult> ClinicalDataDownload([FromServices] IReadingClinicalDataService _readingClinicalDataService, [FromServices] IOSSService _oSSService,
|
||||||
[FromServices] IHubContext<DownloadHub, IDownloadClient> _downLoadHub,
|
[FromServices] IHubContext<DownloadHub, IDownloadClient> _downLoadHub,
|
||||||
[FromServices] IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository,
|
[FromServices] IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository,
|
||||||
ClinicalDataDownloadDTO inCommand)
|
[FromQuery] ClinicalDataDownloadDTO inCommand)
|
||||||
{
|
{
|
||||||
var dataList = await _readingClinicalDataService.GetTrialClinicalDataSelect(inCommand);
|
var dataList = await _readingClinicalDataService.GetTrialClinicalDataSelect(inCommand);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue