Skip to content

Commit

Permalink
feat(segmentation mode): Add create, and export SEG with Brushes (OHI…
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi authored and Sofien-Sellami committed Oct 5, 2023
1 parent 6244ac2 commit 32c2abe
Show file tree
Hide file tree
Showing 186 changed files with 6,804 additions and 2,886 deletions.
108 changes: 48 additions & 60 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ version: 2.1
##
orbs:
codecov: codecov/[email protected]
cypress: cypress-io/cypress@1.26.0
executors:
# Custom executor to override Cypress config
deploy-to-prod-executor:
docker:
- image: cimg/node:16.14
environment:
CYPRESS_BASE_URL: https://ohif-staging.netlify.com/
chrome-and-pacs:
docker:
# Primary container image where all steps run.
- image: 'cypress/browsers:node16.14.2-slim-chrome103-ff102'
cypress: cypress-io/cypress@3
# executors:
# # Custom executor to override Cypress config
# deploy-to-prod-executor:
# docker:
# - image: cimg/node:16.14
# environment:
# CYPRESS_BASE_URL: https://ohif-staging.netlify.com/
# chrome-and-pacs:
# docker:
# # Primary container image where all steps run.
# - image: 'cypress/browsers:node18.12.0-chrome106-ff106'

defaults: &defaults
docker:
Expand Down Expand Up @@ -363,32 +363,20 @@ jobs:
fi
workflows:
version: 2

PR_CHECKS:
jobs:
- UNIT_TESTS

# E2E: PWA
- cypress/run:
name: 'E2E: PWA'
executor: chrome-and-pacs
browser: chrome
pre-steps:
- run: |
# Clear yarn cache; use yarn from image (update image to update yarn)
rm -rf ~/.yarn
yarn -v
yarn: true
record: true
store_artifacts: true
working_directory: platform/app
build: yarn test:data
start: yarn run test:e2e:serve
spec: 'cypress/integration/**/*'
wait-on: 'http://localhost:3000'
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
start-command: yarn run test:data && yarn run test:e2e:serve
install-browsers: true
cypress-command:
'npx wait-on@latest http://localhost:3000 && cd platform/app && npx cypress run
--record --browser chrome --parallel'
package-manager: 'yarn'
cypress-cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
cypress-cache-path: '~/.cache/Cypress'
post-steps:
- store_artifacts:
path: platform/app/cypress/screenshots
Expand All @@ -399,34 +387,34 @@ workflows:
requires:
- UNIT_TESTS

PR_OPTIONAL_VISUAL_TESTS:
jobs:
- AWAIT_APPROVAL:
type: approval
# Update hub.docker.org
- cypress/run:
name: 'Generate Percy Snapshots'
executor: cypress/browsers-chrome76
browser: chrome
pre-steps:
- run: 'rm -rf ~/.yarn && yarn -v && yarn global add wait-on'
yarn: true
store_artifacts: false
working_directory: platform/app
build:
yarn test:data && npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js
yarn run build
# start server --> verify running --> percy + chrome + cypress
command: yarn run test:e2e:dist
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
no-workspace: true # Don't persist workspace
post-steps:
- store_artifacts:
path: platform/app/cypress/screenshots
- store_artifacts:
path: platform/app/cypress/videos
requires:
- AWAIT_APPROVAL
# PR_OPTIONAL_VISUAL_TESTS:
# jobs:
# - AWAIT_APPROVAL:
# type: approval
# # Update hub.docker.org
# - cypress/run:
# name: 'Generate Percy Snapshots'
# executor: cypress/browsers-chrome76
# browser: chrome
# pre-steps:
# - run: 'rm -rf ~/.yarn && yarn -v && yarn global add wait-on'
# yarn: true
# store_artifacts: false
# working_directory: platform/app
# build:
# yarn test:data && npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js
# yarn run build
# # start server --> verify running --> percy + chrome + cypress
# command: yarn run test:e2e:dist
# cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'
# no-workspace: true # Don't persist workspace
# post-steps:
# - store_artifacts:
# path: platform/app/cypress/screenshots
# - store_artifacts:
# path: platform/app/cypress/videos
# requires:
# - AWAIT_APPROVAL

# Our master branch deploys to viewer-dev.ohif.org, the viewer.ohif.org is
# deployed from the release branch which is more stable and less frequently updated.
Expand Down
2 changes: 0 additions & 2 deletions extensions/cornerstone-dicom-rt/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { id } from './id';
import React from 'react';
import { Types } from '@ohif/core';
import getSopClassHandlerModule from './getSopClassHandlerModule';
import hydrateRTDisplaySet from './utils/_hydrateRT';

const Component = React.lazy(() => {
return import(/* webpackPrefetch: true */ './viewports/OHIFCornerstoneRTViewport');
Expand Down Expand Up @@ -60,4 +59,3 @@ const extension: Types.Extensions.Extension = {
};

export default extension;
export { hydrateRTDisplaySet };
70 changes: 0 additions & 70 deletions extensions/cornerstone-dicom-rt/src/utils/_hydrateRT.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function createRTToolGroupAndAddTools(ToolGroupService, customizationService, toolGroupId) {
const { tools } = customizationService.get('cornerstone.overlayViewportTools') ?? {};

return ToolGroupService.createToolGroupAndAddTools(toolGroupId, tools, {});
return ToolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
}

export default createRTToolGroupAndAddTools;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ButtonEnums } from '@ohif/ui';
import hydrateRTDisplaySet from './_hydrateRT';

const RESPONSE = {
NO_NEVER: -1,
Expand All @@ -13,6 +12,7 @@ function promptHydrateRT({
viewportId,
toolGroupId = 'default',
preHydrateCallbacks,
hydrateRTDisplaySet,
}) {
const { uiViewportDialogService } = servicesManager.services;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import PropTypes from 'prop-types';
import OHIF, { utils } from '@ohif/core';
import { ViewportActionBar, useViewportGrid, LoadingIndicatorTotalPercent } from '@ohif/ui';

import _hydrateRTdisplaySet from '../utils/_hydrateRT';
import promptHydrateRT from '../utils/promptHydrateRT';
import _getStatusComponent from './_getStatusComponent';
import createRTToolGroupAndAddTools from '../utils/initRTToolGroup';
import _hydrateRTDisplaySet from '../utils/_hydrateRT';

const { formatDate } = utils;
const RT_TOOLGROUP_BASE_NAME = 'RTToolGroup';
Expand Down Expand Up @@ -95,6 +93,13 @@ function OHIFCornerstoneRTViewport(props) {
});
}, [viewportGrid]);

const hydrateRTDisplaySet = ({ rtDisplaySet, viewportId }) => {
commandsManager.runCommand('loadSegmentationDisplaySetsForViewport', {
displaySets: [rtDisplaySet],
viewportId,
});
};

const getCornerstoneViewport = useCallback(() => {
const { component: Component } = extensionManager.getModuleEntry(
'@ohif/extension-cornerstone.viewportModule.cornerstone'
Expand Down Expand Up @@ -154,6 +159,7 @@ function OHIFCornerstoneRTViewport(props) {
viewportId,
rtDisplaySet,
preHydrateCallbacks: [storePresentationState],
hydrateRTDisplaySet,
}).then(isHydrated => {
if (isHydrated) {
setIsHydrated(true);
Expand Down Expand Up @@ -295,10 +301,9 @@ function OHIFCornerstoneRTViewport(props) {
// presentation state (w/l and invert) and then opens the RT. If we don't store
// the presentation state, the viewport will be reset to the default presentation
storePresentationState();
const isHydrated = await _hydrateRTDisplaySet({
const isHydrated = await hydrateRTDisplaySet({
rtDisplaySet,
viewportId,
servicesManager,
});

setIsHydrated(isHydrated);
Expand Down
1 change: 1 addition & 0 deletions extensions/cornerstone-dicom-seg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"react-router-dom": "^6.8.1"
},
"dependencies": {
"@cornerstonejs/tools": "^1.16.4",
"@babel/runtime": "^7.20.13",
"react-color": "^2.19.3"
}
Expand Down
Loading

0 comments on commit 32c2abe

Please sign in to comment.