ohif-viewer/Packages/ohif-measurement-table/client/utils/srUtils.js
Egor Lezhnin 9486522552 feat(google-cloud): Add support for Google Cloud Healthcare API DICOM Store Switch (#325)
* 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
2019-03-22 16:42:26 +01:00

73 lines
2.1 KiB
JavaScript

import { dcmjs } from 'meteor/ohif:cornerstone';
const supportedSopClassUIDs = ['1.2.840.10008.5.1.4.1.1.88.22', '1.2.840.10008.5.1.4.1.1.11.1'];
const toArray = function(x) {
return (x.constructor.name === "Array" ? x : [x]);
};
const codeMeaningEquals = (codeMeaningName) => {
return (contentItem) => {
return contentItem.ConceptNameCodeSequence.CodeMeaning === codeMeaningName;
};
};
const getAllDisplaySets = () => {
const allStudies = OHIF.viewer.Studies.all();
let allDisplaySets = [];
allStudies.forEach(study => {
allDisplaySets = allDisplaySets.concat(study.displaySets);
});
return allDisplaySets;
};
const getInstanceMetadata = (displaySets, sopInstanceUid) => {
let instance;
// Use Array.some so that this loop stops when the internal loop
// has found the correct instance
displaySets.some(displaySet => {
// Search the display set to find the instance metadata for
return displaySet.images.find(instanceMetadata => {
if (instanceMetadata._sopInstanceUID === sopInstanceUid) {
instance = instanceMetadata;
return true;
}
});
});
return instance;
};
const getLatestSRSeries = () => {
const allStudies = OHIF.viewer.StudyMetadataList.all();
let latestSeries;
allStudies.forEach(study => {
study.getSeries().forEach(series => {
const firstInstance = series.getFirstInstance();
const sopClassUid = firstInstance._instance.sopClassUid;
if (supportedSopClassUIDs.includes(sopClassUid)) {
if(!latestSeries) {
latestSeries = series;
} else if (series._data.seriesDate > latestSeries._data.seriesDate ||
(series._data.seriesDate === latestSeries._data.seriesDate && series._data.seriesTime > latestSeries._data.seriesTime)) {
latestSeries = series;
}
}
});
});
return latestSeries;
};
export {
getAllDisplaySets,
getInstanceMetadata,
getLatestSRSeries
}