Skip to content

Commit

Permalink
Generalize Attribute Coercion and enable to apply multiple matching A…
Browse files Browse the repository at this point in the history
…ttribute Coercions in configurable order #2967
  • Loading branch information
gunterze committed Nov 10, 2021
1 parent 24a874c commit 2b28c7d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,6 @@ private void putMatchTo(

@Override
public ArchiveAttributeCoercion getArchiveAttributeCoercion(RetrieveContext ctx, InstanceLocations inst) {
if (ctx.isUpdateSeriesMetadata()) {
return null;
}
ArchiveAEExtension aeExt = ctx.getArchiveAEExtension();
ArchiveAttributeCoercion rule = aeExt.findAttributeCoercion(
Dimse.C_STORE_RQ,
Expand Down Expand Up @@ -958,9 +955,6 @@ private AttributesCoercion uidRemap(InstanceLocations inst, AttributesCoercion n

private AttributesCoercion coercion(RetrieveContext ctx, InstanceLocations inst, ArchiveAttributeCoercion rule) {
Attributes instAttributes = inst.getAttributes();
if (ctx.isUpdateSeriesMetadata())
return new MergeAttributesCoercion(instAttributes, new SeriesMetadataAttributeCoercion(ctx, inst));

if (rule == null)
return new MergeAttributesCoercion(instAttributes, AttributesCoercion.NONE);

Expand Down Expand Up @@ -1108,7 +1102,17 @@ public Attributes loadMetadata(RetrieveContext ctx, InstanceLocations inst)
if (attrs == null)
attrs = loadMetadataFromDicomFile(ctx, inst);

getAttributesCoercion(ctx, inst).coerce(attrs, null);
if (ctx.isUpdateSeriesMetadata()) {
UIDMap uidMap = inst.getLocations().get(0).getUidMap();
if (uidMap != null) {
UIDUtils.remapUIDs(attrs, uidMap.getUIDMap());
}
Attributes.unifyCharacterSets(attrs, inst.getAttributes());
attrs.addAll(inst.getAttributes());
coerceSeriesMetadata(ctx, inst, attrs);
} else {
getAttributesCoercion(ctx, inst).coerce(attrs, null);
}
return attrs;
}

Expand Down

This file was deleted.

0 comments on commit 2b28c7d

Please sign in to comment.