创建bot测试-1
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
67b2d95c32
commit
48aafdc713
|
|
@ -480,10 +480,22 @@ namespace IRaCIS.Core.SCP.Service
|
|||
|
||||
if (syntax.IsEncapsulated)
|
||||
{
|
||||
|
||||
// ====== 新增:BOT 所需数据 ======
|
||||
var frameOffsets = new List<uint>();
|
||||
uint currentOffset = 0;
|
||||
|
||||
|
||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
||||
|
||||
// 先占位 BOT(第 0 个 fragment)
|
||||
newFragments.Fragments.Add(new MemoryByteBuffer(Array.Empty<byte>()));
|
||||
|
||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
||||
{
|
||||
// 记录该帧的起始 offset
|
||||
frameOffsets.Add(currentOffset);
|
||||
|
||||
var frameData = pixelData.GetFrame(n); // 获取完整一帧
|
||||
var data = frameData.Data;
|
||||
int offset = 0;
|
||||
|
|
@ -496,9 +508,27 @@ namespace IRaCIS.Core.SCP.Service
|
|||
|
||||
newFragments.Fragments.Add(new MemoryByteBuffer(buffer));
|
||||
offset += size;
|
||||
|
||||
currentOffset += (uint)size;
|
||||
}
|
||||
}
|
||||
|
||||
// ====== 回填 BOT ======
|
||||
var botBytes = new byte[frameOffsets.Count * 4];
|
||||
for (int i = 0; i < frameOffsets.Count; i++)
|
||||
{
|
||||
// BOT 使用 Little Endian
|
||||
var bytes = BitConverter.GetBytes(frameOffsets[i]);
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
Array.Reverse(bytes);
|
||||
}
|
||||
bytes.CopyTo(botBytes, i * 4);
|
||||
}
|
||||
|
||||
// 用 BOT 替换第 0 个 fragment
|
||||
newFragments.Fragments[0] = new MemoryByteBuffer(botBytes);
|
||||
|
||||
// 替换原 PixelData
|
||||
dicomFile.Dataset.AddOrUpdate(newFragments);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue