# HG changeset patch # User Sebastien Jodogne # Date 1606481848 -3600 # Node ID bc40b64502612ff53082345431b085523249910e # Parent b5a8bf32d969c90d1a5aa7ab1b98246655557842 "patient" GET argument diff -r b5a8bf32d969 -r bc40b6450261 Applications/StoneWebViewer/NOTES.txt --- a/Applications/StoneWebViewer/NOTES.txt Fri Nov 27 12:21:26 2020 +0100 +++ b/Applications/StoneWebViewer/NOTES.txt Fri Nov 27 13:57:28 2020 +0100 @@ -5,6 +5,7 @@ - The images are retrieved using DICOMweb. + - The Stone Web viewer uses the DICOM identifiers. The Osimis Web viewer the Orthanc identifiers. https://book.orthanc-server.com/faq/orthanc-ids.html @@ -20,21 +21,40 @@ To open a single series: http://.../index.html?study=&series= + +- In the Osimis Web viewer, the "OpenAllPatientStudies" configuration + option can be provided to search Orthanc for all studies from + patients with the same PatientID as the selected study, then display + them. + + In the Stone Web viewer, the "OpenAllPatientStudies" configuration + option is replaced by the single "patient" GET argument. This option + contains a comma-separated list of "Patient ID" tag (0010,0020). + + To open all the studies of one patient: + http://.../index.html?patient= + + To open all the studies of several patients: + http://.../index.html?patient=,,... + + - In the Osimis Web viewer, the "pickableStudyIds" parameter in the URL defines the list of studies that are available for display, and that are listed in the dropdown at the top-left of the interface. In the Stone Web viewer, "pickableStudyIds" is replaced by the single "study" GET argument, that is allowed to contain a - comma-separated list of studies. The "series" parameter is ignored - in this case. + comma-separated list of studies. The "series" parameter must not be + provided in this case. To open a list of studies: http://.../index.html?study=,,... - -- In the Osimis Web viewer, the "selectedStudyIds" defines the list of - studies that are selected in the dropdown (and therefore displayed - when the viewer starts). + + +- In the Osimis Web viewer, the "selectedStudyIds" parameter in the + URL defines the list of studies that are selected in the dropdown at + the top-left corner of the viewer (those studies are therefore + displayed when the viewer starts). In the Stone Web viewer, "selectedStudyIds" is replaced by the "selectedStudies" GET argument, that is allowed to contain a diff -r b5a8bf32d969 -r bc40b6450261 Applications/StoneWebViewer/WebApplication/app.js --- a/Applications/StoneWebViewer/WebApplication/app.js Fri Nov 27 12:21:26 2020 +0100 +++ b/Applications/StoneWebViewer/WebApplication/app.js Fri Nov 27 13:57:28 2020 +0100 @@ -842,6 +842,7 @@ app.SetCombinedToolActions(); var selectedStudies = getParameterFromUrl('selectedStudies'); + var patient = getParameterFromUrl('patient'); var study = getParameterFromUrl('study'); var series = getParameterFromUrl('series'); @@ -850,23 +851,40 @@ } else { app.selectedStudies = []; } - - if (study === undefined) { - alert('No study was provided in the URL!'); - } else { - var studies = study.split(','); - if (studies.length > 1) { - for (var i = 0; i < studies.length; i++) { - console.warn('Loading study: ' + studies[i]); - stone.FetchStudy(studies[i]); + + if (study !== undefined && + series !== undefined) { + console.warn('Loading series: ' + series + ' from study: ' + study); + stone.FetchSeries(study, series); + app.leftMode = 'full'; + } + else { + var empty = true; + + if (study !== undefined) { + var studies = study.split(','); + if (studies.length != 0) { + empty = false; + for (var i = 0; i < studies.length; i++) { + console.warn('Loading study: ' + studies[i]); + stone.FetchStudy(studies[i]); + } } - } else if (series === undefined) { - console.warn('Loading study: ' + study); - stone.FetchStudy(study); - } else { - console.warn('Loading series: ' + series + ' from study: ' + study); - stone.FetchSeries(study, series); - app.leftMode = 'full'; + } + + if (patient !== undefined) { + var patients = patient.split(','); + if (patients.length != 0) { + empty = false; + for (var i = 0; i < patients.length; i++) { + console.warn('Loading patient: ' + patients[i]); + stone.FetchPatient(patients[i]); + } + } + } + + if (empty) { + alert('No study, nor patient was provided in the URL!'); } } }); diff -r b5a8bf32d969 -r bc40b6450261 Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp --- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Fri Nov 27 12:21:26 2020 +0100 +++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Fri Nov 27 13:57:28 2020 +0100 @@ -277,12 +277,22 @@ } } - void FetchInternal(const std::string& studyInstanceUid, + void FetchInternal(const std::string& patientId, + const std::string& studyInstanceUid, const std::string& seriesInstanceUid) { // Firstly, load the study Orthanc::DicomMap filter; - filter.SetValue(Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, studyInstanceUid, false); + + if (!patientId.empty()) + { + filter.SetValue(Orthanc::DICOM_TAG_PATIENT_ID, patientId, false); + } + + if (!studyInstanceUid.empty()) + { + filter.SetValue(Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, studyInstanceUid, false); + } std::set tags; tags.insert(Orthanc::DICOM_TAG_STUDY_DESCRIPTION); // Necessary for Orthanc DICOMweb plugin @@ -305,7 +315,7 @@ pending_ += 2; } - + class PdfInfo : public Orthanc::IDynamicObject { @@ -378,18 +388,33 @@ void FetchAllStudies() { - FetchInternal("", ""); + FetchInternal("", "", ""); + } + + void FetchPatient(const std::string& patientId) + { + if (!patientId.empty()) + { + FetchInternal(patientId, "", ""); + } } void FetchStudy(const std::string& studyInstanceUid) { - FetchInternal(studyInstanceUid, ""); + if (!studyInstanceUid.empty()) + { + FetchInternal("", studyInstanceUid, ""); + } } void FetchSeries(const std::string& studyInstanceUid, const std::string& seriesInstanceUid) { - FetchInternal(studyInstanceUid, seriesInstanceUid); + if (!studyInstanceUid.empty() && + !seriesInstanceUid.empty()) + { + FetchInternal("", studyInstanceUid, seriesInstanceUid); + } } size_t GetStudiesCount() const @@ -2775,6 +2800,16 @@ } EMSCRIPTEN_KEEPALIVE + void FetchPatient(const char* patientId) + { + try + { + GetResourcesLoader().FetchPatient(patientId); + } + EXTERN_CATCH_EXCEPTIONS; + } + + EMSCRIPTEN_KEEPALIVE void FetchStudy(const char* studyInstanceUid) { try