private void UpdateDicomFile(DicomFile file)
{
var originalCS = file.DataSet.SpecificCharacterSet;
var sq = new OriginalAttributesSequence
{
ModifiedAttributesSequence = new DicomSequenceItem(),
ModifyingSystem = ProductInformation.Component,
ReasonForTheAttributeModification = "CORRECT",
AttributeModificationDatetime = Platform.Time,
SourceOfPreviousValues = file.SourceApplicationEntityTitle
};
foreach (BaseImageLevelUpdateCommand command in _commands)
{
command.File = file;
command.Apply(file, sq);
}
var sqAttrib = file.DataSet[DicomTags.OriginalAttributesSequence] as DicomAttributeSQ;
if (sqAttrib != null)
sqAttrib.AddSequenceItem(sq.DicomSequenceItem);
var newCS = file.DataSet.SpecificCharacterSet;
if (!string.Equals(originalCS, newCS))
{
if (Platform.IsLogLevelEnabled(ServerPlatform.InstanceLogLevel))
{
Platform.Log(ServerPlatform.InstanceLogLevel, "Specific Character Set for SOP {0} has been updated [{1}->{2}]",
file.MediaStorageSopInstanceUid, originalCS, newCS);
}
if (!Common.Settings.Default.AllowedConvertToUnicodeOnEdit)
{
Platform.Log(LogLevel.Warn, "File was converted to unicode but AllowedConvertToUnicodeOnEdit is false");
}
atLeastOneFileUpdatedToUTF8 = atLeastOneFileUpdatedToUTF8 || IsUTF8(newCS);
}
SaveFile(file);
}