Initial work on Nucleus parity merge
This commit is contained in:
1 parent
aa88fe181a
commit
680beb163f
38 files changed
+4353
-1
No files matched your search
@@ -0,0 +1,100 @@
|
||||
import { getElementIfNotEmpty } from './getElementIfNotEmpty';
|
||||
|
||||
const getPatient = function(property) {
|
||||
if (!this.imageId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const patient = cornerstoneTools.metaData.get('patient', this.imageId);
|
||||
if (!patient) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return patient[property];
|
||||
};
|
||||
|
||||
const getStudy = function(property) {
|
||||
if (!this.imageId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const study = cornerstoneTools.metaData.get('study', this.imageId);
|
||||
if (!study) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return study[property];
|
||||
};
|
||||
|
||||
const getSeries = function(property) {
|
||||
if (!this.imageId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const series = cornerstoneTools.metaData.get('series', this.imageId);
|
||||
if (!series) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return series[property];
|
||||
};
|
||||
|
||||
const getInstance = function(property) {
|
||||
if (!this.imageId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const instance = cornerstoneTools.metaData.get('instance', this.imageId);
|
||||
if (!instance) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return instance[property];
|
||||
};
|
||||
|
||||
const getTagDisplay = function(property) {
|
||||
if (!this.imageId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const instance = cornerstoneTools.metaData.get('tagDisplay', this.imageId);
|
||||
if (!instance) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return instance[property];
|
||||
};
|
||||
|
||||
const getImage = function(viewportIndex) {
|
||||
const element = getElementIfNotEmpty(viewportIndex);
|
||||
if (!element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let enabledElement;
|
||||
try {
|
||||
enabledElement = cornerstone.getEnabledElement(element);
|
||||
} catch(error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!enabledElement || !enabledElement.image) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return enabledElement.image;
|
||||
};
|
||||
|
||||
const formatDateTime = (date, time) => `${date} ${time}`;
|
||||
|
||||
const viewportOverlayUtils = {
|
||||
getPatient,
|
||||
getStudy,
|
||||
getSeries,
|
||||
getInstance,
|
||||
getTagDisplay,
|
||||
getImage,
|
||||
formatDateTime
|
||||
};
|
||||
|
||||
export { viewportOverlayUtils };
|
||||
Reference in new issue
Block a user