Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradient rebase Viewer v3.8.0 stable #19

Open
wants to merge 32 commits into
base: upstream_rebase_3-8-0_copy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3f5cd97
gradienthealth: whitelabel
Ouwen Oct 10, 2022
86c5507
config: bigquery
Ouwen Apr 9, 2023
de7e56e
fix: Ignored Series metadata retrieval promise handling for DicomJSON…
maya-mohan Sep 21, 2023
570c7bc
feat: Deploy viewer to github pages
maya-mohan Sep 27, 2023
2cbbbd1
feat:Added icad config
maya-mohan Sep 28, 2023
a27ca11
Merged icad.js config to gradient.js config.
maya-mohan Oct 3, 2023
24aab3a
Added requestTransferSyntaxUID in datasource config
maya-mohan Oct 3, 2023
7d6db2e
feat: stack viewport and non-reconstructable segmentation
Adithyan-Dinesh-Trenser Nov 6, 2023
acf1242
Added formpanel to segmentation mode and added form change listener i…
Adithyan-Dinesh-Trenser Jan 2, 2024
b7cb23f
Jump to referenced displaySet if segmentation is selected. ALso chang…
Adithyan-Dinesh-Trenser Jan 10, 2024
fd2ab40
Removed stack segmentation cache when segmentation is removed. Includ…
Adithyan-Dinesh-Trenser Jan 10, 2024
2e2687e
Deployed to production
Adithyan-Dinesh-Trenser Jan 12, 2024
e8db719
Skipped CORS and segment default color usage warnings and reorganized…
Adithyan-Dinesh-Trenser Jan 12, 2024
d099698
save to the same segmentation file if modified.
Adithyan-Dinesh-Trenser Jan 16, 2024
e0b6687
Changed the min size of segmentation brush and eraser to 0.01
Adithyan-Dinesh-Trenser Jan 17, 2024
20744ea
Removed the old segmentation file from fileManager when saving to sam…
Adithyan-Dinesh-Trenser Jan 17, 2024
4508c6a
updated the cornerstone deployment branch
Adithyan-Dinesh-Trenser Jan 17, 2024
ae82fd6
Implemented segment focus, modified segment brush unit and default si…
Adithyan-Dinesh-Trenser Feb 2, 2024
c916731
Skiped label dialog in auto saving flow even for new segmentations.
Adithyan-Dinesh-Trenser Feb 5, 2024
d0651fc
Made Min and max brush size configurable. Truncated segmentation labe…
Adithyan-Dinesh-Trenser Feb 22, 2024
627a247
Changed the configurable brush sizes unit to mm
Adithyan-Dinesh-Trenser Feb 28, 2024
49636fd
Fixed the issue of min/ max brush sizes not using configured values w…
Adithyan-Dinesh-Trenser Mar 1, 2024
09f9d47
Segmentation series description will be displayed using ImageLaterali…
Adithyan-Dinesh-Trenser Mar 6, 2024
f33f06d
Corrected the logic to access referenced displayset for newly created…
Adithyan-Dinesh-Trenser Mar 8, 2024
de02969
Added more properties to retain to segmentation file when saving segm…
Adithyan-Dinesh-Trenser Mar 15, 2024
8228d63
Due to script update for modifying the segmentation SeriesDescription…
Adithyan-Dinesh-Trenser Mar 18, 2024
5d699e8
Disabled add segmentation using url param
Adithyan-Dinesh-Trenser Mar 20, 2024
36a476d
Added hotkeys to activate segmentation brush and eraser tools.
Adithyan-Dinesh-Trenser Mar 25, 2024
ab378dc
Updated SeriesDate when saving segmentations instead of using the pre…
Adithyan-Dinesh-Trenser Mar 26, 2024
081924a
Trigger deploy
Adithyan-Dinesh-Trenser Jun 20, 2024
cb67680
Rebase to v3.8.0 stable changes
Adithyan-Dinesh-Trenser Jul 10, 2024
d3c818d
Added a null check for the cached volume.
Adithyan-Dinesh-Trenser Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/deploy_ghpages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Deploy viewer to github pages

on:
push:
branches: [ "gradienthealth/segmentation_mode_sheet_integration" ]
#pull_request:
#branches: [ "main" ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Checkout cornerstone3D
uses: actions/checkout@v3
with:
repository: gradienthealth/cornerstone3D-beta
ref: gradienthealth/segmentation_mode_sheet_integration
path: ./cornerstone3D

- name: Build cornerstone3D
run: |
cd ./cornerstone3D
yarn install
yarn build:all

- name: Checkout GradientExtensionsAndModes
uses: actions/checkout@v3
with:
repository: gradienthealth/GradientExtensionsAndModes
ref: gradienthealth/segmentation_mode_sheet_integration
path: ./GradientExtensionsAndModes

#- name: Build GradientExtensionsAndModes
# run: |
# cd ./GradientExtensionsAndModes/extensions/ohif-gradienthealth-extension
# yarn install
# yarn build:package
# cd ./modes/cohort
# yarn install
# yarn build:package

- name: Checkout Viewers
uses: actions/checkout@v3
with:
repository: gradienthealth/Viewers
path: ./Viewers

- name: Link
run: |
cd ./cornerstone3D/packages/adapters/dist
yarn link
cd ../../core/dist
yarn link
cd ../../dicomImageLoader/dist
yarn link
#cd ../../nifti-volume-loader/dist
#yarn link
cd ../../streaming-image-volume-loader/dist
yarn link
cd ../../tools/dist
yarn link
cd ../../../../Viewers
yarn link @cornerstonejs/adapters
yarn link @cornerstonejs/core
yarn link @cornerstonejs/dicom-image-loader
#yarn link @cornerstonejs/nifti-volume-loader
yarn link @cornerstonejs/streaming-image-volume-loader
yarn link @cornerstonejs/tools
yarn install
yarn run cli link-extension ../GradientExtensionsAndModes/extensions/ohif-gradienthealth-extension
yarn run cli link-mode ../GradientExtensionsAndModes/modes/cohort
yarn run cli link-mode ../GradientExtensionsAndModes/modes/breast-density-mode
yarn run build:gradient

- name: Checkout gh page
uses: actions/checkout@v3
with:
repository: gradienthealth/gradienthealth.github.io
path: ./gradienthealth.github.io
token: ${{ secrets.GH_DEPLOY_TOKEN }}

- name: Copy
run: |
mv ./gradienthealth.github.io/.git /tmp/
rm -r ./gradienthealth.github.io
cp -r ./Viewers/platform/app/dist/ ./gradienthealth.github.io
mv /tmp/.git ./gradienthealth.github.io
cd ./gradienthealth.github.io
cp index.html 404.html
git config --global user.name "maya-mohan"
git config --global user.email "[email protected]"
git remote set-url origin https://maya-mohan:${{ secrets.GH_DEPLOY_TOKEN }}@github.com/gradienthealth/gradienthealth.github.io
git add .
git commit -a -m "publishing viewer"
git push -u origin
75 changes: 45 additions & 30 deletions extensions/cornerstone-dicom-seg/src/commandsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import {
getUpdatedViewportsForSegmentation,
getTargetViewport,
} from './utils/hydrationUtils';
const { segmentation: segmentationUtils } = utilities;
import generateLabelmaps2DFromImageIdMap from './utils/generateLabelmaps2DFromImageIdMap';
import getSegmentLabel from './utils/getSegmentLabel';

const { segmentation: segmentationUtils } = utilities;
const { datasetToBlob } = dcmjs.data;

