fix(tmtv): fix toggle one up weird behaviours (#4473)

This commit is contained in:
Alireza 2024-11-07 00:20:30 -05:00 committed by GitHub
parent 3f7ae76113
commit aa2b649444
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 58 additions and 63 deletions

View File

@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^2.1.16",
"@cornerstonejs/core": "^2.1.16",
"@cornerstonejs/adapters": "^2.1.17",
"@cornerstonejs/core": "^2.1.17",
"@kitware/vtk.js": "32.1.0",
"react-color": "^2.19.3"
}

View File

@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^2.1.16",
"@cornerstonejs/core": "^2.1.16",
"@cornerstonejs/adapters": "^2.1.17",
"@cornerstonejs/core": "^2.1.17",
"@kitware/vtk.js": "32.1.0",
"react-color": "^2.19.3"
}

View File

@ -46,9 +46,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^2.1.16",
"@cornerstonejs/core": "^2.1.16",
"@cornerstonejs/tools": "^2.1.16",
"@cornerstonejs/adapters": "^2.1.17",
"@cornerstonejs/core": "^2.1.17",
"@cornerstonejs/tools": "^2.1.17",
"classnames": "^2.3.2"
}
}

View File

@ -42,8 +42,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/core": "^2.1.16",
"@cornerstonejs/tools": "^2.1.16",
"@cornerstonejs/core": "^2.1.17",
"@cornerstonejs/tools": "^2.1.17",
"classnames": "^2.3.2"
}
}

View File

@ -38,7 +38,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.4",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^2.1.16",
"@cornerstonejs/dicom-image-loader": "^2.1.17",
"@icr/polyseg-wasm": "^0.4.0",
"@ohif/core": "3.9.0-beta.107",
"@ohif/ui": "3.9.0-beta.107",
@ -55,9 +55,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^2.1.16",
"@cornerstonejs/core": "^2.1.16",
"@cornerstonejs/tools": "^2.1.16",
"@cornerstonejs/adapters": "^2.1.17",
"@cornerstonejs/core": "^2.1.17",
"@cornerstonejs/tools": "^2.1.17",
"@icr/polyseg-wasm": "^0.4.0",
"@kitware/vtk.js": "32.1.0",
"html2canvas": "^1.4.1",

View File

