All files / metadata/src/displayset isImageInstance.ts

50% Statements 1/2
0% Branches 0/2
0% Functions 0/1
50% Lines 1/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59      128x                                                                                                              
import type { NaturalizedInstance } from './types';
 
/** SOP Class UIDs that represent image storage (aligned with OHIF isImage). */
const IMAGE_STORAGE_SOP_CLASS_UIDS = new Set([
  '1.2.840.10008.5.1.4.1.1.1',
  '1.2.840.10008.5.1.4.1.1.1.1',
  '1.2.840.10008.5.1.4.1.1.1.1.1',
  '1.2.840.10008.5.1.4.1.1.2',
  '1.2.840.10008.5.1.4.1.1.2.1',
  '1.2.840.10008.5.1.4.1.1.2.2',
  '1.2.840.10008.5.1.4.1.1.4',
  '1.2.840.10008.5.1.4.1.1.4.1',
  '1.2.840.10008.5.1.4.1.1.4.2',
  '1.2.840.10008.5.1.4.1.1.4.3',
  '1.2.840.10008.5.1.4.1.1.4.4',
  '1.2.840.10008.5.1.4.1.1.7',
  '1.2.840.10008.5.1.4.1.1.7.1',
  '1.2.840.10008.5.1.4.1.1.7.2',
  '1.2.840.10008.5.1.4.1.1.7.3',
  '1.2.840.10008.5.1.4.1.1.7.4',
  '1.2.840.10008.5.1.4.1.1.12.1',
  '1.2.840.10008.5.1.4.1.1.12.1.1',
  '1.2.840.10008.5.1.4.1.1.12.2',
  '1.2.840.10008.5.1.4.1.1.12.2.1',
  '1.2.840.10008.5.1.4.1.1.13.1.1',
  '1.2.840.10008.5.1.4.1.1.13.1.2',
  '1.2.840.10008.5.1.4.1.1.13.1.3',
  '1.2.840.10008.5.1.4.1.1.13.1.4',
  '1.2.840.10008.5.1.4.1.1.13.1.5',
  '1.2.840.10008.5.1.4.1.1.13.1.6',
  '1.2.840.10008.5.1.4.1.1.128',
  '1.2.840.10008.5.1.4.1.1.77.1.1',
  '1.2.840.10008.5.1.4.1.1.77.1.1.1',
  '1.2.840.10008.5.1.4.1.1.77.1.2',
  '1.2.840.10008.5.1.4.1.1.77.1.2.1',
  '1.2.840.10008.5.1.4.1.1.77.1.3',
  '1.2.840.10008.5.1.4.1.1.77.1.4',
  '1.2.840.10008.5.1.4.1.1.77.1.4.1',
  '1.2.840.10008.5.1.4.1.1.128.1',
  '1.2.840.10008.5.1.4.1.1.128.2',
  '1.2.840.10008.5.1.4.1.1.128.3',
  '1.2.840.10008.5.1.4.1.1.128.4',
  '1.2.840.10008.5.1.4.1.1.128.5',
  '1.2.840.10008.5.1.4.1.1.77.1.6',
]);
 
/**
 * Returns true when the instance is an image storage SOP class (the set OHIF's
 * `isImage` recognizes), i.e. an instance that carries pixel data and can be
 * rendered. Used by the default split rules to keep non-image objects (e.g.
 * presentation states, structured reports) out of image-oriented display sets.
 *
 * @param instance - the naturalized DICOM instance to classify.
 * @returns true when the instance's SOP class is a known image storage class.
 */
export function isImageInstance(instance: NaturalizedInstance): boolean {
  return IMAGE_STORAGE_SOP_CLASS_UIDS.has(instance.SOPClassUID ?? '');
}