Merge branch 'feat/v2-main' into dannyrb/ohif-154/restore-command-functionality-for-toolbar

This commit is contained in:
Danny Brown authored and GitHub committed 2020-06-26 14:26:35 -04:00
commit 1931d45450
45 files changed
+1055 -197

No files matched your search

+16
View File
@@ -82,6 +82,11 @@ const storeMeasurementsOld = async (measurementData, filter, server) => {
}
};
/**
*
* @param {object[]} measurementData An array of measurements from the measurements service
* that you wish to serialize.
*/
const downloadReport = measurementData => {
const srDataset = generateReport(measurementData);
const reportBlob = dcmjs.data.datasetToBlob(srDataset);
@@ -91,6 +96,11 @@ const downloadReport = measurementData => {
window.location.assign(objectUrl);
};
/**
*
* @param {object[]} measurementData An array of measurements from the measurements service
* that you wish to serialize.
*/
const generateReport = measurementData => {
const ids = measurementData.map(md => md.id);
const filteredToolState = _getFilteredCornerstoneToolState(ids);
@@ -103,6 +113,12 @@ const generateReport = measurementData => {
return report.dataset;
};
/**
*
* @param {object[]} measurementData An array of measurements from the measurements service
* that you wish to serialize.
* @param {object} dataSource The dataSource that you wish to use to persist the data.
*/
const storeMeasurements = async (measurementData, dataSource) => {
// TODO -> Eventually use the measurements directly and not the dcmjs adapter,
// But it is good enough for now whilst we only have cornerstone as a datasource.
@@ -137,6 +137,7 @@ export default class ExtensionManager {
getDataSources = dataSourceName => {
if (dataSourceName === undefined) {
// Default to the activeDataSource
dataSourceName = this.activeDataSource;
}
@@ -144,6 +145,10 @@ export default class ExtensionManager {
return this.dataSourceMap[dataSourceName];
};
getActiveDataSource = () => {
return this.activeDataSource;
};
/**
* @private
* @param {string} moduleType
@@ -33,7 +33,7 @@ const serviceImplementation = {
function _show({
content = null,
contentProps = null,
shouldCloseOnEsc = false,
shouldCloseOnEsc = true,
isOpen = true,
closeButton = true,
title = null,
+18
View File
@@ -0,0 +1,18 @@
/**
* Formats a patient name for display purposes
*/
export default function formatPN(name) {
if (!name) {
return;
}
// Convert the first ^ to a ', '. String.replace() only affects
// the first appearance of the character.
const commaBetweenFirstAndLast = name.replace('^', ', ');
// Replace any remaining '^' characters with spaces
const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' ');
// Trim any extraneous whitespace
return cleaned.trim();
}
+2
View File
@@ -15,6 +15,7 @@ import makeCancelable from './makeCancelable';
import hotkeys from './hotkeys';
import Queue from './Queue';
import isDicomUid from './isDicomUid';
import formatPN from './formatPN';
import resolveObjectPath from './resolveObjectPath';
import * as hierarchicalListUtils from './hierarchicalListUtils';
import * as progressTrackingUtils from './progressTrackingUtils';
@@ -26,6 +27,7 @@ const utils = {
addServers,
sortBy,
writeScript,
formatPN,
b64toBlob,
StackManager,
studyMetadataManager,