Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
89f6cd4244
|
|
@ -1584,6 +1584,10 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task DeleteFromPrefix(string prefix, bool isCache = false)
|
public async Task DeleteFromPrefix(string prefix, bool isCache = false)
|
||||||
{
|
{
|
||||||
|
if (prefix.StartsWith("/"))
|
||||||
|
{
|
||||||
|
prefix = prefix.TrimStart("/");
|
||||||
|
}
|
||||||
|
|
||||||
//打开了同步的,删除的时候,一起删除
|
//打开了同步的,删除的时候,一起删除
|
||||||
if (ObjectStoreServiceOptions.IsOpenStoreSync && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.IsOpenSync))
|
if (ObjectStoreServiceOptions.IsOpenStoreSync && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.IsOpenSync))
|
||||||
|
|
|
||||||
|
|
@ -178,11 +178,10 @@ public static class DicomPixelMasker
|
||||||
public static async Task<MemoryStream> MaskAsync(
|
public static async Task<MemoryStream> MaskAsync(
|
||||||
Stream input,
|
Stream input,
|
||||||
IEnumerable<MaskRegion> regions,
|
IEnumerable<MaskRegion> regions,
|
||||||
DicomMaskOptions? options = null,
|
DicomMaskOptions? options = null)
|
||||||
CancellationToken cancellationToken = default)
|
|
||||||
{
|
{
|
||||||
var output = new MemoryStream();
|
var output = new MemoryStream();
|
||||||
await MaskAsync(input, output, regions, options, cancellationToken).ConfigureAwait(false);
|
await MaskAsync(input, output, regions, options).ConfigureAwait(false);
|
||||||
output.Position = 0;
|
output.Position = 0;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
@ -211,6 +210,7 @@ public static class DicomPixelMasker
|
||||||
var workingDataset = workingFile.Dataset;
|
var workingDataset = workingFile.Dataset;
|
||||||
|
|
||||||
var originalPhotometric = originalDataset.GetSingleValueOrDefault(DicomTag.PhotometricInterpretation, string.Empty);
|
var originalPhotometric = originalDataset.GetSingleValueOrDefault(DicomTag.PhotometricInterpretation, string.Empty);
|
||||||
|
|
||||||
Console.WriteLine($"Original Photometric={originalPhotometric}, Original TS={originalTs.UID.UID}");
|
Console.WriteLine($"Original Photometric={originalPhotometric}, Original TS={originalTs.UID.UID}");
|
||||||
|
|
||||||
var rows = workingDataset.GetSingleValue<int>(DicomTag.Rows);
|
var rows = workingDataset.GetSingleValue<int>(DicomTag.Rows);
|
||||||
|
|
|
||||||
|
|
@ -2965,6 +2965,19 @@
|
||||||
<param name="inQuery"></param>
|
<param name="inQuery"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.StudyMaskImage(IRaCIS.Core.Application.Contracts.StudyMaskImageCommand)">
|
||||||
|
<summary>
|
||||||
|
标注遮盖影像 路径后面加了.MaskImage 就是遮盖的新路径
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.StudyUndoMaskImage(IRaCIS.Core.Application.Contracts.StudyUndoMaskImageCommand)">
|
||||||
|
<summary>
|
||||||
|
撤销遮盖的影像,可以单张,也可以整个序列
|
||||||
|
</summary>
|
||||||
|
<param name="inCommand"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.Preview(System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.Preview(System.Guid)">
|
||||||
<summary> 指定资源Id,渲染Dicom检查的Jpeg预览图像 </summary>
|
<summary> 指定资源Id,渲染Dicom检查的Jpeg预览图像 </summary>
|
||||||
<param name="studyId"> Dicom检查的Id </param>
|
<param name="studyId"> Dicom检查的Id </param>
|
||||||
|
|
@ -17242,17 +17255,17 @@
|
||||||
</member>
|
</member>
|
||||||
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
|
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
|
||||||
<summary>
|
<summary>
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
质疑
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
|
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
|
||||||
<summary>
|
<summary>
|
||||||
һ<EFBFBD><EFBFBD><EFBFBD>Ժ˲<EFBFBD>
|
一致性核查
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
|
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
|
||||||
<summary>
|
<summary>
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
复制
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">
|
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using FellowOakDicom;
|
using FellowOakDicom;
|
||||||
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.Service.ImageAndDoc.DTO;
|
using IRaCIS.Core.Application.Service.ImageAndDoc.DTO;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
@ -981,7 +982,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SubjectVisitMarkQuery:PageInput
|
public class SubjectVisitMarkQuery : PageInput
|
||||||
{
|
{
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
|
@ -1065,4 +1066,29 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
public List<StudyBasicInfo> UploadStudyList { get; set; }
|
public List<StudyBasicInfo> UploadStudyList { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class StudyMaskImageCommand
|
||||||
|
{
|
||||||
|
public Guid? SeriesId { get; set; }
|
||||||
|
|
||||||
|
public List<Guid>? InstanceIdList { get; set; }
|
||||||
|
|
||||||
|
public List<MaskRegion> MaskRegionList { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StudyUndoMaskImageCommand
|
||||||
|
{
|
||||||
|
public Guid? SeriesId { get; set; }
|
||||||
|
|
||||||
|
public List<Guid>? InstanceIdList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InstanceIdPath
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public string Path { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ using IRaCIS.Core.Infrastructure;
|
||||||
using Medallion.Threading;
|
using Medallion.Threading;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SkiaSharp;
|
||||||
|
using System.Drawing;
|
||||||
using ZiggyCreatures.Caching.Fusion;
|
using ZiggyCreatures.Caching.Fusion;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
@ -25,7 +27,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
IRepository<StudyMonitor> _studyMonitorRepository,
|
IRepository<StudyMonitor> _studyMonitorRepository,
|
||||||
IRepository<SystemAnonymization> _systemAnonymizationRepository,
|
IRepository<SystemAnonymization> _systemAnonymizationRepository,
|
||||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||||
IDistributedLockProvider _distributedLockProvider,
|
IDistributedLockProvider _distributedLockProvider, IOSSService _oSSService,
|
||||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IStudyService
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IStudyService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -66,6 +68,116 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标注遮盖影像 路径后面加了.MaskImage 就是遮盖的新路径
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IResponseOutput> StudyMaskImage(StudyMaskImageCommand inCommand)
|
||||||
|
{
|
||||||
|
if (inCommand.SeriesId == null && inCommand.InstanceIdList == null)
|
||||||
|
{
|
||||||
|
return ResponseOutput.NotOk("SeriesId and InstanceIdList can not both be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var idPathList = new List<InstanceIdPath>();
|
||||||
|
|
||||||
|
if (inCommand.SeriesId == null && inCommand.InstanceIdList != null)
|
||||||
|
{
|
||||||
|
idPathList = await _dicomInstanceRepository.Where(t => inCommand.InstanceIdList.Contains(t.Id)).Select(t => new InstanceIdPath { Id = t.Id, Path = t.Path }).ToListAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
idPathList = await _dicomInstanceRepository.Where(t => t.SeriesId == inCommand.SeriesId).Select(t => new InstanceIdPath { Id = t.Id, Path = t.Path }).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var errorPathList = new List<string>();
|
||||||
|
|
||||||
|
foreach (var item in idPathList)
|
||||||
|
{
|
||||||
|
var path = item.Path;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var inputStream = await _oSSService.GetStreamFromOSSAsync(path);
|
||||||
|
|
||||||
|
var outPutStream = await DicomPixelMasker.MaskAsync(inputStream, inCommand.MaskRegionList);
|
||||||
|
|
||||||
|
var prefix = path.Substring(1, path.LastIndexOf('/') - 1);
|
||||||
|
|
||||||
|
var maskPath = $"{Path.GetFileName(path)}.MaskImage";
|
||||||
|
|
||||||
|
//清理缓存的里面的遮盖图,多次遮盖同一张图时,清除缓存很重要
|
||||||
|
await _oSSService.DeleteFromPrefix(maskPath, true);
|
||||||
|
|
||||||
|
await _oSSService.UploadToOSSAsync(outPutStream, prefix, maskPath);
|
||||||
|
|
||||||
|
await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new DicomInstance() { IsMasked = true });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
errorPathList.Add(path);
|
||||||
|
|
||||||
|
Log.Logger.Error(ex, $"StudyMaskImage Error for InstanceIdList Path:{path} {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await _dicomInstanceRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(errorPathList);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 撤销遮盖的影像,可以单张,也可以整个序列
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inCommand"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IResponseOutput> StudyUndoMaskImage(StudyUndoMaskImageCommand inCommand)
|
||||||
|
{
|
||||||
|
if (inCommand.SeriesId == null && inCommand.InstanceIdList == null)
|
||||||
|
{
|
||||||
|
return ResponseOutput.NotOk("SeriesId and InstanceIdList can not both be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var idPathList = new List<InstanceIdPath>();
|
||||||
|
|
||||||
|
if (inCommand.SeriesId == null && inCommand.InstanceIdList != null)
|
||||||
|
{
|
||||||
|
idPathList = await _dicomInstanceRepository.Where(t => inCommand.InstanceIdList.Contains(t.Id)).Select(t => new InstanceIdPath { Id = t.Id, Path = t.Path }).ToListAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
idPathList = await _dicomInstanceRepository.Where(t => t.SeriesId == inCommand.SeriesId).Select(t => new InstanceIdPath { Id = t.Id, Path = t.Path }).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in idPathList)
|
||||||
|
{
|
||||||
|
if (item.Path.EndsWith(".MaskImage"))
|
||||||
|
{
|
||||||
|
var newPath = item.Path[..^10];
|
||||||
|
|
||||||
|
//await _oSSService.DeleteFromPrefix(newPath, true);
|
||||||
|
|
||||||
|
await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new DicomInstance() { Path = newPath, IsMasked = false });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await _dicomInstanceRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||||
|
|
||||||
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
|
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
|
||||||
|
|
@ -462,7 +574,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
Id = t.Id,
|
Id = t.Id,
|
||||||
|
|
||||||
Bodypart = t.BodyPart,
|
Bodypart = t.BodyPart,
|
||||||
BodyPartForEditOther=t.BodyPartForEditOther,
|
BodyPartForEditOther = t.BodyPartForEditOther,
|
||||||
|
|
||||||
Modalities = t.Modality,
|
Modalities = t.Modality,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
public async Task<IResponseOutput> MaskImage()
|
public async Task<IResponseOutput> MaskImage()
|
||||||
{
|
{
|
||||||
|
|
||||||
var sourceDir = @"D:\images";
|
var sourceDir = @"D:\images\11\像素匿名\隐私信息2&测量值\08\08017\基线(V1)\ST01371_1970-01-01_US\IMAGE";
|
||||||
var targetDir = @"D:\images\after";
|
var targetDir = @"D:\images\11\像素匿名\隐私信息2&测量值\08\08017\基线(V1)\ST01371_1970-01-01_US\IMAGE\after";
|
||||||
|
|
||||||
Directory.CreateDirectory(targetDir);
|
Directory.CreateDirectory(targetDir);
|
||||||
var regions = new[]
|
var regions = new[]
|
||||||
|
|
@ -138,7 +138,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
new MaskRegion(0, 0, 200, 200)
|
new MaskRegion(0, 0, 200, 200)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var inputPath in Directory.EnumerateFiles(sourceDir, "*.dcm", SearchOption.TopDirectoryOnly))
|
foreach (var inputPath in Directory.EnumerateFiles(sourceDir, "IM_*", SearchOption.TopDirectoryOnly))
|
||||||
{
|
{
|
||||||
var relativePath = Path.GetRelativePath(sourceDir, inputPath);
|
var relativePath = Path.GetRelativePath(sourceDir, inputPath);
|
||||||
var outputPath = Path.Combine(targetDir, relativePath);
|
var outputPath = Path.Combine(targetDir, relativePath);
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,9 @@ public class DicomInstance : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||||
|
|
||||||
public bool IsReading { get; set; } = true;
|
public bool IsReading { get; set; } = true;
|
||||||
|
|
||||||
|
[Comment("是否已经影像遮盖")]
|
||||||
|
public bool IsMasked { get; set; } = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region DIR 增加
|
#region DIR 增加
|
||||||
|
|
|
||||||
22061
IRaCIS.Core.Infra.EFCore/Migrations/20260421023504_addImageMask.Designer.cs
generated
Normal file
22061
IRaCIS.Core.Infra.EFCore/Migrations/20260421023504_addImageMask.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class addImageMask : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsMasked",
|
||||||
|
table: "DicomInstance",
|
||||||
|
type: "bit",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false,
|
||||||
|
comment: "是否已经影像遮盖");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsMasked",
|
||||||
|
table: "DicomInstance");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1168,6 +1168,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Property<bool>("IsEncapsulated")
|
b.Property<bool>("IsEncapsulated")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsMasked")
|
||||||
|
.HasColumnType("bit")
|
||||||
|
.HasComment("是否已经影像遮盖");
|
||||||
|
|
||||||
b.Property<bool>("IsReading")
|
b.Property<bool>("IsReading")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue