Skip to content

TrackingIdentifier constructor calls super(options) and injects raw options into the ContentSequence #434

Open
@nr59684

Description

@nr59684

🐛 Bug Report

Reproduction Steps

  1. Draw one or more ROIs in the Slim viewer (each gets a generated roi.uid).
  2. Click on Save ROI in SlideViewer which calls handleReportGeneration()
  3. Observe console error:
Image
Uncaught Error: Option 'trackingIdentifier' must include a human readable tracking identifier and a tracking unique identifier.
  1. console.log(trackingIdentifier) shows an array of three entries:
    [
      { "uid": "", "identifier": "ROI #1" },        ← raw options object
      { /* TextContentItem for identifier */ },
      { /* UIDRefContentItem for uid */ }
    ]

What’s Happening

As you can see in the above image. In templates.js (in the dcmjs-sr-templates ), at line 904 the length of array TrackingIdentifier is expected to be 2:

if (options.trackingIdentifier.length !== 2) {
            throw new Error(
                "Option 'trackingIdentifier' must include a human readable tracking " +
                    "identifier and a tracking unique identifier."
            );
        }

and the source of error lies in same templates.js (in the dcmjs-sr-templates ), at line 1556

1554   class TrackingIdentifier extends Template {
1555   constructor(options) {
1556   super(options);    // <-- pushes the raw options object into `this`
1557   // …then pushes the two ContentItems…
}

Because Template extends an array, super(options) adds the plain {uid, identifier} object as the first sequence item. Downstream code expects exactly two items (TEXT + UIDREF), so it throws.

Expected Behavior

  • TrackingIdentifier should only produce:

    1. A TextContentItem (if options.identifier is provided)
    2. A UIDRefContentItem (for options.uid)
  • No extra plain-object entry should appear.

Proposed Fix

In templates.js, change:

- constructor(options) {
-   super(options);
+ constructor(options) {
+   super();

after implementing this change, the issue was resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions