fix: Add support for single entries in SequenceOfUltrasoundRegions. M… (#1559)
* fix: Add support for single entries in SequenceOfUltrasoundRegions. More than one region will need lower-level changes * Update platform/core/src/utils/metadataProvider/getPixelSpacingInformation.js Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
This commit is contained in:
parent
16866a47a0
commit
c1a0d3c662
@ -19,45 +19,53 @@ export default function getPixelSpacingInformation(instance) {
|
|||||||
'1.2.840.10008.5.1.4.1.1.12.1.1', // Enhanced XA Image Storage
|
'1.2.840.10008.5.1.4.1.1.12.1.1', // Enhanced XA Image Storage
|
||||||
'1.2.840.10008.5.1.4.1.1.12.2', // X-Ray Radiofluoroscopic Image Storage
|
'1.2.840.10008.5.1.4.1.1.12.2', // X-Ray Radiofluoroscopic Image Storage
|
||||||
'1.2.840.10008.5.1.4.1.1.12.2.1', // Enhanced XRF Image Storage
|
'1.2.840.10008.5.1.4.1.1.12.2.1', // Enhanced XRF Image Storage
|
||||||
'1.2.840.10008.5.1.4.1.1.12.3' // X-Ray Angiographic Bi-plane Image Storage Retired
|
'1.2.840.10008.5.1.4.1.1.12.3', // X-Ray Angiographic Bi-plane Image Storage Retired
|
||||||
];
|
];
|
||||||
|
|
||||||
const { PixelSpacing, ImagerPixelSpacing, SOPClassUID, PixelSpacingCalibrationType, PixelSpacingCalibrationDescription, EstimatedRadiographicMagnificationFactor } = instance;
|
const {
|
||||||
|
PixelSpacing,
|
||||||
|
ImagerPixelSpacing,
|
||||||
|
SOPClassUID,
|
||||||
|
PixelSpacingCalibrationType,
|
||||||
|
PixelSpacingCalibrationDescription,
|
||||||
|
EstimatedRadiographicMagnificationFactor,
|
||||||
|
SequenceOfUltrasoundRegions,
|
||||||
|
} = instance;
|
||||||
const isProjection = projectionRadiographSOPClassUIDs.includes(SOPClassUID);
|
const isProjection = projectionRadiographSOPClassUIDs.includes(SOPClassUID);
|
||||||
|
|
||||||
const TYPES = {
|
const TYPES = {
|
||||||
NOT_APPLICABLE: 'NOT_APPLICABLE',
|
NOT_APPLICABLE: 'NOT_APPLICABLE',
|
||||||
UNKNOWN: 'UNKNOWN',
|
UNKNOWN: 'UNKNOWN',
|
||||||
CALIBRATED: 'CALIBRATED',
|
CALIBRATED: 'CALIBRATED',
|
||||||
DETECTOR: 'DETECTOR'
|
DETECTOR: 'DETECTOR',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isProjection === false && !ImagerPixelSpacing) {
|
if (isProjection && !ImagerPixelSpacing) {
|
||||||
// If only Pixel Spacing is present, and this is not a projection radiograph,
|
|
||||||
// we can stop here
|
|
||||||
return {
|
|
||||||
PixelSpacing,
|
|
||||||
type: TYPES.NOT_APPLICABLE,
|
|
||||||
isProjection
|
|
||||||
};
|
|
||||||
} else if (isProjection && !ImagerPixelSpacing) {
|
|
||||||
// If only Pixel Spacing is present, and this is a projection radiograph,
|
// If only Pixel Spacing is present, and this is a projection radiograph,
|
||||||
// PixelSpacing should be used, but the user should be informed that
|
// PixelSpacing should be used, but the user should be informed that
|
||||||
// what it means is unknown
|
// what it means is unknown
|
||||||
return {
|
return {
|
||||||
PixelSpacing,
|
PixelSpacing,
|
||||||
type: TYPES.UNKNOWN,
|
type: TYPES.UNKNOWN,
|
||||||
isProjection
|
isProjection,
|
||||||
};
|
};
|
||||||
} else if (PixelSpacing && ImagerPixelSpacing && PixelSpacing === ImagerPixelSpacing) {
|
} else if (
|
||||||
|
PixelSpacing &&
|
||||||
|
ImagerPixelSpacing &&
|
||||||
|
PixelSpacing === ImagerPixelSpacing
|
||||||
|
) {
|
||||||
// If Imager Pixel Spacing and Pixel Spacing are present and they have the same values,
|
// If Imager Pixel Spacing and Pixel Spacing are present and they have the same values,
|
||||||
// then the user should be informed that the measurements are at the detector plane
|
// then the user should be informed that the measurements are at the detector plane
|
||||||
return {
|
return {
|
||||||
PixelSpacing,
|
PixelSpacing,
|
||||||
type: TYPES.DETECTOR,
|
type: TYPES.DETECTOR,
|
||||||
isProjection
|
isProjection,
|
||||||
};
|
};
|
||||||
} else if (PixelSpacing && ImagerPixelSpacing && PixelSpacing !== ImagerPixelSpacing) {
|
} else if (
|
||||||
|
PixelSpacing &&
|
||||||
|
ImagerPixelSpacing &&
|
||||||
|
PixelSpacing !== ImagerPixelSpacing
|
||||||
|
) {
|
||||||
// If Imager Pixel Spacing and Pixel Spacing are present and they have different values,
|
// If Imager Pixel Spacing and Pixel Spacing are present and they have different values,
|
||||||
// then the user should be informed that these are "calibrated"
|
// then the user should be informed that these are "calibrated"
|
||||||
// (in some unknown manner if Pixel Spacing Calibration Type and/or
|
// (in some unknown manner if Pixel Spacing Calibration Type and/or
|
||||||
@ -67,7 +75,7 @@ export default function getPixelSpacingInformation(instance) {
|
|||||||
type: TYPES.CALIBRATED,
|
type: TYPES.CALIBRATED,
|
||||||
isProjection,
|
isProjection,
|
||||||
PixelSpacingCalibrationType,
|
PixelSpacingCalibrationType,
|
||||||
PixelSpacingCalibrationDescription
|
PixelSpacingCalibrationDescription,
|
||||||
};
|
};
|
||||||
} else if (!PixelSpacing && ImagerPixelSpacing) {
|
} else if (!PixelSpacing && ImagerPixelSpacing) {
|
||||||
let CorrectedImagerPixelSpacing = ImagerPixelSpacing;
|
let CorrectedImagerPixelSpacing = ImagerPixelSpacing;
|
||||||
@ -75,16 +83,48 @@ export default function getPixelSpacingInformation(instance) {
|
|||||||
// Note that in IHE Mammo profile compliant displays, the value of Imager Pixel Spacing is required to be corrected by
|
// Note that in IHE Mammo profile compliant displays, the value of Imager Pixel Spacing is required to be corrected by
|
||||||
// Estimated Radiographic Magnification Factor and the user informed of that.
|
// Estimated Radiographic Magnification Factor and the user informed of that.
|
||||||
// TODO: should this correction be done before all of this logic?
|
// TODO: should this correction be done before all of this logic?
|
||||||
CorrectedImagerPixelSpacing = ImagerPixelSpacing.map(pixelSpacing => pixelSpacing / EstimatedRadiographicMagnificationFactor);
|
CorrectedImagerPixelSpacing = ImagerPixelSpacing.map(
|
||||||
|
pixelSpacing => pixelSpacing / EstimatedRadiographicMagnificationFactor
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
log.info('EstimatedRadiographicMagnificationFactor was not present. Unable to correct ImagerPixelSpacing.');
|
log.info(
|
||||||
|
'EstimatedRadiographicMagnificationFactor was not present. Unable to correct ImagerPixelSpacing.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
PixelSpacing: CorrectedImagerPixelSpacing,
|
PixelSpacing: CorrectedImagerPixelSpacing,
|
||||||
isProjection,
|
isProjection,
|
||||||
};
|
};
|
||||||
|
} else if (
|
||||||
|
SequenceOfUltrasoundRegions &&
|
||||||
|
typeof SequenceOfUltrasoundRegions === 'object'
|
||||||
|
) {
|
||||||
|
const { PhysicalDeltaX, PhysicalDeltaY } = SequenceOfUltrasoundRegions;
|
||||||
|
const USPixelSpacing = [PhysicalDeltaX * 10, PhysicalDeltaY * 10];
|
||||||
|
|
||||||
|
return {
|
||||||
|
PixelSpacing: USPixelSpacing,
|
||||||
|
};
|
||||||
|
} else if (
|
||||||
|
SequenceOfUltrasoundRegions &&
|
||||||
|
Array.isArray(SequenceOfUltrasoundRegions) &&
|
||||||
|
SequenceOfUltrasoundRegions.length > 1
|
||||||
|
) {
|
||||||
|
log.warn(
|
||||||
|
'Sequence of Ultrasound Regions > one entry. This is not yet implemented, all measurements will be shown in pixels.'
|
||||||
|
);
|
||||||
|
} else if (isProjection === false && !ImagerPixelSpacing) {
|
||||||
|
// If only Pixel Spacing is present, and this is not a projection radiograph,
|
||||||
|
// we can stop here
|
||||||
|
return {
|
||||||
|
PixelSpacing,
|
||||||
|
type: TYPES.NOT_APPLICABLE,
|
||||||
|
isProjection,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info('Unknown combination of PixelSpacing and ImagerPixelSpacing identified. Unable to determine spacing.');
|
log.info(
|
||||||
|
'Unknown combination of PixelSpacing and ImagerPixelSpacing identified. Unable to determine spacing.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user