Skip to content

Commit

Permalink
fix(segmentation): Various fixes for segmentation mode and other (#3709)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbocce authored Oct 10, 2023
1 parent f845505 commit a9a6ad5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 => {
Expand Down
14 changes: 0 additions & 14 deletions modes/tmtv/src/toolbarButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
),
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions platform/docs/docs/deployment/google-cloud-healthcare.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit a9a6ad5

Please sign in to comment.