Skip to content

Commit 1627f27

Browse files
Support to get StudyInstanceUID in sheet service from bg datasource as it have different params for it. And blocked automatic segmentations loading in other than segmentation mode.
1 parent 5c3fea4 commit 1627f27

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

extensions/ohif-gradienthealth-extension/src/DicomJSONDataSource/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ function createDicomJSONApi(dicomJsonConfig, servicesManager) {
348348
const metadataPerBucket = await filesFromStudyInstanceUID({
349349
bucketName: buckets[i],
350350
prefix: query.get('bucket-prefix') || 'dicomweb',
351-
studyuids: query.getAll('StudyInstanceUIDs'),
351+
studyuids: query.getAll('StudyInstanceUID'),
352352
headers: UserAuthenticationService.getAuthorizationHeader(),
353353
});
354354

@@ -456,7 +456,7 @@ function createDicomJSONApi(dicomJsonConfig, servicesManager) {
456456
// If the study is not found, initialize the study.
457457
// If there is no buckets in the url default bucket will be used.
458458
const params = new URLSearchParams(window.location.search);
459-
params.set('StudyInstanceUIDs', StudyInstanceUID);
459+
params.set('StudyInstanceUID', StudyInstanceUID);
460460
params.delete('bucket');
461461
buckets.forEach((bucket) => {
462462
params.append('bucket', bucket);

extensions/ohif-gradienthealth-extension/src/services/GoogleSheetsService/GoogleSheetsService.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class GoogleSheetsService {
5757
this.rows.slice(min - 1, max).forEach((row) => {
5858
const url = row[urlIndex];
5959
const params = new URLSearchParams('?' + url.split('?')[1]);
60-
const StudyInstanceUID = params.get('StudyInstanceUIDs');
60+
const StudyInstanceUID = getStudyInstanceUIDFromParams(params);
6161
CacheAPIService.cacheStudy(StudyInstanceUID, params.getAll('bucket'));
6262
});
6363
}
@@ -103,14 +103,14 @@ export default class GoogleSheetsService {
103103
this.studyUIDToIndex = this.rows.slice(1).reduce((prev, curr, idx) => {
104104
const url = curr[urlIndex];
105105
const params = new URLSearchParams('?' + url.split('?')[1]);
106-
const StudyInstanceUID = params.get('StudyInstanceUIDs');
106+
const StudyInstanceUID = getStudyInstanceUIDFromParams(params);
107107

108108
// Google Sheets is 1-indexed and we ignore first row as header row thus + 2
109109
prev[StudyInstanceUID] = idx + 2;
110110
return prev;
111111
}, {});
112112

113-
this.index = this.studyUIDToIndex[params.get('StudyInstanceUIDs')];
113+
this.index = this.studyUIDToIndex[getStudyInstanceUIDFromParams(params)];
114114

115115
// Map formTemplate and formValue
116116
const values = this.settings.values[0].map((_, colIndex) =>
@@ -145,7 +145,7 @@ export default class GoogleSheetsService {
145145
})
146146
.sort((a, b) => a.order - b.order);
147147

148-
this.setFormByStudyInstanceUID(params.get('StudyInstanceUIDs'));
148+
this.setFormByStudyInstanceUID(getStudyInstanceUIDFromParams(params));
149149
} catch (e) {
150150
console.error(e);
151151
this._broadcastEvent(EVENTS.GOOGLE_SHEETS_ERROR);
@@ -259,7 +259,7 @@ export default class GoogleSheetsService {
259259
const index = this.formHeader.findIndex((name) => name == 'URL');
260260
const url = rowValues[index];
261261
const params = new URLSearchParams('?' + url.split('?')[1]);
262-
const StudyInstanceUID = params.get('StudyInstanceUIDs');
262+
const StudyInstanceUID = getStudyInstanceUIDFromParams(params);
263263
const buckets = params.getAll('bucket');
264264
if (!StudyInstanceUID) {
265265
window.location.href = `https://docs.google.com/spreadsheets/d/${this.sheetId}`;
@@ -288,12 +288,16 @@ export default class GoogleSheetsService {
288288
);
289289

290290
const nextParams = new URLSearchParams(window.location.search);
291-
nextParams.set('StudyInstanceUIDs', StudyInstanceUID);
291+
if (nextParams.get('StudyInstanceUIDs'))
292+
nextParams.set('StudyInstanceUIDs', StudyInstanceUID);
293+
else {
294+
nextParams.set('StudyInstanceUID', StudyInstanceUID);
295+
}
292296
nextParams.delete('bucket');
293297
buckets.forEach((bucket) => {
294298
nextParams.append('bucket', bucket);
295299
});
296-
300+
297301
const nextURL =
298302
window.location.href.split('?')[0] + '?' + nextParams.toString();
299303
window.history.replaceState({}, null, nextURL);
@@ -315,6 +319,12 @@ export default class GoogleSheetsService {
315319
}
316320

317321
function loadSegFiles(studyInstanceUID, serviceManager) {
322+
if (!window.location.pathname.startsWith('/segmentation')) {
323+
// Since sheet panel only used by segmentation and breast density mode,
324+
// and breast density mode does not handles segmentation we are not loading segmentations.
325+
return;
326+
}
327+
318328
const segSOPClassUIDs = ['1.2.840.10008.5.1.4.1.1.66.4'];
319329
const {
320330
segmentationService,
@@ -380,3 +390,8 @@ function loadSegFiles(studyInstanceUID, serviceManager) {
380390
newStackCreateListeners
381391
);
382392
}
393+
394+
function getStudyInstanceUIDFromParams(params) {
395+
// Breast OHIF dicomweb datasource uses StudyInstanceUIDs, but bq datasource uses StudyInstanceUID
396+
return params.get('StudyInstanceUIDs') || params.get('StudyInstanceUID');
397+
}

0 commit comments

Comments
 (0)