public IList <BaseImageLevelUpdateCommand> BuildCommands <TMappingObject>(StudyStorageLocation storageLocation, IDicomAttributeProvider originalDicomAttributeProvider)
        {
            StudyXml studyXml = GetStudyXml(storageLocation);
            List <BaseImageLevelUpdateCommand> commandList = new List <BaseImageLevelUpdateCommand>();

            if (studyXml.NumberOfStudyRelatedInstances == 0)
            {
                // StudyXml is empty, resort to the db instead.
                Study study = storageLocation.LoadStudy(ServerExecutionContext.Current.PersistenceContext);
                IList <BaseImageLevelUpdateCommand> cmds = BuildCommandsFromEntity(study, originalDicomAttributeProvider);

                // find the original values from originalDicomAttributeProvider
                if (originalDicomAttributeProvider != null)
                {
                    foreach (BaseImageLevelUpdateCommand cmd in cmds)
                    {
                        IUpdateImageTagCommand theCmd = cmd;
                        if (theCmd != null)
                        {
                            DicomAttribute attribute;
                            if (originalDicomAttributeProvider.TryGetAttribute(theCmd.UpdateEntry.TagPath.Tag, out attribute))
                            {
                                theCmd.UpdateEntry.OriginalValue = attribute.ToString();
                            }
                        }
                    }
                }

                commandList.AddRange(cmds);
            }
            else
            {
                commandList.AddRange(BuildCommandsFromStudyXml(typeof(TMappingObject), studyXml, originalDicomAttributeProvider));
            }

            return(commandList);
        }
Beispiel #2
0
 /// <summary>
 /// Creates an instance of <see cref="UpdateItem"/>
 /// </summary>
 /// <param name="command"></param>
 /// <param name="file"></param>
 public UpdateItem(IUpdateImageTagCommand command, DicomFile file)
 {
     _tag           = command.UpdateEntry.TagPath.Tag;
     _originalValue = file.DataSet[Tag].ToString();
     _newValue      = command.UpdateEntry.Value != null?command.UpdateEntry.Value.ToString() : String.Empty;
 }
Beispiel #3
0
 /// <summary>
 /// Creates an instance of <see cref="UpdateItem"/>
 /// </summary>
 /// <param name="command"></param>
 /// <param name="file"></param>
 public UpdateItem(IUpdateImageTagCommand command, DicomFile file)
 {
     _tag = command.UpdateEntry.TagPath.Tag;
     _originalValue = file.DataSet[Tag].ToString();
     _newValue = command.UpdateEntry.Value != null ? command.UpdateEntry.Value.ToString() : String.Empty;
 }