同步遮盖影像初步预提交
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using FellowOakDicom;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Service.ImageAndDoc.DTO;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Newtonsoft.Json;
|
||||
@@ -963,7 +964,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
}
|
||||
|
||||
|
||||
public class SubjectVisitMarkQuery:PageInput
|
||||
public class SubjectVisitMarkQuery : PageInput
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
@@ -1047,4 +1048,15 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
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; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using IRaCIS.Core.Infrastructure;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Drawing;
|
||||
using ZiggyCreatures.Caching.Fusion;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
@@ -25,7 +26,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
IRepository<StudyMonitor> _studyMonitorRepository,
|
||||
IRepository<SystemAnonymization> _systemAnonymizationRepository,
|
||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IDistributedLockProvider _distributedLockProvider,
|
||||
IDistributedLockProvider _distributedLockProvider, IOSSService _oSSService,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IStudyService
|
||||
{
|
||||
|
||||
@@ -66,6 +67,53 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标注遮盖影像
|
||||
/// </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 instancePathList = new List<string>();
|
||||
|
||||
if (inCommand.SeriesId == null && inCommand.InstanceIdList != null)
|
||||
{
|
||||
instancePathList = await _dicomInstanceRepository.Where(t => inCommand.InstanceIdList.Contains(t.Id)).Select(t => t.Path).ToListAsync();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
instancePathList = await _dicomInstanceRepository.Where(t => t.SeriesId == inCommand.SeriesId).Select(t => t.Path).ToListAsync();
|
||||
}
|
||||
|
||||
foreach (var path in instancePathList)
|
||||
{
|
||||
try
|
||||
{
|
||||
var inputStream = await _oSSService.GetStreamFromOSSAsync(path);
|
||||
|
||||
var outPutStream = await DicomPixelMasker.MaskAsync(inputStream, inCommand.MaskRegionList);
|
||||
|
||||
var prefix = path.Substring(1, path.LastIndexOf('/') - 1);
|
||||
await _oSSService.UploadToOSSAsync(outPutStream, prefix, $"MaskImage_{Path.GetFileName(path)}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Log.Logger.Error(ex, $"StudyMaskImage Error for InstanceIdList Path:{path} {ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
|
||||
}
|
||||
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
|
||||
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
|
||||
@@ -324,7 +372,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var @lock2 = _distributedLockProvider.CreateLock($"StudyCommit");
|
||||
@@ -334,7 +382,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
await _dicomInstanceRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.UploadBatchId == incommand.UploadBatchId, u => new FileUploadRecord() { StudyCode = findStudy.StudyCode });
|
||||
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.UploadBatchId == incommand.UploadBatchId, u => new FileUploadRecord() { StudyCode = findStudy.StudyCode });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -437,7 +485,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
Id = t.Id,
|
||||
|
||||
Bodypart = t.BodyPart,
|
||||
BodyPartForEditOther=t.BodyPartForEditOther,
|
||||
BodyPartForEditOther = t.BodyPartForEditOther,
|
||||
|
||||
Modalities = t.Modality,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user