Example #1
0
 /// <summary>
 /// Creates an instance of <see cref="InsertSIQCommand"/> to insert a <see cref="StudyIntegrityQueue"/> entry
 /// for a <see cref="DicomFile"/>
 /// </summary>
 /// <param name="studyStorage">The <see cref="StudyStorageLocation"/> of the study</param>
 /// <param name="reason">A <see cref="StudyIntegrityReasonEnum"/> value indicating the type of <see cref="StudyIntegrityQueue"/> entry to be inserted.</param>
 /// <param name="file">The DICOM file that needs to be reconciled</param>
 /// <param name="uidGroup">The string value representing the group of images which the DICOM <paramref name="file"/> belongs to</param>
 /// <param name="reconcileImageStorage">The <see cref="ReconcileStorage"/> where the DICOM file will be stored.</param>
 public InsertSIQCommand(
     StudyStorageLocation studyStorage,
     StudyIntegrityReasonEnum reason,
     DicomFile file,
     string uidGroup,
     ReconcileStorage reconcileImageStorage
     )
     : base("Insert SIQ Command")
 {
     _storageLocation       = studyStorage;
     _reconcileImageStorage = reconcileImageStorage;
     _reason   = reason;
     _file     = file;
     _uidGroup = uidGroup;
 }
Example #2
0
        /// <summary>
        /// Inserts a <see cref="StudyIntegrityQueue"/> entry for manual reconciliation.
        /// </summary>
        /// <param name="file">The DICOM file that needs to be reconciled.</param>
        /// <param name="reason">The type of <see cref="StudyIntegrityQueue"/> entry to be inserted.</param>
        /// <param name="uid">A UID to delete on insert.</param>
        /// <remarks>
        /// A copy of the DICOM file will be stored in a special folder allocated for
        /// reconciliation purpose. The caller is responsible for managing the original copy.
        /// </remarks>
        public void ScheduleReconcile(DicomFile file, StudyIntegrityReasonEnum reason, WorkQueueUid uid)
        {
            Platform.CheckForNullReference(_context.StudyLocation, "_context.StudyLocation");

            Platform.Log(LogLevel.Info, "Scheduling new manual reconciliation for SOP {0}", file.MediaStorageSopInstanceUid);
            ServerFilesystemInfo fs = FilesystemMonitor.Instance.GetFilesystemInfo(_context.StudyLocation.FilesystemKey);

            Platform.CheckForNullReference(fs, "fs");

            ReconcileStorage reconcileStorage = new ReconcileStorage(_context.StudyLocation, _context.Group);

            using (ServerCommandProcessor processor = new ServerCommandProcessor("Schedule Manual Reconciliation"))
            {
                string        path = reconcileStorage.GetSopInstancePath(file.DataSet[DicomTags.SopInstanceUid].ToString());
                DirectoryInfo dir  = new DirectoryInfo(path);
                if (dir.Parent != null)
                {
                    CreateDirectoryCommand mkdir = new CreateDirectoryCommand(dir.Parent.FullName);
                    processor.AddCommand(mkdir);
                }

                SaveDicomFileCommand saveFileCommand = new SaveDicomFileCommand(path, file, true);
                processor.AddCommand(saveFileCommand);

                InsertSIQCommand updateStudyCommand = new InsertSIQCommand(_context.StudyLocation, reason, file, _context.Group, reconcileStorage);
                processor.AddCommand(updateStudyCommand);

                if (uid != null)
                {
                    processor.AddCommand(new DeleteWorkQueueUidCommand(uid));
                }

                if (processor.Execute() == false)
                {
                    throw new ApplicationException(String.Format("Unable to schedule image reconcilation : {0}", processor.FailureReason), processor.FailureException);
                }
            }
        }
Example #3
0
 /// <summary>
 /// Creates an instance of <see cref="InsertSIQCommand"/> to insert a <see cref="StudyIntegrityQueue"/> entry
 /// for a <see cref="DicomFile"/>
 /// </summary>
 /// <param name="studyStorage">The <see cref="StudyStorageLocation"/> of the study</param>
 /// <param name="reason">A <see cref="StudyIntegrityReasonEnum"/> value indicating the type of <see cref="StudyIntegrityQueue"/> entry to be inserted.</param>
 /// <param name="file">The DICOM file that needs to be reconciled</param>
 /// <param name="uidGroup">The string value representing the group of images which the DICOM <paramref name="file"/> belongs to</param>
 /// <param name="reconcileImageStorage">The <see cref="ReconcileStorage"/> where the DICOM file will be stored.</param>
 public InsertSIQCommand(
     StudyStorageLocation studyStorage, 
     StudyIntegrityReasonEnum reason, 
     DicomFile file,
     string uidGroup,
     ReconcileStorage reconcileImageStorage
     )
     :base("Insert SIQ Command")
 {
     _storageLocation = studyStorage;
     _reconcileImageStorage = reconcileImageStorage;
     _reason = reason;
     _file = file;
     _uidGroup = uidGroup;
 }
Example #4
0
        /// <summary>
        /// Inserts a <see cref="StudyIntegrityQueue"/> entry for manual reconciliation.
        /// </summary>
        /// <param name="file">The DICOM file that needs to be reconciled.</param>
        /// <param name="reason">The type of <see cref="StudyIntegrityQueue"/> entry to be inserted.</param>
        /// <param name="uid">A UID to delete on insert.</param>
        /// <remarks>
        /// A copy of the DICOM file will be stored in a special folder allocated for 
        /// reconciliation purpose. The caller is responsible for managing the original copy.
        /// </remarks>
		public void ScheduleReconcile(DicomFile file, StudyIntegrityReasonEnum reason, WorkQueueUid uid)
		{
            Platform.CheckForNullReference(_context.StudyLocation, "_context.StudyLocation");
          
            Platform.Log(LogLevel.Info, "Scheduling new manual reconciliation for SOP {0}", file.MediaStorageSopInstanceUid);
            ServerFilesystemInfo fs = FilesystemMonitor.Instance.GetFilesystemInfo(_context.StudyLocation.FilesystemKey);
            Platform.CheckForNullReference(fs, "fs");
            
            ReconcileStorage reconcileStorage = new ReconcileStorage(_context.StudyLocation, _context.Group); 

            using(ServerCommandProcessor processor = new ServerCommandProcessor("Schedule Manual Reconciliation"))
            {
            	string path = reconcileStorage.GetSopInstancePath(file.DataSet[DicomTags.SopInstanceUid].ToString());
                DirectoryInfo dir = new DirectoryInfo(path);
				if (dir.Parent != null)
				{
					CreateDirectoryCommand mkdir = new CreateDirectoryCommand(dir.Parent.FullName);
					processor.AddCommand(mkdir);
				}

            	SaveDicomFileCommand saveFileCommand = new SaveDicomFileCommand(path, file, true);
                processor.AddCommand(saveFileCommand);

                InsertSIQCommand updateStudyCommand = new InsertSIQCommand(_context.StudyLocation, reason, file, _context.Group, reconcileStorage);
                processor.AddCommand(updateStudyCommand);

				if (uid != null)
					processor.AddCommand(new DeleteWorkQueueUidCommand(uid));

                if (processor.Execute() == false)
                {
                    throw new ApplicationException(String.Format("Unable to schedule image reconcilation : {0}", processor.FailureReason), processor.FailureException);
                }
            }
		}