Co-authored-by: James Petts <jamesapetts@gmail.com>
This commit is contained in:
parent
2d827c2a49
commit
62a2cd5ff3
@ -2,6 +2,7 @@ import OHIF from '@ohif/core';
|
|||||||
import {
|
import {
|
||||||
save,
|
save,
|
||||||
getDicomWebClientFromContext,
|
getDicomWebClientFromContext,
|
||||||
|
getStudyInstanceUIDFromStudies,
|
||||||
getSOPInstanceReferenceFromActiveViewport,
|
getSOPInstanceReferenceFromActiveViewport,
|
||||||
getSOPInstanceReferencesFromViewports,
|
getSOPInstanceReferencesFromViewports,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
@ -41,6 +42,14 @@ export function getCommands(context) {
|
|||||||
listOfUIDs
|
listOfUIDs
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
downloadAndZipStudy({ servers, studies, progress }) {
|
||||||
|
const dicomWebClient = getDicomWebClientFromContext(context, servers);
|
||||||
|
const listOfUIDs = getStudyInstanceUIDFromStudies(studies);
|
||||||
|
return save(
|
||||||
|
_downloadAndZip(dicomWebClient, listOfUIDs, { progress }),
|
||||||
|
listOfUIDs
|
||||||
|
);
|
||||||
|
},
|
||||||
downloadAndZipSeriesOnViewports({ servers, viewports, progress }) {
|
downloadAndZipSeriesOnViewports({ servers, viewports, progress }) {
|
||||||
const dicomWebClient = getDicomWebClientFromContext(context, servers);
|
const dicomWebClient = getDicomWebClientFromContext(context, servers);
|
||||||
const listOfUIDs = getSOPInstanceReferencesFromViewports(viewports);
|
const listOfUIDs = getSOPInstanceReferencesFromViewports(viewports);
|
||||||
@ -64,6 +73,11 @@ export function getCommands(context) {
|
|||||||
commandFn: queue.bindSafe(actions.downloadAndZip, error),
|
commandFn: queue.bindSafe(actions.downloadAndZip, error),
|
||||||
storeContexts: ['servers'],
|
storeContexts: ['servers'],
|
||||||
},
|
},
|
||||||
|
downloadAndZipStudy: {
|
||||||
|
commandFn: queue.bindSafe(actions.downloadAndZipStudy, error),
|
||||||
|
storeContexts: ['servers', 'studies'],
|
||||||
|
options: { progress },
|
||||||
|
},
|
||||||
downloadAndZipSeriesOnViewports: {
|
downloadAndZipSeriesOnViewports: {
|
||||||
commandFn: queue.bindSafe(actions.downloadAndZipSeriesOnViewports, error),
|
commandFn: queue.bindSafe(actions.downloadAndZipSeriesOnViewports, error),
|
||||||
storeContexts: ['servers', 'viewports'],
|
storeContexts: ['servers', 'viewports'],
|
||||||
|
|||||||
@ -100,11 +100,16 @@ function save(promise, listOfUIDs) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStudyInstanceUIDFromStudies(studies) {
|
||||||
|
return Object.keys(Object(Object(studies).studyData)).slice(0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
save,
|
save,
|
||||||
validDicomUid,
|
validDicomUid,
|
||||||
getDicomWebClientFromConfig,
|
getDicomWebClientFromConfig,
|
||||||
getDicomWebClientFromContext,
|
getDicomWebClientFromContext,
|
||||||
|
getStudyInstanceUIDFromStudies,
|
||||||
getSOPInstanceReferenceFromActiveViewport,
|
getSOPInstanceReferenceFromActiveViewport,
|
||||||
getSOPInstanceReferencesFromViewports,
|
getSOPInstanceReferencesFromViewports,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -13,7 +13,7 @@ const findMostRecentStructuredReport = studies => {
|
|||||||
// Skip series that may not have instances yet
|
// Skip series that may not have instances yet
|
||||||
// This can happen if we have retrieved just the initial
|
// This can happen if we have retrieved just the initial
|
||||||
// details about the series via QIDO-RS, but not the full metadata
|
// details about the series via QIDO-RS, but not the full metadata
|
||||||
if (!series.instances.length) {
|
if (!series.instances || !series.instances.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,11 +6,12 @@ const defaultState = {
|
|||||||
|
|
||||||
const servers = (state = defaultState, action) => {
|
const servers = (state = defaultState, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'SET_STUDY_DATA':
|
case 'SET_STUDY_DATA': {
|
||||||
const updatedStudyData = cloneDeep(state).studyData;
|
const updatedStudyData = cloneDeep(state.studyData);
|
||||||
updatedStudyData[action.StudyInstanceUID] = action.data;
|
updatedStudyData[action.StudyInstanceUID] = cloneDeep(action.data);
|
||||||
|
|
||||||
return Object.assign({}, state, { studyData: updatedStudyData });
|
return Object.assign({}, state, { studyData: updatedStudyData });
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
|||||||
import ViewerRetrieveStudyData from './ViewerRetrieveStudyData.js';
|
import ViewerRetrieveStudyData from './ViewerRetrieveStudyData.js';
|
||||||
import OHIF from '@ohif/core';
|
import OHIF from '@ohif/core';
|
||||||
|
|
||||||
const { clearViewportSpecificData } = OHIF.redux.actions;
|
const { clearViewportSpecificData, setStudyData } = OHIF.redux.actions;
|
||||||
const isActive = a => a.active === true;
|
const isActive = a => a.active === true;
|
||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
@ -14,6 +14,9 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
};
|
};
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
|
setStudyData: (StudyInstanceUID, data) => {
|
||||||
|
dispatch(setStudyData(StudyInstanceUID, data));
|
||||||
|
},
|
||||||
clearViewportSpecificData: () => {
|
clearViewportSpecificData: () => {
|
||||||
dispatch(clearViewportSpecificData());
|
dispatch(clearViewportSpecificData());
|
||||||
},
|
},
|
||||||
|
|||||||
@ -154,11 +154,21 @@ const _sortStudyDisplaySet = (study, studyMetadata) => {
|
|||||||
studyMetadata.sortDisplaySets(study.displaySets);
|
studyMetadata.sortDisplaySets(study.displaySets);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _thinStudyData = study => {
|
||||||
|
return {
|
||||||
|
StudyInstanceUID: study.StudyInstanceUID,
|
||||||
|
series: study.series.map(item => ({
|
||||||
|
SeriesInstanceUID: item.SeriesInstanceUID
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function ViewerRetrieveStudyData({
|
function ViewerRetrieveStudyData({
|
||||||
server,
|
server,
|
||||||
studyInstanceUIDs,
|
studyInstanceUIDs,
|
||||||
seriesInstanceUIDs,
|
seriesInstanceUIDs,
|
||||||
clearViewportSpecificData,
|
clearViewportSpecificData,
|
||||||
|
setStudyData,
|
||||||
}) {
|
}) {
|
||||||
// hooks
|
// hooks
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
@ -220,6 +230,7 @@ function ViewerRetrieveStudyData({
|
|||||||
if (Array.isArray(studiesData) && studiesData.length > 0) {
|
if (Array.isArray(studiesData) && studiesData.length > 0) {
|
||||||
// Map studies to new format, update metadata manager?
|
// Map studies to new format, update metadata manager?
|
||||||
const studies = studiesData.map(study => {
|
const studies = studiesData.map(study => {
|
||||||
|
setStudyData(study.StudyInstanceUID, _thinStudyData(study));
|
||||||
const studyMetadata = new OHIFStudyMetadata(
|
const studyMetadata = new OHIFStudyMetadata(
|
||||||
study,
|
study,
|
||||||
study.StudyInstanceUID
|
study.StudyInstanceUID
|
||||||
@ -369,6 +380,7 @@ ViewerRetrieveStudyData.propTypes = {
|
|||||||
seriesInstanceUIDs: PropTypes.array,
|
seriesInstanceUIDs: PropTypes.array,
|
||||||
server: PropTypes.object,
|
server: PropTypes.object,
|
||||||
clearViewportSpecificData: PropTypes.func.isRequired,
|
clearViewportSpecificData: PropTypes.func.isRequired,
|
||||||
|
setStudyData: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ViewerRetrieveStudyData;
|
export default ViewerRetrieveStudyData;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user