@ -871,7 +871,7 @@ function commandsModule({
}
crosshairInstances.forEach(ins => {
ins?.resetCrosshairs();
ins?.computeToolCenter();
});
},
/**

View File

@ -110,22 +110,20 @@ function ViewportSegmentationMenu({
<Separator className="bg-input mb-3" />
<span className="text-muted-foreground mb-2 text-xs font-semibold">Available</span>
<ul className="space-y-1">
{availableSegmentations.map(segmentation => (
{availableSegmentations.map(({segmentationId, label}) => (
<li
key={segmentation.segmentation.segmentationId}
key={segmentationId}
className="flex items-center text-sm"
>
<Button
variant="ghost"
size="icon"
className="text-muted-foreground mr-2"
onClick={() =>
addSegmentationToViewport(segmentation.segmentation.segmentationId)
}
onClick={() => addSegmentationToViewport(segmentationId)}
>
<Icons.Plus className="h-6 w-6" />
</Button>
<span className="text-foreground/60">{segmentation.segmentation.label}</span>
<span className="text-foreground/60">{label}</span>
</li>
))}
</ul>

View File

@ -2,6 +2,7 @@ import React, { ReactNode, useEffect, useState } from 'react';
import { Button, Icons, Popover, PopoverContent, PopoverTrigger } from '@ohif/ui-next';
import ViewportSegmentationMenu from './ViewportSegmentationMenu';
import classNames from 'classnames';
import { useSegmentations } from '../../hooks/useSegmentations';
export function ViewportSegmentationMenuWrapper({
viewportId,
@ -13,35 +14,16 @@ export function ViewportSegmentationMenuWrapper({
viewportId: string;
element: HTMLElement;
}>): ReactNode {
const { segmentationService, viewportActionCornersService, viewportGridService } =
servicesManager.services;
const [representations, setRepresentations] = useState(null);
const { viewportActionCornersService, viewportGridService } = servicesManager.services;
useEffect(() => {
const representations = segmentationService.getSegmentationRepresentations(viewportId);
setRepresentations(representations);
}, [viewportId, segmentationService]);
useEffect(() => {
const { unsubscribe } = segmentationService.subscribe(
segmentationService.EVENTS.SEGMENTATION_REPRESENTATION_MODIFIED,
() => {
const representations = segmentationService.getSegmentationRepresentations(viewportId);
setRepresentations(representations);
}
);
return () => {
unsubscribe();
};
}, [viewportId, segmentationService]);
const segmentations = useSegmentations({ servicesManager });
const activeViewportId = viewportGridService.getActiveViewportId();
const isActiveViewport = viewportId === activeViewportId;
const { align, side } = getAlignAndSide(viewportActionCornersService, location);
if (!representations?.length) {
if (!segmentations?.length) {
return null;
}

View File

@ -371,6 +371,11 @@ const commandsModule = ({
findOrCreateViewport,
isHangingProtocolLayout: true,
});
// Reset crosshairs after restoring the layout
setTimeout(() => {
commandsManager.runCommand('resetCrosshairs');
}, 0);
} else {
// We are not in one-up, so toggle to one up.

View File

@ -32,8 +32,8 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "^2.1.16",
"@cornerstonejs/tools": "^2.1.16",
"@cornerstonejs/core": "^2.1.17",
"@cornerstonejs/tools": "^2.1.17",
"@ohif/core": "3.9.0-beta.107",
"@ohif/extension-cornerstone-dicom-sr": "3.9.0-beta.107",
"@ohif/extension-default": "3.9.0-beta.107",

View File

@ -53,7 +53,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.4",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^2.1.16",
"@cornerstonejs/dicom-image-loader": "^2.1.17",
"@emotion/serialize": "^1.1.3",
"@ohif/core": "3.9.0-beta.107",
"@ohif/extension-cornerstone": "3.9.0-beta.107",

View File

@ -37,7 +37,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.4",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^2.1.16",
"@cornerstonejs/dicom-image-loader": "^2.1.17",
"@ohif/ui": "3.9.0-beta.107",
"cornerstone-math": "0.1.9",
"dicom-parser": "^1.8.21"

View File

@ -6,6 +6,12 @@ title: General
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Not SharedArrayBuffer anymore!
We have streamlined the process of loading volumes without sacrificing speed by eliminating the need for shared array buffers. This change resolves issues across various frameworks, where previously, specific security headers were required. Now, you can remove any previously set headers, which lowers the barrier for adopting Cornerstone 3D in frameworks that didn't support those headers. Shared array buffers are no longer necessary, and all related headers can be removed.
You can remove `Cross-Origin-Opener-Policy` and `Cross-Origin-Embedder-Policy` from your custom headers if you don't need them in other
aspects of your app.
# React 18 Migration Guide
As we upgrade to React 18, we're making some exciting changes to improve performance and developer experience. This guide will help you navigate the key updates and ensure your custom extensions and modes are compatible with the new version.

View File

@ -1,9 +1,13 @@
---
id: seg-creation
title: SegmentationService Creation
title: Segmentation Creation
---
## createEmptySegmentationForViewport
is now `createLabelmapForViewport` to align with other segmentation creation methods.
Run it using `commandsManager.runCommand('createLabelmapForViewport', {viewportId})`.
## createSegmentationForDisplaySet

View File

@ -2580,10 +2580,10 @@
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==
"@cornerstonejs/adapters@^2.1.14":
version "2.1.14"
resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-2.1.14.tgz#8306b2b90d0f67eadad12c0edc851bf2b6d472a2"
integrity sha512-Lolq+cuaLXPiopv29J2YdKYyRRNLtRtDwT2Sn6S+Ir585qZt6VaXXGeTNFJzhUa0HkI8MMroM6FcK2R0LgVJ3Q==
"@cornerstonejs/adapters@^2.1.17":
version "2.1.17"
resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-2.1.17.tgz#509e62d500c733ab8babde7a3918548d59d6fa08"
integrity sha512-+eptnnP+C+qKfRh0t0ZoZqQvxtDtwXZzMWk5IzNs/APRPh4XTt/VGh4hWt9UPUwxldG67k/bndjxilQkFUVNkA==
dependencies:
"@babel/runtime-corejs2" "^7.17.8"
buffer "^6.0.3"
@ -2616,19 +2616,19 @@
resolved "https://registry.yarnpkg.com/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.5.tgz#8690b61a86fa53ef38a70eee9d665a79229517c0"
integrity sha512-MZCUy8VG0VG5Nl1l58+g+kH3LujAzLYTfJqkwpWI2gjSrGXnP6lgwyy4GmPRZWVoS40/B1LDNALK905cNWm+sg==
"@cornerstonejs/core@^2.1.14":
version "2.1.14"
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-2.1.14.tgz#f289b902f72f712e860e1f16cae8f3baa488ee88"
integrity sha512-TnmM4maKRWnS9pRz/E6sjETKxupVa/6Jfpi6BXaenTBKk9shx/c9pdKDv94ISKklQFWmlEDC6Ny1YnbxRUaJ7g==
"@cornerstonejs/core@^2.1.17":
version "2.1.17"
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-2.1.17.tgz#3cf4e7b586fccc0cd430947933f69bb08aaa6839"
integrity sha512-rtjRzRlEWk95Q4xlWkUaLitcX9g6bPsGXLASDm2nds8Dd5aEXCnPyEdBo6ow/rhvanohd7I1eC2fK2Wz7WWbJw==
dependencies:
"@kitware/vtk.js" "32.1.0"
comlink "^4.4.1"
gl-matrix "^3.4.3"
"@cornerstonejs/dicom-image-loader@^2.1.14":
version "2.1.14"
resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-2.1.14.tgz#851abcf8cf96813f071457972ff559366350f550"
integrity sha512-HOErmh6BuWnaERSRbnwYQ9llXlr5JS0/hc5OBzCXoDIb+jdCgomtpF0Ad0HoHaLWHbf6G/nzgDNlBV3wbsaUbA==
"@cornerstonejs/dicom-image-loader@^2.1.17":
version "2.1.17"
resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-2.1.17.tgz#5429a10b921ed5586f093f51a363524e45cf6ecb"
integrity sha512-UIH4th4+F+a2s/myACpEmMjkPWFljAFbXeoj2Qo0JpL02FYYYGQuO7Ov+gjK/gv90twAh7q8Qg2+yNbHkC9pzA==
dependencies:
"@cornerstonejs/codec-charls" "^1.2.3"
"@cornerstonejs/codec-libjpeg-turbo-8bit" "^1.2.2"
@ -2638,10 +2638,10 @@
pako "^2.0.4"
uuid "^9.0.0"
"@cornerstonejs/tools@^2.1.14":
version "2.1.14"
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-2.1.14.tgz#373379a93d03211837652a29e37c827dec7aeddf"
integrity sha512-GlonYhtD0ex3JWGEF+ZLeEug53FJ7XZJB8W7qLlb7f8l47bhfTT2sJ9psADOs/BxrsRGjacrcW7majlW4mMFoQ==
"@cornerstonejs/tools@^2.1.17":
version "2.1.17"
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-2.1.17.tgz#74e7a18845da779f5bc513902de6dbfe1880add0"
integrity sha512-vHdCVKV0kxYgvbS2ff9lDjd6AOKy6hP2Ohp96ac0enbZBNakUwDhqxWp94SezKqK7vn19fxRdSnPRLIchrqvJA==
dependencies:
"@types/offscreencanvas" "2019.7.3"
comlink "^4.4.1"