slim icon indicating copy to clipboard operation
slim copied to clipboard

Viewer does not support long coding values

Open Philbrick opened this issue 2 years ago • 1 comments

Slim expects concept values to be encoded in the "CodeValue" tag. Standard indicates "CodeValue" tags should be used for values <= 16 characters and "LongCodeValue" tag should be used for values which exceed 16 characters. Slim currently throws an exception indicating the value is missing. Slim should check LongCodeValue if CodeValue is not defined.

Philbrick avatar May 10 '22 15:05 Philbrick

Thank you for reporting the issue @Philbrick.

Unfortunately, this is something we have ignored throughout the application and the underlying libraries.

I would suggest implementing a function in utils.sr for getting the code value and then use that throughout the application:

const getCodeValue = (codedConcept: dmv.metadata.CodedConcept): string => {
  if (codedConcept.CodeValue) {
    return codedConcept.CodeValue
  } else if (codedConcept.LongCodeValue) {
    return codedConcept.LongCodeValue
  } else {
    return codedConcept.URNCodeValue
  }
}

We will also have to update the type annotations in types/dicom-microscopy-viewer/index.ts and introduce a new type, which we can reuse throughout the application:

  declare namespace metadata {
    
    export interface CodedConcept {
      CodeValues?: string
      LongCodeValue?: string
      URNCodeValue?: string
      CodeMeaning: string
      CodingSchemeDesignator
    }

    ...
  }

We should also change the logic in dcmjs.sr.coding.CodedConcept and handle the different types of code values in the value getter. See the corresponding Python implementation highdicom.sr.coding.CodedConcept.

hackermd avatar May 11 '22 12:05 hackermd