diff --git a/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts b/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts index b8699f1e213..50e2d2c3c16 100644 --- a/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts +++ b/extensions/cornerstone/src/services/SegmentationService/SegmentationService.ts @@ -130,7 +130,7 @@ class SegmentationService extends PubSubService { throw new Error('Segment index 0 is reserved for "no label"'); } - const toolGroupId = config.toolGroupId ?? this._getFirstToolGroupId(); + const toolGroupId = config.toolGroupId ?? this._getApplicableToolGroupId(); const { segmentationRepresentationUID, segmentation } = this._getSegmentationInfo( segmentationId, @@ -361,7 +361,7 @@ class SegmentationService extends PubSubService { } public setActiveSegmentationForToolGroup(segmentationId: string, toolGroupId?: string): void { - toolGroupId = toolGroupId ?? this._getFirstToolGroupId(); + toolGroupId = toolGroupId ?? this._getApplicableToolGroupId(); const suppressEvents = false; this._setActiveSegmentationForToolGroup(segmentationId, toolGroupId, suppressEvents); @@ -912,7 +912,7 @@ class SegmentationService extends PubSubService { } const segmentation = this.getSegmentation(segmentationId); - toolGroupId = toolGroupId ?? this._getFirstToolGroupId(); + toolGroupId = toolGroupId ?? this._getApplicableToolGroupId(); const segmentationRepresentation = this._getSegmentationRepresentation( segmentationId, @@ -1313,7 +1313,7 @@ class SegmentationService extends PubSubService { if (remainingHydratedSegmentations.length) { const { id } = remainingHydratedSegmentations[0]; - this._setActiveSegmentationForToolGroup(id, this._getFirstToolGroupId(), false); + this._setActiveSegmentationForToolGroup(id, this._getApplicableToolGroupId(), false); } } @@ -1325,7 +1325,7 @@ class SegmentationService extends PubSubService { } public getConfiguration = (toolGroupId?: string): SegmentationConfig => { - toolGroupId = toolGroupId ?? this._getFirstToolGroupId(); + toolGroupId = toolGroupId ?? this._getApplicableToolGroupId(); const brushSize = 1; // const brushSize = cstUtils.segmentation.getBrushSizeForToolGroup( @@ -1620,7 +1620,7 @@ class SegmentationService extends PubSubService { throw new Error(`Segment ${segmentIndex} not yet added to segmentation: ${segmentationId}`); } - toolGroupId = toolGroupId ?? this._getFirstToolGroupId(); + toolGroupId = toolGroupId ?? this._getApplicableToolGroupId(); const segmentationRepresentation = this._getSegmentationRepresentation( segmentationId, @@ -1714,7 +1714,7 @@ class SegmentationService extends PubSubService { toolGroupId?: string, suppressEvents = false ) { - toolGroupId = toolGroupId ?? this._getFirstToolGroupId(); + toolGroupId = toolGroupId ?? this._getApplicableToolGroupId(); const { segmentationRepresentationUID, segmentation } = this._getSegmentationInfo( segmentationId, @@ -1773,7 +1773,7 @@ class SegmentationService extends PubSubService { throw new Error(`Segment ${segmentIndex} not yet added to segmentation: ${segmentationId}`); } - toolGroupId = toolGroupId ?? this._getFirstToolGroupId(); + toolGroupId = toolGroupId ?? this._getApplicableToolGroupId(); const segmentationRepresentation = this._getSegmentationRepresentation( segmentationId, @@ -2090,11 +2090,21 @@ class SegmentationService extends PubSubService { } } - private _getFirstToolGroupId = () => { - const { toolGroupService } = this.servicesManager.services; - const toolGroupIds = toolGroupService.getToolGroupIds(); + private _getApplicableToolGroupId = () => { + const { toolGroupService, viewportGridService, cornerstoneViewportService } = + this.servicesManager.services; + + const viewportInfo = cornerstoneViewportService.getViewportInfo( + viewportGridService.getActiveViewportId() + ); + + if (!viewportInfo) { + const toolGroupIds = toolGroupService.getToolGroupIds(); + + return toolGroupIds[0]; + } - return toolGroupIds[0]; + return viewportInfo.getToolGroupId(); }; private getNextColorLUTIndex = (): number => { diff --git a/modes/tmtv/src/toolbarButtons.js b/modes/tmtv/src/toolbarButtons.js index 6e336d4f83c..556e2172845 100644 --- a/modes/tmtv/src/toolbarButtons.js +++ b/modes/tmtv/src/toolbarButtons.js @@ -165,20 +165,6 @@ const toolbarButtons = [ ], 'Ellipse Tool' ), - _createToolButton( - 'CircleROI', - 'tool-circle', - 'Circle', - [ - ..._createCommands('setToolActive', 'CircleROI', [ - toolGroupIds.CT, - toolGroupIds.PT, - toolGroupIds.Fusion, - // toolGroupIds.MPR, - ]), - ], - 'Circle Tool' - ), ], }, }, diff --git a/platform/core/src/services/DicomMetadataStore/createStudyMetadata.js b/platform/core/src/services/DicomMetadataStore/createStudyMetadata.js index ee7415b9ac5..eaaab192a5b 100644 --- a/platform/core/src/services/DicomMetadataStore/createStudyMetadata.js +++ b/platform/core/src/services/DicomMetadataStore/createStudyMetadata.js @@ -26,7 +26,7 @@ function createStudyMetadata(StudyInstanceUID) { let series = this.series.find(s => s.SeriesInstanceUID === SeriesInstanceUID); if (!series) { - const series = createSeriesMetadata(SeriesInstanceUID); + series = createSeriesMetadata(SeriesInstanceUID); this.series.push(series); } diff --git a/platform/docs/docs/configuration/dataSources/configuration-ui.md b/platform/docs/docs/configuration/dataSources/configuration-ui.md index 15f3b0bcbad..b4279a26a2b 100644 --- a/platform/docs/docs/configuration/dataSources/configuration-ui.md +++ b/platform/docs/docs/configuration/dataSources/configuration-ui.md @@ -18,6 +18,11 @@ Google Cloud Healthcare data source. ![Data source configuration UI](../../assets/img/data-source-configuration-ui.png) +:::tip +A datasource root URI can be [fully or partially specified](../../deployment/google-cloud-healthcare.md#configuring-google-cloud-healthcare-as-a-datasource-in-ohif) +in the OHIF configuration file. +::: + ## `BaseDataSourceConfigurationAPIItem` interface Each (path) item of a data source is represented by an instance of this interface. diff --git a/platform/docs/docs/deployment/google-cloud-healthcare.md b/platform/docs/docs/deployment/google-cloud-healthcare.md index 80a654d2620..54df8bb029e 100644 --- a/platform/docs/docs/deployment/google-cloud-healthcare.md +++ b/platform/docs/docs/deployment/google-cloud-healthcare.md @@ -128,3 +128,12 @@ cd OHIFViewer yarn install APP_CONFIG=config/google.js yarn run dev ``` + +## Configuring Google Cloud Healthcare as a datasource in OHIF + +A Google Cloud Healthcare DICOM store can be configured as a DICOMweb datasource +in OHIF. A full or partial path is permitted in the configuration file. For +partial paths, the [data source configuration UI](../configuration/dataSources/configuration-ui.md) +will assist in filling in the missing pieces. For example, a configuration with +empty `wadoUriRoot`, `qidoRoot` and `wadoRoot` will prompt for the entire path +step-by-step starting with the project.