Skip to content

Commit

Permalink
chore: Tag everything currently unused as legacy.
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesAPetts authored and swederik committed Feb 11, 2021
1 parent 8392c1f commit 414ebc6
Show file tree
Hide file tree
Showing 161 changed files with 128 additions and 14,712 deletions.
21 changes: 10 additions & 11 deletions extensions/cornerstone/src/commandsModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import cornerstone from 'cornerstone-core';
import cornerstoneTools from 'cornerstone-tools';
import OHIF from '@ohif/core';

import setCornerstoneLayout from './utils/setCornerstoneLayout.js';
//import setCornerstoneLayout from './utils/setCornerstoneLayout.js';
import { getEnabledElement } from './state';
import CornerstoneViewportDownloadForm from './CornerstoneViewportDownloadForm';
const scroll = cornerstoneTools.import('util/scroll');

const { studyMetadataManager } = OHIF.utils;
const { setViewportSpecificData } = OHIF.redux.actions;

const commandsModule = ({ servicesManager, commandsManager }) => {
const { ViewportGridService } = servicesManager.services;
Expand Down Expand Up @@ -299,9 +298,9 @@ const commandsModule = ({ servicesManager, commandsManager }) => {
cornerstoneTools.removeToolState(element, toolType, tool);
cornerstone.updateImage(element);
},
setCornerstoneLayout: () => {
setCornerstoneLayout();
},
// setCornerstoneLayout: () => {
// setCornerstoneLayout();
// },
setWindowLevel: ({ window, level }) => {
const enabledElement = _getActiveViewportsEnabledElement();

Expand Down Expand Up @@ -430,12 +429,12 @@ const commandsModule = ({ servicesManager, commandsManager }) => {
storeContexts: [],
options: { toolName: 'Zoom' },
},
setCornerstoneLayout: {
commandFn: actions.setCornerstoneLayout,
storeContexts: [],
options: {},
context: 'VIEWER',
},
// setCornerstoneLayout: {
// commandFn: actions.setCornerstoneLayout,
// storeContexts: [],
// options: {},
// context: 'VIEWER',
// },
setWindowLevel: {
commandFn: actions.setWindowLevel,
storeContexts: [],
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default function init({
}

const { csToolsConfig } = configuration;
const metadataProvider = OHIF.cornerstone.metadataProvider;
const metadataProvider = OHIF.classes.MetadataProvider;

cs.metaData.addProvider(metadataProvider.get.bind(metadataProvider), 9999);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const LOW_PRIORITY_MODALITIES = Object.freeze(['SEG', 'KO', 'PR', 'SR', 'RTSTRUCT']);

export default function isLowPriorityModality(Modality) {
return LOW_PRIORITY_MODALITIES.includes(Modality);
}
97 changes: 97 additions & 0 deletions extensions/default/src/DicomWebDataSource/utils/sortStudy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import isLowPriorityModality from './isLowPriorityModality';

/**
* Series sorting criteria: series considered low priority are moved to the end
* of the list and series number is used to break ties
* @param {Object} firstSeries
* @param {Object} secondSeries
*/
function seriesInfoSortingCriteria(firstSeries, secondSeries) {
const aLowPriority = isLowPriorityModality(firstSeries.Modality);
const bLowPriority = isLowPriorityModality(secondSeries.Modality);
if (!aLowPriority && bLowPriority) {
return -1;
}
if (aLowPriority && !bLowPriority) {
return 1;
}

return firstSeries.SeriesNumber - secondSeries.SeriesNumber;
}

const seriesSortCriteria = {
default: (a, b) => a.SeriesNumber - b.SeriesNumber,
seriesInfoSortingCriteria,
};

const instancesSortCriteria = {
default: (a, b) => a.InstanceNumber - b.InstanceNumber,
};

const sortingCriteria = {
seriesSortCriteria,
instancesSortCriteria,
};

/**
* Sorts given series (given param is modified)
* The default criteria is based on series number in ascending order.
*
* @param {Array} series List of series
* @param {function} seriesSortingCriteria method for sorting
* @returns {Array} sorted series object
*/
const sortStudySeries = (
series,
seriesSortingCriteria = seriesSortCriteria.default
) => {
return series.sort(seriesSortingCriteria);
};

/**
* Sorts given instancesList (given param is modified)
* The default criteria is based on instance number in ascending order.
*
* @param {Array} instancesList List of series
* @param {function} instancesSortingCriteria method for sorting
* @returns {Array} sorted instancesList object
*/
const sortStudyInstances = (
instancesList,
instancesSortingCriteria = instancesSortCriteria.default
) => {
return instancesList.sort(instancesSortingCriteria);
};

/**
* Sorts the series and instances (by default) inside a study instance based on sortingCriteria (given param is modified)
* The default criteria is based on series and instance numbers in ascending order.
*
* @param {Object} study The study instance
* @param {boolean} [deepSort = true] to sort instance also
* @param {function} [seriesSortingCriteria = seriesSortCriteria.default] method for sorting series
* @param {function} [instancesSortingCriteria = instancesSortCriteria.default] method for sorting instances
* @returns {Object} sorted study object
*/
export default function sortStudy(
study,
deepSort = true,
seriesSortingCriteria = seriesSortCriteria.default,
instancesSortingCriteria = instancesSortCriteria.default
) {
if (!study || !study.series) {
throw new Error('Insufficient study data was provided to sortStudy');
}

sortStudySeries(study.series, seriesSortingCriteria);

if (deepSort) {
study.series.forEach(series => {
sortStudyInstances(series.instances, instancesSortingCriteria);
});
}

return study;
}

export { sortStudy, sortStudySeries, sortStudyInstances, sortingCriteria };
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import dcmjs from 'dcmjs';
import { studies } from '@ohif/core';
import { sortStudySeries, sortingCriteria } from '../utils/sortStudy';
import RetrieveMetadataLoader from './retrieveMetadataLoader';

const { sortStudySeries, sortingCriteria } = studies;


/**
* Creates an immutable series loader object which loads each series sequentially using the iterator interface
* @param {DICOMWebClient} dicomWebClient The DICOMWebClient instance to be used for series load
Expand Down
10 changes: 5 additions & 5 deletions platform/core/src/DICOMSR/dataExchange.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import log from '../log';
import studies from '../studies';
// import studies from '../studies';
import utils from '../utils';
import {
retrieveMeasurementFromSR,
stowSRFromMeasurements,
} from './handleStructuredReport';
// import {
// retrieveMeasurementFromSR,
// stowSRFromMeasurements,
// } from './handleStructuredReport';
import findMostRecentStructuredReport from './utils/findMostRecentStructuredReport';
import cornerstone from 'cornerstone-core';
import cornerstoneTools from 'cornerstone-tools';
Expand Down
87 changes: 0 additions & 87 deletions platform/core/src/DICOMSR/handleStructuredReport.js

This file was deleted.

100 changes: 0 additions & 100 deletions platform/core/src/DICOMSR/parseDicomStructuredReport.js

This file was deleted.

Loading

0 comments on commit 414ebc6

Please sign in to comment.