All files / metadata/src/displayset isWsiInstance.ts

25% Statements 1/4
0% Branches 0/4
0% Functions 0/1
25% Lines 1/4

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      128x                                      
import type { NaturalizedInstance } from './types';
 
// VL Whole Slide Microscopy Image Storage.
const WSI_SOP_CLASS_UIDS = new Set(['1.2.840.10008.5.1.4.1.1.77.1.6']);
 
/**
 * Returns true when the instance is whole-slide microscopy imaging - either the
 * VL Whole Slide Microscopy Image Storage SOP class or modality `SM`. Heuristic
 * aligned with OHIF's whole-slide microscopy SOP class handler; the default
 * split rules use it to group all microscopy levels of a series into a single
 * whole-slide display set.
 *
 * @param instance - the naturalized DICOM instance to classify.
 * @returns true if the instance is a whole-slide microscopy image.
 */
export function isWsiInstance(instance: NaturalizedInstance): boolean {
  if (WSI_SOP_CLASS_UIDS.has(instance.SOPClassUID ?? '')) {
    return true;
  }
 
  return instance.Modality === 'SM';
}