diff --git a/IRC.Core.SCP/Service/CStoreSCPService.cs b/IRC.Core.SCP/Service/CStoreSCPService.cs index 224d2ca24..9c1fecab5 100644 --- a/IRC.Core.SCP/Service/CStoreSCPService.cs +++ b/IRC.Core.SCP/Service/CStoreSCPService.cs @@ -540,12 +540,12 @@ namespace IRaCIS.Core.SCP.Service //保留原始偏移表 - if (originOffsetTable.Count == pixelData.NumberOfFrames) - { - newFragments.OffsetTable.AddRange(originOffsetTable.ToArray()); + //if (originOffsetTable.Count == pixelData.NumberOfFrames) + //{ + // newFragments.OffsetTable.AddRange(originOffsetTable.ToArray()); - } - else + //} + //else { newFragments.OffsetTable.AddRange(bot.ToArray()); @@ -674,7 +674,7 @@ namespace IRaCIS.Core.SCP.Service // 上传缩略图到 OSS - var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, $"{seriesId.ToString()}_{instanceId.ToString()}.preview.jpg", false,uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive }); + var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, $"{seriesId.ToString()}_{instanceId.ToString()}.preview.jpg", false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive }); series.ImageResizePath = seriesPath; diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index aa63d57e4..ec04c3f08 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -918,7 +918,7 @@ public class OSSService(IOptionsMonitor options, uploadInfo.FileSize = fileStream.CanSeek ? fileStream.Length : 0; uploadInfo.Path = returnPath; uploadInfo.FileName = fileRealName; - uploadInfo.FileType = Path.GetExtension(returnPath); + uploadInfo.FileType = Path.GetExtension(returnPath).TrimStart('.'); await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo); @@ -1057,7 +1057,7 @@ public class OSSService(IOptionsMonitor options, uploadInfo.FileSize = fileSize; uploadInfo.Path = returnPath; uploadInfo.FileName = Path.GetFileName(localFilePath); - uploadInfo.FileType = Path.GetExtension(returnPath); + uploadInfo.FileType = Path.GetExtension(returnPath).TrimStart("."); await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo); diff --git a/IRaCIS.Core.Application/Helper/OtherTool/DicomSortHelper.cs b/IRaCIS.Core.Application/Helper/OtherTool/DicomSortHelper.cs index 065fc779e..7ae24842d 100644 --- a/IRaCIS.Core.Application/Helper/OtherTool/DicomSortHelper.cs +++ b/IRaCIS.Core.Application/Helper/OtherTool/DicomSortHelper.cs @@ -237,6 +237,20 @@ public static class DicomPixelMasker { workingDataset.AddOrUpdate(DicomTag.BurnedInAnnotation, "NO"); } + + //// 转 JPEG Baseline(最稳定) + //var transcoder = new DicomTranscoder( + // DicomTransferSyntax.ExplicitVRLittleEndian, + // DicomTransferSyntax.JPEGProcess1); + + //var finalFile = await Task.Run( + // () => transcoder.Transcode(workingFile), + // cancellationToken).ConfigureAwait(false); + + //if (output.CanSeek) + // output.SetLength(0); + //await finalFile.SaveAsync(output).ConfigureAwait(false); + // 不要把 original photometric 强行写回 var finalFile = await ReEncodeToOriginalTransferSyntaxAsync( workingFile, @@ -422,17 +436,26 @@ public static class DicomPixelMasker DicomPixelData sourcePixelData, IReadOnlyList frames) { + //dataset.Remove(DicomTag.PixelData); + //var newPixelData = DicomPixelData.Create(dataset, true); + ////newPixelData.BitsAllocated = sourcePixelData.BitsAllocated; + //newPixelData.BitsStored = sourcePixelData.BitsStored; + //newPixelData.HighBit = sourcePixelData.HighBit; + //newPixelData.SamplesPerPixel = sourcePixelData.SamplesPerPixel; + //newPixelData.PixelRepresentation = sourcePixelData.PixelRepresentation; + //newPixelData.PlanarConfiguration = sourcePixelData.PlanarConfiguration; + //newPixelData.Height = sourcePixelData.Height; + //newPixelData.Width = sourcePixelData.Width; + //newPixelData.PhotometricInterpretation = sourcePixelData.PhotometricInterpretation; + //foreach (var frame in frames) + //{ + // newPixelData.AddFrame(frame); + //} + dataset.Remove(DicomTag.PixelData); + var newPixelData = DicomPixelData.Create(dataset, true); - //newPixelData.BitsAllocated = sourcePixelData.BitsAllocated; - newPixelData.BitsStored = sourcePixelData.BitsStored; - newPixelData.HighBit = sourcePixelData.HighBit; - newPixelData.SamplesPerPixel = sourcePixelData.SamplesPerPixel; - newPixelData.PixelRepresentation = sourcePixelData.PixelRepresentation; - newPixelData.PlanarConfiguration = sourcePixelData.PlanarConfiguration; - newPixelData.Height = sourcePixelData.Height; - newPixelData.Width = sourcePixelData.Width; - newPixelData.PhotometricInterpretation = sourcePixelData.PhotometricInterpretation; + foreach (var frame in frames) { newPixelData.AddFrame(frame); diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 265d69dc6..70e012990 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -17399,17 +17399,17 @@ - ���� + 质疑 - һ���Ժ˲� + 一致性核查 - ���� + 复制 diff --git a/IRaCIS.Core.Application/Service/Common/FileUploadRecordService.cs b/IRaCIS.Core.Application/Service/Common/FileUploadRecordService.cs index 3c367627c..78e02246c 100644 --- a/IRaCIS.Core.Application/Service/Common/FileUploadRecordService.cs +++ b/IRaCIS.Core.Application/Service/Common/FileUploadRecordService.cs @@ -222,7 +222,7 @@ public class FileUploadRecordService(IRepository _fileUploadRe { addOrEditFileUploadRecord.IsNeedSync = true; - addOrEditFileUploadRecord.Priority = 0; + addOrEditFileUploadRecord.Priority = addOrEditFileUploadRecord.Priority?? 0; addOrEditFileUploadRecord.IsSync = false; } @@ -242,7 +242,7 @@ public class FileUploadRecordService(IRepository _fileUploadRe addOrEditFileUploadRecord.IsSync = false; - addOrEditFileUploadRecord.Priority = 0; + addOrEditFileUploadRecord.Priority = addOrEditFileUploadRecord.Priority ?? 0; } var entity = await _fileUploadRecordRepository.InsertOrUpdateAsync(addOrEditFileUploadRecord, true); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 10c7fc48e..c38ebff88 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -166,46 +166,76 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var newFragments = new DicomOtherByteFragment(DicomTag.PixelData); - #region 最终使用 - for (int n = 0; n < pixelData.NumberOfFrames; n++) { - var frameData = pixelData.GetFrame(n); // 获取完整一帧 + var frameData = pixelData.GetFrame(n); var data = frameData.Data; - int offset = 0; + // 当前 frame 起始 offset bot.Add(botOffset); - botOffset += (uint)data.Length; - + int offset = 0; while (offset < data.Length) { - botOffset += 8; - - 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; + // 一个 fragment: + // 8-byte item header + // + fragment payload + botOffset += (uint)(8 + size); + offset += size; } } + + #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; + + + // while (offset < data.Length) + // { + // botOffset += 8; + + + // 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()); + //if (originOffsetTable.Count == pixelData.NumberOfFrames) + //{ + // newFragments.OffsetTable.AddRange(originOffsetTable.ToArray()); - } - else + //} + //else { newFragments.OffsetTable.AddRange(bot.ToArray()); + Log.Logger.Warning(bot.ToArray().ToJsonStr()); } #endregion diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index fa46dfa78..666251aac 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -359,6 +359,8 @@ namespace IRaCIS.Core.Application.Service await _mailVerificationService.AnolymousSendEmailForResetAccount(email, verificationCode); + await _fusionCache.RemoveAsync(CacheKeys.UserLoginError(existUser.UserName)); + await _fusionCache.RemoveByTagAsync(CacheKeys.UserMFATag(existUser.Id)); return ResponseOutput.Ok();