Making getImagePlane work with IntanceMetadata. This would fix some features that depend on imagePlane such as Link Series
This commit is contained in:
parent
6003f67865
commit
47db6bcb05
@ -130,25 +130,26 @@ const updateMetaData = image => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs and returns the imagePlane given the instance
|
||||
* Constructs and returns the imagePlane given the metadata instance
|
||||
*
|
||||
* @param instance The instance containing information to construct imagePlane
|
||||
* @param metadataInstance The metadata instance (InstanceMetadata class) containing information to construct imagePlane
|
||||
* @returns imagePlane The constructed imagePlane to be used in viewer easily
|
||||
*/
|
||||
function getImagePlane(instance) {
|
||||
function getImagePlane(metadataInstance) {
|
||||
const instance = metadataInstance.getData();
|
||||
if (!instance.rows || !instance.columns || !instance.pixelSpacing ||
|
||||
!instance.frameOfReferenceUID || !instance.imageOrientationPatient ||
|
||||
!instance.imagePositionPatient) {
|
||||
return;
|
||||
}
|
||||
|
||||
let imageOrientation = instance.imageOrientationPatient.split('\\');
|
||||
let imagePosition = instance.imagePositionPatient.split('\\');
|
||||
const imageOrientation = instance.imageOrientationPatient.split('\\');
|
||||
const imagePosition = instance.imagePositionPatient.split('\\');
|
||||
|
||||
let columnPixelSpacing = 1.0;
|
||||
let rowPixelSpacing = 1.0;
|
||||
if (instance.pixelSpacing) {
|
||||
let split = instance.pixelSpacing.split('\\');
|
||||
const split = instance.pixelSpacing.split('\\');
|
||||
rowPixelSpacing = parseFloat(split[0]);
|
||||
columnPixelSpacing = parseFloat(split[1]);
|
||||
}
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Session } from 'meteor/session';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { toolManager } from './toolManager';
|
||||
|
||||
class StackImagePositionOffsetSynchronizer {
|
||||
constructor() {
|
||||
this.active = false;
|
||||
this.syncedViewports = [];
|
||||
this.synchronizer = new cornerstoneTools.Synchronizer("CornerstoneNewImage", cornerstoneTools.stackImagePositionOffsetSynchronizer)
|
||||
this.synchronizer = new cornerstoneTools.Synchronizer('CornerstoneNewImage', cornerstoneTools.stackImagePositionOffsetSynchronizer)
|
||||
}
|
||||
|
||||
static get ELEMENT_DISABLED_EVENT() {
|
||||
@ -190,16 +191,21 @@ class StackImagePositionOffsetSynchronizer {
|
||||
try {
|
||||
const enabledElement = cornerstone.getEnabledElement(element);
|
||||
|
||||
if(!enabledElement || !enabledElement.image) {
|
||||
if(!enabledElement.image) {
|
||||
return;
|
||||
}
|
||||
|
||||
const imageId = enabledElement.image.imageId;
|
||||
const imagePlane = cornerstoneTools.metaData.get('imagePlane', imageId);
|
||||
|
||||
if(!imagePlane || !imagePlane.rowCosines || !imagePlane.columnCosines) {
|
||||
return;
|
||||
}
|
||||
|
||||
return imagePlane.rowCosines.clone().cross(imagePlane.columnCosines);
|
||||
} catch(error) {
|
||||
console.log(error.message);
|
||||
const errorMessage = error.message || error;
|
||||
OHIF.log.info(`StackImagePositionOffsetSynchronizer getViewportImageNormal: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user