All files / dicomImageLoader/src/imageLoader/wadors/metaData extractPositioningFromMetadata.ts

75% Statements 6/8
75% Branches 6/8
100% Functions 2/2
75% Lines 6/8

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                              100343x           100343x         100343x                     100343x       100343x       100343x        
import getNumberValues from './getNumberValues';
import {
  extractOrientationFromNMMultiframeMetadata,
  extractPositionFromNMMultiframeMetadata,
  isNMModality,
} from './NMHelpers';
 
/**
 * Extract orientation information from a metadata. It tries to get the orientation
 * from the Detector Information Sequence (for NM images) if image type equal
 * to RECON TOMO or RECON GATED TOMO
 * @param {*} metaData
 * @returns
 */
function extractOrientationFromMetadata(metaData) {
  let imageOrientationPatient = getNumberValues(metaData['00200037'], 6);
 
  // If orientation not valid to this point, trying to get the orientation
  // from the Detector Information Sequence (for NM images) with image type
  // equal to RECON TOMO or RECON GATED TOMO
 
  Iif (!imageOrientationPatient && isNMModality(metaData)) {
    imageOrientationPatient =
      extractOrientationFromNMMultiframeMetadata(metaData);
  }
 
  return imageOrientationPatient;
}
 
/**
 * Extract position information from a metaData. It tries to get the position
 * from the Detector Information Sequence (for NM images) if image type equal
 * to RECON TOMO or RECON GATED TOMO
 * @param {*} metaData
 * @returns
 */
function extractPositionFromMetadata(metaData) {
  let imagePositionPatient = getNumberValues(metaData['00200032'], 3);
 
  // If position not valid to this point, trying to get the position
  // from the Detector Information Sequence (for NM images)
  Iif (!imagePositionPatient && isNMModality(metaData)) {
    imagePositionPatient = extractPositionFromNMMultiframeMetadata(metaData);
  }
 
  return imagePositionPatient;
}
 
export { extractOrientationFromMetadata, extractPositionFromMetadata };