コード例 #1
0
ファイル: UpdateHistoryCommand.cs プロジェクト: nhannd/Xian
	    public UpdateHistorySeriesMappingCommand(StudyHistory studyHistory, StudyStorageLocation destStudy, UidMapper map) 
            : base("Update Study History Series Mapping")
        {
            _map = map;
            _studyHistory = studyHistory;
            _destStudy = destStudy;
        }
コード例 #2
0
        static public StudyHistory Load(IPersistenceContext read, ServerEntityKey key)
        {
            var          broker    = read.GetBroker <IStudyHistoryEntityBroker>();
            StudyHistory theObject = broker.Load(key);

            return(theObject);
        }
コード例 #3
0
 static public StudyHistory Insert(StudyHistory entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         StudyHistory newEntity = Insert(update, entity);
         update.Commit();
         return(newEntity);
     }
 }
コード例 #4
0
ファイル: StudyHistory.gen.cs プロジェクト: nhannd/Xian
 static public StudyHistory Insert(StudyHistory entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         StudyHistory newEntity = Insert(update, entity);
         update.Commit();
         return newEntity;
     }
 }
コード例 #5
0
ファイル: StudyHistoryDecoder.cs プロジェクト: nhannd/Xian
        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;
        }
コード例 #6
0
        static public StudyHistory Insert(IUpdateContext update, StudyHistory entity)
        {
            var broker        = update.GetBroker <IStudyHistoryEntityBroker>();
            var updateColumns = new StudyHistoryUpdateColumns();

            updateColumns.InsertTime           = entity.InsertTime;
            updateColumns.StudyStorageKey      = entity.StudyStorageKey;
            updateColumns.StudyHistoryTypeEnum = entity.StudyHistoryTypeEnum;
            updateColumns.StudyData            = entity.StudyData;
            updateColumns.ChangeDescription    = entity.ChangeDescription;
            updateColumns.DestStudyStorageKey  = entity.DestStudyStorageKey;
            StudyHistory newEntity = broker.Insert(updateColumns);

            return(newEntity);
        }
コード例 #7
0
 private static IStudyHistoryColumnControlFactory GetColumnControlFactory(StudyHistory record)
 {
     if (record.StudyHistoryTypeEnum == StudyHistoryTypeEnum.StudyReconciled)
         return new ReconcileStudyRendererFactory();
     else if (record.StudyHistoryTypeEnum == StudyHistoryTypeEnum.WebEdited || record.StudyHistoryTypeEnum == StudyHistoryTypeEnum.ExternalEdit)
         return new StudyEditRendererFactory();
     else if (record.StudyHistoryTypeEnum == StudyHistoryTypeEnum.Duplicate)
         return new ProcessDuplicateChangeLogRendererFactory();
     else if (record.StudyHistoryTypeEnum == StudyHistoryTypeEnum.Reprocessed)
         return new StudyReprocessedChangeLogRendererFactory();
     else if (record.StudyHistoryTypeEnum == StudyHistoryTypeEnum.SeriesDeleted)
         return new SeriesDeletionChangeLogRendererFactory();
     else
         return new DefaultStudyHistoryRendererFactory();
 }
コード例 #8
0
ファイル: StudyHistoryDecoder.cs プロジェクト: nhannd/Xian
        public static WebEditStudyHistoryRecord ReadEditRecord(StudyHistory historyRecord)
        {
            Platform.CheckTrue(historyRecord.StudyHistoryTypeEnum == StudyHistoryTypeEnum.WebEdited
                               || historyRecord.StudyHistoryTypeEnum == StudyHistoryTypeEnum.ExternalEdit,
                               "History record has invalid history record type");

            WebEditStudyHistoryRecord record = new WebEditStudyHistoryRecord
                                                   {
                                                       InsertTime = historyRecord.InsertTime,
                                                       StudyStorageLocation =
                                                           StudyStorageLocation.FindStorageLocations(
                                                               StudyStorage.Load(historyRecord.StudyStorageKey))[0],
                                                       UpdateDescription =
                                                           XmlUtils.Deserialize<WebEditStudyHistoryChangeDescription>(
                                                               historyRecord.ChangeDescription)
                                                   };
            return record;
        }
