Exemplo n.º 1
0
        /// <summary>
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        /// <remarks>
        /// The reconciliation commands should be specified in <ImageCommands> node.
        /// </remarks>
        public IReconcileProcessor Parse(XmlDocument doc)
        {
            //TODO: Validate the xml
            Platform.CheckForNullReference(doc, "doc");

            if (doc.DocumentElement != null)
            {
                StudyReconcileDescriptorParser parser = new StudyReconcileDescriptorParser();
                StudyReconcileDescriptor       desc   = parser.Parse(doc);
                switch (desc.Action)
                {
                case StudyReconcileAction.CreateNewStudy: return(new ReconcileCreateStudyProcessor());

                case StudyReconcileAction.Discard: return(new DiscardImageCommandProcessor());

                case StudyReconcileAction.Merge: return(new MergeStudyCommandProcessor());

                case StudyReconcileAction.ProcessAsIs: return(new ReconcileProcessAsIsProcessor());

                default:
                    throw new NotSupportedException(String.Format("Reconcile Action: {0}", desc.Action));
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        public static ReconcileHistoryRecord ReadReconcileRecord(StudyHistory historyRecord)
        {
            Platform.CheckTrue(historyRecord.StudyHistoryTypeEnum == StudyHistoryTypeEnum.StudyReconciled,
                               "History record has invalid history record type");

            ReconcileHistoryRecord record = new ReconcileHistoryRecord();
            record.InsertTime = historyRecord.InsertTime;
            record.StudyStorageLocation = StudyStorageLocation.FindStorageLocations(StudyStorage.Load(historyRecord.StudyStorageKey))[0];
            StudyReconcileDescriptorParser parser = new StudyReconcileDescriptorParser();
            record.UpdateDescription = parser.Parse(historyRecord.ChangeDescription);
            return record;
        }
		/// <summary>
		/// </summary>
		/// <param name="doc"></param>
		/// <returns></returns>
		/// <remarks>
		/// The reconciliation commands should be specified in <ImageCommands> node.
		/// </remarks>
		public IReconcileProcessor Parse(XmlDocument doc)
		{
			//TODO: Validate the xml
			Platform.CheckForNullReference(doc, "doc");

			if (doc.DocumentElement!=null)
			{
				StudyReconcileDescriptorParser parser = new StudyReconcileDescriptorParser();
				StudyReconcileDescriptor desc = parser.Parse(doc);
				switch(desc.Action)
				{
					case StudyReconcileAction.CreateNewStudy: return new ReconcileCreateStudyProcessor();
					case StudyReconcileAction.Discard: return new DiscardImageCommandProcessor();
					case StudyReconcileAction.Merge: return new MergeStudyCommandProcessor();
					case StudyReconcileAction.ProcessAsIs: return new ReconcileProcessAsIsProcessor();
					default:
						throw new NotSupportedException(String.Format("Reconcile Action: {0}", desc.Action));
				}
                
			}

			return null;
		}
Exemplo n.º 4
0
        private AutoReconcilerResult ApplyHistories(DicomFile file, IList<StudyHistory> histories)
        {
            Platform.CheckForNullReference(file, "file");
            Platform.CheckForNullReference(histories, "histories");

            AutoReconcilerResult preProcessingResult = null;

            StudyHistory lastHistory = histories[0];
            StudyReconcileDescriptorParser parser = new StudyReconcileDescriptorParser();
            StudyReconcileDescriptor changeLog = parser.Parse(lastHistory.ChangeDescription);

            switch (changeLog.Action)
            {
                case StudyReconcileAction.CreateNewStudy:
                case StudyReconcileAction.Merge:
                    if (lastHistory.DestStudyStorageKey != null)
                        preProcessingResult = MergeImage(changeLog.Action, file, lastHistory);
                    break;

                case StudyReconcileAction.Discard:
                    preProcessingResult = new AutoReconcilerResult(StudyReconcileAction.Discard) { DiscardImage = true };
                    break;

                case StudyReconcileAction.ProcessAsIs:
                    if (lastHistory.DestStudyStorageKey != null)
                    {
                        preProcessingResult = ProcessImageAsIs(file, lastHistory);
                    }
                    break;

                default:
                    throw new NotImplementedException();
            }
            return preProcessingResult;
        }