コード例 #1
0
        /// <summary>
        /// Anonymises every DICOM file in the specified folder path and saves locally to the
        /// correct dry run folder.
        /// </summary>
        /// <param name="anonymisationProtocolId">The anonymisation protocol unique identifier.</param>
        /// <param name="anonymisationProtocol">The anonymisation protocol.</param>
        /// <param name="uploadQueueItem">The upload queue item.</param>
        /// <param name="aETConfigType">Type of application entity title configuration.</param>
        /// <returns>The async task.</returns>
        private async Task AnonymiseAndSaveDicomFilesAsync(
            Guid anonymisationProtocolId,
            IEnumerable <DicomTagAnonymisation> anonymisationProtocol,
            UploadQueueItem uploadQueueItem,
            AETConfigType aETConfigType)
        {
            var dryRunFolder     = DryRunFolders.GetFolder(aETConfigType);
            var resultFolderPath = Path.Combine(uploadQueueItem.RootDicomFolderPath, dryRunFolder, uploadQueueItem.AssociationGuid.ToString());

            foreach (var filePath in EnumerateFiles(uploadQueueItem.AssociationFolderPath, uploadQueueItem))
            {
                var dicomFile = TryOpenDicomFile(filePath, uploadQueueItem);

                // Not a DICOM file or is not a structure set file.
                if (dicomFile == null)
                {
                    EnqueueMessage(new DeleteQueueItem(uploadQueueItem, filePath), _deleteQueuePath);
                    continue;
                }

                var anonymizedDicomFile = _innerEyeSegmentationClient.AnonymizeDicomFile(
                    dicomFile: dicomFile,
                    anonymisationProtocolId: anonymisationProtocolId,
                    anonymisationProtocol: anonymisationProtocol);

                await SaveDicomFilesAsync(resultFolderPath, anonymizedDicomFile).ConfigureAwait(false);

                // This item has been saved, we can now delete this file
                EnqueueMessage(new DeleteQueueItem(uploadQueueItem, filePath), _deleteQueuePath);
            }
        }
コード例 #2
0
 public DicomFile AnonymizeDicomFile(DicomFile dicomFile, Guid anonymisationProtocolId, IEnumerable <DicomTagAnonymisation> anonymisationProtocol)
 {
     return(_InnerEyeSegmentationClient.AnonymizeDicomFile(dicomFile, anonymisationProtocolId, anonymisationProtocol));
 }