コード例 #9
0
 public Control GetChangeDescColumnControl(Control parent, StudyHistory historyRecord)
 {
     DuplicateProcessChangeLog control = parent.Page.LoadControl("~/Pages/Studies/StudyDetails/Controls/DuplicateProcessChangeLog.ascx") as DuplicateProcessChangeLog;
     control.HistoryRecord = historyRecord;
     return control;
 }
コード例 #10
0
 public Control GetChangeDescColumnControl(Control parent, StudyHistory historyRecord)
 {
     SeriesDeleteChangeLog control = parent.Page.LoadControl("~/Pages/Studies/StudyDetails/Controls/SeriesDeleteChangeLog.ascx") as SeriesDeleteChangeLog;
     control.ChangeLog = XmlUtils.Deserialize<SeriesDeletionChangeLog>(historyRecord.ChangeDescription);
     return control;
 }
コード例 #11
0
 static public StudyHistory Insert(IUpdateContext update, StudyHistory entity)
 {
     var broker = update.GetBroker<IStudyHistoryEntityBroker>();
     var updateColumns = new StudyHistoryUpdateColumns();
     updateColumns.InsertTime = entity.InsertTime;
     updateColumns.StudyStorageKey = entity.StudyStorageKey;
     updateColumns.StudyHistoryTypeEnum = entity.StudyHistoryTypeEnum;
     updateColumns.StudyData = entity.StudyData;
     updateColumns.ChangeDescription = entity.ChangeDescription;
     updateColumns.DestStudyStorageKey = entity.DestStudyStorageKey;
     StudyHistory newEntity = broker.Insert(updateColumns);
     return newEntity;
 }
コード例 #12
0
 public Control GetChangeDescColumnControl(Control parent, StudyHistory historyRecord)
 {
     ReconcileHistoryDetailsColumn control = parent.Page.LoadControl("~/Pages/Studies/StudyDetails/Controls/ReconcileHistoryDetailsColumn.ascx") as ReconcileHistoryDetailsColumn;
     control.HistoryRecord = historyRecord;
     return control;
 }
コード例 #13
0
ファイル: AutoReconciler.cs プロジェクト: UIKit0/ClearCanvas
        private AutoReconcilerResult MergeImage(StudyReconcileAction action, DicomFile file, StudyHistory lastHistory)
        {
            string originalSeriesUid = file.DataSet[DicomTags.SeriesInstanceUid].ToString();
            string originalSopUid = file.DataSet[DicomTags.SopInstanceUid].ToString();
            
            AutoReconcilerResult preProcessingResult = null;
        	StudyStorageLocation destStudy;
            UidMapper uidMapper = null;
        	if (lastHistory.DestStudyStorageKey != null)
            {
                StudyStorage destinationStudy = StudyStorage.Load(lastHistory.DestStudyStorageKey);

				//Load the destination.  An exception will be thrown if any issues are encountered.
				FilesystemMonitor.Instance.GetWritableStudyStorageLocation(destinationStudy.ServerPartitionKey,
																		   destinationStudy.StudyInstanceUid, 
																		   StudyRestore.True, StudyCache.True, 
																		   out destStudy);

                EnsureStudyCanBeUpdated(destStudy);

                bool belongsToAnotherStudy = !destStudy.Equals(StorageLocation);

                ImageUpdateCommandBuilder commandBuilder = new ImageUpdateCommandBuilder();
                IList<BaseImageLevelUpdateCommand> commands = commandBuilder.BuildCommands<StudyMatchingMap>(destStudy);
                if (belongsToAnotherStudy)
                {
                    Platform.Log(LogLevel.Info, "AUTO-RECONCILE: Move SOP {0} to Study {1}, A#: {2}, Patient {3}", originalSopUid, destStudy.StudyInstanceUid, destStudy.Study.AccessionNumber, destStudy.Study.PatientsName);

                    // Load the Uid Map, either from cache or from disk
                    if (!_uidMapCache.TryGetValue(destStudy.Key, out uidMapper))
                    {
                        UidMapXml mapXml = new UidMapXml();
                        mapXml.Load(destStudy);
                        uidMapper = new UidMapper(mapXml);

                        _uidMapCache.Add(destStudy.Key, uidMapper);
                    }

                    try
                    {
                        commands.Add(GetUidMappingCommand(StorageLocation, destStudy, uidMapper, originalSopUid, originalSeriesUid));
                    }
                    catch (InstanceAlreadyExistsException ex)
                    {
                        Platform.Log(LogLevel.Info, "An instance already exists with the SOP Instance Uid {0}", ex.SopInstanceUid);
                        preProcessingResult = new AutoReconcilerResult(StudyReconcileAction.Discard) { DiscardImage = true };

                        return preProcessingResult;
                    }
                }


                preProcessingResult = new AutoReconcilerResult(action) { Changes = GetUpdateList(file, commands) };

                UpdateImage(file, commands);

                // First, must update the map
                if (uidMapper != null && uidMapper.Dirty)
                {
                    UpdateUidMap(destStudy, uidMapper);
                }

                if (belongsToAnotherStudy)
                {
                    SopInstanceImporterContext importContext = new SopInstanceImporterContext(_contextID, file.SourceApplicationEntityTitle, destStudy.ServerPartition);
                    SopInstanceImporter importer = new SopInstanceImporter(importContext);
                    DicomProcessingResult result = importer.Import(file);

                    if (!result.Successful)
                    {
                        throw new ApplicationException(result.ErrorMessage);
                    }
                }


            }
            return preProcessingResult;
        }
