* NOTASK: PoC for loading data from Healthcare API * NOTASK: PoC for loading data from Healthcare API fix * Add sample dialog for loading test dicom-picker * Fix incorrect promise resolving * NOTASK: PoC for loading dicom store * Add web-components as git submodules. (Probably will be changed later) * Add rough dicomStore picker * Add dataset selector * NOTASK: QIDO metadata first draft * NOTASK: Not Implemented error for color images * NOTASK: clean-up * Dicom files uploader intermediate version * NOTASK: Accept header * NOTASK: docker configs * NOTASK: fix * NOTASK: howTo * Add draft of DICOM uploader * Add missing files * Fix error with missing clientId * Update submodule * NOTASK: HowTo * NOTASK: config for dev * NOTASK: new docker file * clean-up * Update GCP web-components * Add integration with async web components * Fix errors in nginx.conf * Structured reports views basic implementation * NOTASK: qido -> wado * NOTASK: config fix * NOTASK: dirty copy-paste implementation * Add "Change dicom store" button. Add an ability to clear date. Fix bug, when OAuth dosn't work if URL is not / * Fix studylist filtering * Fix dockerfile * NOTASK: meteor update * NOTASK: fix of package structure * NOTASK: merge fix * improvements Move check for now SR into SR modal Use simple button to open SR modal Remove button styling cleanup * copy SR data retrieval to wado * make search of SR simpler * Codestyle fix * NOTASK: palette color error message * Fix date filter. Fix server settings on first loading. Add SR and PS buttons * NOTASK: PS is now hidden by default * NOTASK: dirty solution * NOTASK: new wadoimage lib version * Fix PS and SR buttons * Make modal dialogs vertically centered * Update web components. Quick UI fixes * Add missing files to the previous commit * NOTASK: show-hide for PS * NOTASK: show-hide for PS * NOTASK: fix of min-max PixelValue bug * Add "sign out" functionality for Google OAuth. Update web-components. * intermediate commit * Add demo signin page * Beautifying demo sign in page * NOTASK: merge * NOTASK: clean-up * Use npm for getting healthcare-api-adapter instead of git submodule. * NOTASK: clean-up * meteor update * clean-up * clean-up * Clean up code * Update healthcare-api-adapter version. Add location to dicom store path. Fix buttons style. * Downgrade meteor and packages to master version. Use meteor-build-client-fixed2
111 lines
4.4 KiB
JavaScript
111 lines
4.4 KiB
JavaScript
|
|
import { OHIF } from 'meteor/ohif:core';
|
|
import DICOMwebClient from 'dicomweb-client';
|
|
const { DICOMWeb } = OHIF;
|
|
|
|
/**
|
|
* Creates a URL for a WADO search
|
|
*
|
|
* @param server
|
|
* @param studyInstanceUid
|
|
* @returns {string}
|
|
*/
|
|
function buildUrl(server, studyInstanceUid) {
|
|
return server.wadoRoot + '/studies?includefield=all&StudyInstanceUID=' + studyInstanceUid;
|
|
}
|
|
|
|
function buildInstanceWadoRsUri(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid) {
|
|
return `${server.wadoRoot}/studies/${studyInstanceUid}/series/${seriesInstanceUid}/instances/${sopInstanceUid}`
|
|
}
|
|
|
|
function buildInstanceFrameWadoRsUri(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid, frame) {
|
|
const baseWadoRsUri = buildInstanceWadoRsUri(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid);
|
|
frame = frame != null || 1;
|
|
|
|
return `${baseWadoRsUri}/frames/${frame}`
|
|
}
|
|
/**
|
|
* Parses result data from a QIDO search into Study MetaData
|
|
* Returns an object populated with study metadata, including the
|
|
* series list.
|
|
*
|
|
* @param server
|
|
* @param studyInstanceUid
|
|
* @param resultData
|
|
* @returns {{seriesList: Array, patientName: *, patientId: *, accessionNumber: *, studyDate: *, modalities: *, studyDescription: *, imageCount: *, studyInstanceUid: *}}
|
|
*/
|
|
async function resultDataToStudyMetadata(server, studyInstanceUid, resultData, instancesIn) {
|
|
|
|
const seriesList = [];
|
|
|
|
if (!resultData.length) {
|
|
return;
|
|
}
|
|
|
|
const anInstance = resultData[0];
|
|
if (!anInstance) {
|
|
return;
|
|
}
|
|
|
|
const studyData = {
|
|
seriesList,
|
|
patientName: DICOMWeb.getName(anInstance['00100010']),
|
|
patientId: DICOMWeb.getString(anInstance['00100020']),
|
|
patientAge: DICOMWeb.getNumber(anInstance['00101010']),
|
|
patientSize: DICOMWeb.getNumber(anInstance['00101020']),
|
|
patientWeight: DICOMWeb.getNumber(anInstance['00101030']),
|
|
accessionNumber: DICOMWeb.getString(anInstance['00080050']),
|
|
studyDate: DICOMWeb.getString(anInstance['00080020']),
|
|
modalities: DICOMWeb.getString(anInstance['00080061']),
|
|
studyDescription: DICOMWeb.getString(anInstance['00081030']),
|
|
imageCount: DICOMWeb.getString(anInstance['00201208']),
|
|
studyInstanceUid: DICOMWeb.getString(anInstance['0020000D']),
|
|
institutionName: DICOMWeb.getString(anInstance['00080080'])
|
|
};
|
|
await Promise.all(instancesIn.seriesList.map(async function(seriesMap) {
|
|
var instance = seriesMap.instances[0];
|
|
var seriesInstanceUid = instance.seriesInstanceUid;
|
|
var series = seriesMap[seriesInstanceUid];
|
|
if (!series) {
|
|
series = seriesMap;
|
|
series.instances = [];
|
|
seriesMap[seriesInstanceUid] = series;
|
|
seriesList.push(series);
|
|
}
|
|
const sopInstanceUid = instance.sopInstanceUid;
|
|
const wadouri = buildInstanceWadoRsUri(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid);
|
|
const baseWadoRsUri = buildInstanceWadoRsUri(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid);
|
|
const wadorsuri = buildInstanceFrameWadoRsUri(server, studyInstanceUid, seriesInstanceUid, sopInstanceUid);
|
|
|
|
const instanceSummary = instance;
|
|
instanceSummary.baseWadoRsUri=baseWadoRsUri;
|
|
instanceSummary.wadouri=WADOProxy.convertURL(wadouri, server);
|
|
instanceSummary.wadorsuri=WADOProxy.convertURL(wadorsuri, server);
|
|
instanceSummary.imageRendering=server.imageRendering;
|
|
instanceSummary.thumbnailRendering=server.thumbnailRendering;
|
|
series.instances.push(instanceSummary);
|
|
}));
|
|
return studyData;
|
|
}
|
|
|
|
/**
|
|
* Retrieved Study MetaData from a DICOM server using a WADO call
|
|
* @param server
|
|
* @param studyInstanceUid
|
|
* @returns {Promise}
|
|
*/
|
|
OHIF.studies.services.QIDO.RetrieveMetadata = async function(server, studyInstanceUid) {
|
|
const url = buildUrl(server, studyInstanceUid);
|
|
return new Promise((resolve, reject) => {
|
|
DICOMWeb.getJSON(url, server.requestOptions).then(result => {
|
|
OHIF.studies.services.QIDO.Instances(server, studyInstanceUid).then(instances => {
|
|
resultDataToStudyMetadata(server, studyInstanceUid, result, instances).then((study) => {
|
|
study.wadoUriRoot = server.wadoUriRoot;
|
|
study.studyInstanceUid = studyInstanceUid;
|
|
resolve(study);
|
|
}, reject)
|
|
}, reject);
|
|
}, reject);
|
|
});
|
|
};
|