const {
Expand Down Expand Up @@ -80,17 +82,6 @@ const commandsModule = ({
// Todo: add support for multiple display sets
const displaySetInstanceUID = viewport.displaySetInstanceUIDs[0];

const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);

if (!displaySet.isReconstructable) {
uiNotificationService.show({
title: 'Segmentation',
message: 'Segmentation is not supported for non-reconstructible displaysets yet',
type: 'error',
});
return;
}

updateViewportsForSegmentationRendering({
viewportId,
servicesManager,
Expand All @@ -113,7 +104,7 @@ const commandsModule = ({
toolGroupId,
segmentIndex: 1,
properties: {
label: 'Segment 1',
label: getSegmentLabel(segmentationService.getSegmentation(segmentationId)),
},
});

Expand Down Expand Up @@ -245,14 +236,23 @@ const commandsModule = ({
*/
generateSegmentation: ({ segmentationId, options = {} }) => {
const segmentation = cornerstoneToolsSegmentation.state.getSegmentation(segmentationId);
const segmentationLabelmapData = segmentation.representationData.LABELMAP;

let referencedImages, labelmapObj;
if (segmentationLabelmapData.imageIdReferenceMap) {
const { imageIdReferenceMap } = segmentationLabelmapData;

const { referencedVolumeId } = segmentation.representationData.LABELMAP;
({ referencedImages, labelmapObj } =
generateLabelmaps2DFromImageIdMap(imageIdReferenceMap));
} else {
const { referencedVolumeId } = segmentationLabelmapData;

const segmentationVolume = cache.getVolume(segmentationId);
const referencedVolume = cache.getVolume(referencedVolumeId);
const referencedImages = referencedVolume.getCornerstoneImages();
const segmentationVolume = cache.getVolume(segmentationId);
const referencedVolume = cache.getVolume(referencedVolumeId);
referencedImages = referencedVolume.getCornerstoneImages();

const labelmapObj = generateLabelMaps2DFrom3D(segmentationVolume);
labelmapObj = generateLabelMaps2DFrom3D(segmentationVolume);
}

// Generate fake metadata as an example
labelmapObj.metadata = [];
Expand Down Expand Up @@ -326,28 +326,45 @@ const commandsModule = ({
* @returns {Object|void} Returns the naturalized report if successfully stored,
* otherwise throws an error.
*/
storeSegmentation: async ({ segmentationId, dataSource }) => {
const promptResult = await createReportDialogPrompt(uiDialogService, {
extensionManager,
});

if (promptResult.action !== 1 && promptResult.value) {
return;
}

storeSegmentation: async ({ segmentationId, dataSource, skipLabelDialog = false }) => {
const segmentation = segmentationService.getSegmentation(segmentationId);

if (!segmentation) {
throw new Error('No segmentation found');
}
const { label, displaySetInstanceUID } = segmentation;

const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
const shouldOverWrite = displaySet && displaySet.Modality === 'SEG';

let promptResult: { action?: number; value?: string } = {};

if (!(skipLabelDialog || shouldOverWrite)) {
promptResult = await createReportDialogPrompt(uiDialogService, {
extensionManager,
});

if (promptResult.action !== 1 && !promptResult.value) {
return;
}
}

const { label } = segmentation;
const SeriesDescription = promptResult.value || label || 'Research Derived Series';
segmentation.label = SeriesDescription;

const generatedData = actions.generateSegmentation({
segmentationId,
options: {
SeriesDescription,
// Use SeriesInstanceUID, SOPInstanceUID, SeriesNumber, Manufacturer and SeriesDate
// if displaySet of the segmentation already exists.
// Study level and patient metadata will be used automatically.
...(shouldOverWrite && {
SeriesInstanceUID: displaySet.SeriesInstanceUID,
SOPInstanceUID: displaySet.instances[0].SOPInstanceUID,
SeriesNumber: displaySet.SeriesNumber,
Manufacturer: displaySet.instances[0].Manufacturer,
}),
},
});

Expand All @@ -366,8 +383,6 @@ const commandsModule = ({
// add the information for where we stored it to the instance as well
naturalizedReport.wadoRoot = dataSource.getConfig().wadoRoot;

DicomMetadataStore.addInstances([naturalizedReport], true);

return naturalizedReport;
},
/**
Expand Down
26 changes: 17 additions & 9 deletions extensions/cornerstone-dicom-seg/src/getSopClassHandlerModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,27 @@ async function _loadSegments({ extensionManager, servicesManager, segDisplaySet,
'@ohif/extension-cornerstone.utilityModule.common'
);

const { segmentationService, uiNotificationService } = servicesManager.services;
const { segmentationService, uiNotificationService, displaySetService } =
servicesManager.services;

const { dicomLoaderService } = utilityModule.exports;
const arrayBuffer = await dicomLoaderService.findDicomDataPromise(segDisplaySet, null, headers);

const cachedReferencedVolume = cache.getVolume(segDisplaySet.referencedVolumeId);
const referencedDisplaySet = displaySetService.getDisplaySetByUID(
segDisplaySet.referencedDisplaySetInstanceUID
);
let imageIds;

if (!cachedReferencedVolume) {
throw new Error(
'Referenced Volume is missing for the SEG, and stack viewport SEG is not supported yet'
);
}
if (referencedDisplaySet.isReconstructable) {
const cachedReferencedVolume = cache.getVolume(segDisplaySet.referencedVolumeId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we can include above error message with a slight modification in message here?
if (!cachedReferencedVolume) {
throw new Error(
'Referenced Volume is missing for the SEG'
);

if (!cachedReferencedVolume) {
throw new Error('Referenced Volume is missing for the SEG');
}

const { imageIds } = cachedReferencedVolume;
imageIds = cachedReferencedVolume.imageIds || cachedReferencedVolume._imageIds;
} else {
imageIds = referencedDisplaySet.instances.map(instance => instance.imageId);
}

// Todo: what should be defaults here
const tolerance = 0.001;
Expand Down Expand Up @@ -198,6 +205,7 @@ async function _loadSegments({ extensionManager, servicesManager, segDisplaySet,
});
}

/* Skip the warning message as it is annoying on auto segmentations loading.
if (!usedRecommendedDisplayCIELabValue) {
// Display a notification about the non-utilization of RecommendedDisplayCIELabValue
uiNotificationService.show({
Expand All @@ -207,7 +215,7 @@ async function _loadSegments({ extensionManager, servicesManager, segDisplaySet,
type: 'warning',
duration: 5000,
});
}
}*/

Object.assign(segDisplaySet, results);
}
Expand Down
Loading