コード例 #14
0
ファイル: AutoReconciler.cs プロジェクト: UIKit0/ClearCanvas
        private AutoReconcilerResult ProcessImageAsIs(DicomFile file, StudyHistory lastHistory)
        {
            StudyStorage destinationStudy = StudyStorage.Load(lastHistory.DestStudyStorageKey);
        	StudyStorageLocation destStudy;
            AutoReconcilerResult preProcessingResult = new AutoReconcilerResult(StudyReconcileAction.ProcessAsIs);

			//Load the destination.  An exception will be thrown if any issues are encountered.
        	FilesystemMonitor.Instance.GetWritableStudyStorageLocation(destinationStudy.ServerPartitionKey,
        	                                                           destinationStudy.StudyInstanceUid, StudyRestore.True,
        	                                                           StudyCache.True, out destStudy);

            bool belongsToAnotherStudy = !destStudy.Equals(StorageLocation);

            EnsureStudyCanBeUpdated(destStudy);

            if (belongsToAnotherStudy)
            {
                preProcessingResult.Changes = new List<UpdateItem>
                                                  {
                                                      new UpdateItem(DicomTags.StudyInstanceUid, file.DataSet[DicomTags.StudyInstanceUid].ToString(), destStudy.StudyInstanceUid)
                                                  };

                file.DataSet[DicomTags.StudyInstanceUid].SetStringValue(destStudy.StudyInstanceUid);
                SopInstanceImporterContext importContext = new SopInstanceImporterContext(
                    _contextID,
                    file.SourceApplicationEntityTitle, destStudy.ServerPartition);
                SopInstanceImporter importer = new SopInstanceImporter(importContext);
                DicomProcessingResult result = importer.Import(file);

                if (!result.Successful)
                {
                    throw new ApplicationException("Unable to import image to destination study");
                }
            }
            return preProcessingResult;
        }
コード例 #15
0
 public Control GetChangeDescColumnControl(Control parent, StudyHistory historyRecord)
 {
     Label lb = new Label();
     lb.Text = XmlUtils.GetXmlDocumentAsString(historyRecord.ChangeDescription, true);
     return lb;
 }
コード例 #16
0
        public Control GetChangeDescColumnControl(Control parent, StudyHistory historyRecord)
        {
			var control = parent.Page.LoadControl("~/Pages/Studies/StudyDetails/Controls/CompressionHistory.ascx") as CompressionHistory;
            control.CompressHistory = XmlUtils.Deserialize<CompressionStudyHistory>(historyRecord.ChangeDescription);
            return control;
        }