init
This commit is contained in:
12
modes/preclinical-4d/.webpack/webpack.dev.js
Normal file
12
modes/preclinical-4d/.webpack/webpack.dev.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const path = require('path');
|
||||
const webpackCommon = require('./../../../.webpack/webpack.base.js');
|
||||
const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.tsx`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
|
||||
};
|
||||
53
modes/preclinical-4d/.webpack/webpack.prod.js
Normal file
53
modes/preclinical-4d/.webpack/webpack.prod.js
Normal file
@@ -0,0 +1,53 @@
|
||||
const webpack = require('webpack');
|
||||
const { merge } = require('webpack-merge');
|
||||
const path = require('path');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
const pkg = require('./../package.json');
|
||||
const webpackCommon = require('./../../../.webpack/webpack.base.js');
|
||||
|
||||
const ROOT_DIR = path.join(__dirname, './../');
|
||||
const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.tsx`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
|
||||
|
||||
return merge(commonConfig, {
|
||||
stats: {
|
||||
colors: true,
|
||||
hash: true,
|
||||
timings: true,
|
||||
assets: true,
|
||||
chunks: false,
|
||||
chunkModules: false,
|
||||
modules: false,
|
||||
children: false,
|
||||
warnings: true,
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
sideEffects: false,
|
||||
},
|
||||
output: {
|
||||
path: ROOT_DIR,
|
||||
library: 'ohif-mode-preclinical-4d',
|
||||
libraryTarget: 'umd',
|
||||
libraryExport: 'default',
|
||||
filename: pkg.main,
|
||||
},
|
||||
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/],
|
||||
plugins: [
|
||||
new webpack.optimize.LimitChunkCountPlugin({
|
||||
maxChunks: 1,
|
||||
}),
|
||||
// new MiniCssExtractPlugin({
|
||||
// filename: './dist/[name].css',
|
||||
// chunkFilename: './dist/[id].css',
|
||||
// }),
|
||||
],
|
||||
});
|
||||
};
|
||||
1116
modes/preclinical-4d/CHANGELOG.md
Normal file
1116
modes/preclinical-4d/CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
9
modes/preclinical-4d/LICENSE
Normal file
9
modes/preclinical-4d/LICENSE
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 4d ()
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
7
modes/preclinical-4d/README.md
Normal file
7
modes/preclinical-4d/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# 4d
|
||||
## Description
|
||||
|
||||
## Author
|
||||
OHIF
|
||||
## License
|
||||
MIT
|
||||
44
modes/preclinical-4d/babel.config.js
Normal file
44
modes/preclinical-4d/babel.config.js
Normal file
@@ -0,0 +1,44 @@
|
||||
module.exports = {
|
||||
plugins: ['@babel/plugin-proposal-class-properties'],
|
||||
env: {
|
||||
test: {
|
||||
presets: [
|
||||
[
|
||||
// TODO: https://babeljs.io/blog/2019/03/19/7.4.0#migration-from-core-js-2
|
||||
'@babel/preset-env',
|
||||
{
|
||||
modules: 'commonjs',
|
||||
debug: false,
|
||||
},
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
'@babel/preset-react',
|
||||
],
|
||||
plugins: [
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-transform-regenerator',
|
||||
'@babel/plugin-transform-runtime',
|
||||
],
|
||||
},
|
||||
production: {
|
||||
presets: [
|
||||
// WebPack handles ES6 --> Target Syntax
|
||||
['@babel/preset-env', { modules: false }],
|
||||
'@babel/preset-react',
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
|
||||
},
|
||||
development: {
|
||||
presets: [
|
||||
// WebPack handles ES6 --> Target Syntax
|
||||
['@babel/preset-env', { modules: false }],
|
||||
'@babel/preset-react',
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
plugins: ['react-refresh/babel'],
|
||||
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
|
||||
},
|
||||
},
|
||||
};
|
||||
47
modes/preclinical-4d/package.json
Normal file
47
modes/preclinical-4d/package.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "@ohif/mode-preclinical-4d",
|
||||
"version": "3.9.1",
|
||||
"description": "4D Workflow",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
"repository": "OHIF/Viewers",
|
||||
"main": "dist/index.umd.js",
|
||||
"module": "src/index.tsx",
|
||||
"engines": {
|
||||
"node": ">=14",
|
||||
"npm": ">=6",
|
||||
"yarn": ">=1.16.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/**",
|
||||
"public/**",
|
||||
"README.md"
|
||||
],
|
||||
"keywords": [
|
||||
"ohif-mode"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_ENV=development webpack --config .webpack/webpack.dev.js --watch --debug --output-pathinfo",
|
||||
"dev:cornerstone": "yarn run dev",
|
||||
"build": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
|
||||
"build:package": "yarn run build",
|
||||
"start": "yarn run dev",
|
||||
"test:unit": "jest --watchAll",
|
||||
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ohif/core": "3.9.1",
|
||||
"@ohif/extension-cornerstone": "3.9.1",
|
||||
"@ohif/extension-cornerstone-dicom-seg": "3.9.1",
|
||||
"@ohif/extension-cornerstone-dynamic-volume": "3.9.1",
|
||||
"@ohif/extension-default": "3.9.1",
|
||||
"@ohif/extension-tmtv": "3.9.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webpack": "5.94.0",
|
||||
"webpack-merge": "^5.7.3"
|
||||
}
|
||||
}
|
||||
103
modes/preclinical-4d/src/getWorkflowSettings.ts
Normal file
103
modes/preclinical-4d/src/getWorkflowSettings.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
const dynamicVolume = {
|
||||
sopClassHandler:
|
||||
'@ohif/extension-cornerstone-dynamic-volume.sopClassHandlerModule.dynamic-volume',
|
||||
leftPanel: '@ohif/extension-cornerstone-dynamic-volume.panelModule.dynamic-volume',
|
||||
segmentation: '@ohif/extension-cornerstone-dynamic-volume.panelModule.dynamic-segmentation',
|
||||
};
|
||||
|
||||
const cornerstone = {
|
||||
segmentation: '@ohif/extension-cornerstone.panelModule.panelSegmentationNoHeader',
|
||||
activeViewportWindowLevel: '@ohif/extension-cornerstone.panelModule.activeViewportWindowLevel',
|
||||
};
|
||||
|
||||
const defaultButtons = {
|
||||
buttonSection: 'primary',
|
||||
buttons: ['MeasurementTools', 'Zoom', 'WindowLevel', 'Crosshairs', 'Pan'],
|
||||
};
|
||||
|
||||
const defaultLeftPanel = [[dynamicVolume.leftPanel, cornerstone.activeViewportWindowLevel]];
|
||||
|
||||
const defaultLayout = {
|
||||
panels: {
|
||||
left: defaultLeftPanel,
|
||||
right: [],
|
||||
},
|
||||
};
|
||||
|
||||
function getWorkflowSettings({ servicesManager }) {
|
||||
return {
|
||||
steps: [
|
||||
{
|
||||
id: 'dataPreparation',
|
||||
name: 'Data Preparation',
|
||||
layout: {
|
||||
panels: {
|
||||
left: defaultLeftPanel,
|
||||
},
|
||||
},
|
||||
toolbarButtons: defaultButtons,
|
||||
hangingProtocol: {
|
||||
protocolId: 'default4D',
|
||||
stageId: 'dataPreparation',
|
||||
},
|
||||
info: 'In the Data Preparation step, you can visualize the dynamic PT volume data in three orthogonal views: axial, sagittal, and coronal. Use the left panel controls to adjust the visualization settings, such as playback speed, or navigate between different frames. This step allows you to assess the quality of the PT data and prepare for further analysis or registration with other modalities.',
|
||||
},
|
||||
{
|
||||
id: 'registration',
|
||||
name: 'Registration',
|
||||
layout: defaultLayout,
|
||||
toolbarButtons: defaultButtons,
|
||||
hangingProtocol: {
|
||||
protocolId: 'default4D',
|
||||
stageId: 'registration',
|
||||
},
|
||||
info: 'The Registration step provides a comprehensive view of the CT, PT, and fused CT-PT volume data in multiple orientations. The fusion viewports display the CT and PT volumes overlaid, allowing you to visually assess the alignment and registration between the two modalities. The individual CT and PT viewports are also available for side-by-side comparison. This step is crucial for ensuring proper registration before proceeding with further analysis or quantification.',
|
||||
},
|
||||
{
|
||||
id: 'roiQuantification',
|
||||
name: 'ROI Quantification',
|
||||
layout: {
|
||||
panels: {
|
||||
left: defaultLeftPanel,
|
||||
right: [[dynamicVolume.segmentation]],
|
||||
},
|
||||
options: {
|
||||
leftPanelClosed: false,
|
||||
rightPanelClosed: false,
|
||||
},
|
||||
},
|
||||
toolbarButtons: [
|
||||
defaultButtons,
|
||||
{
|
||||
buttonSection: 'dynamic-toolbox',
|
||||
buttons: ['BrushTools', 'RectangleROIStartEndThreshold'],
|
||||
},
|
||||
],
|
||||
hangingProtocol: {
|
||||
protocolId: 'default4D',
|
||||
stageId: 'roiQuantification',
|
||||
},
|
||||
info: 'The ROI quantification step allows you to define regions of interest (ROIs) with labelmap segmentations, on the fused CT-PT volume data using the labelmap tools. The left panel provides controls for adjusting the dynamic volume visualization, while the right panel offers tools for segmentation, editing, and exporting the ROI data. This step enables you to quantify the uptake or other measures within the defined ROIs for further analysis.',
|
||||
},
|
||||
{
|
||||
id: 'kineticAnalysis',
|
||||
name: 'Kinetic Analysis',
|
||||
layout: defaultLayout,
|
||||
toolbarButtons: defaultButtons,
|
||||
hangingProtocol: {
|
||||
protocolId: 'default4D',
|
||||
stageId: 'kineticAnalysis',
|
||||
},
|
||||
onEnter: [
|
||||
{
|
||||
commandName: 'updateSegmentationsChartDisplaySet',
|
||||
options: { servicesManager },
|
||||
},
|
||||
],
|
||||
info: 'The Kinetic Analysis step provides a comprehensive view for visualizing and analyzing the dynamic data derived from the ROI segmentations. The fusion viewports display the combined CT-PT volume data, while a dedicated viewport shows a series chart representing the data over time. This step allows you to explore the temporal dynamics of the uptake or other kinetic measures within the defined regions of interest, enabling further quantitative analysis and modeling.',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export { getWorkflowSettings as default };
|
||||
5
modes/preclinical-4d/src/id.js
Normal file
5
modes/preclinical-4d/src/id.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import packageJson from '../package.json';
|
||||
|
||||
const id = packageJson.name;
|
||||
|
||||
export { id };
|
||||
196
modes/preclinical-4d/src/index.tsx
Normal file
196
modes/preclinical-4d/src/index.tsx
Normal file
@@ -0,0 +1,196 @@
|
||||
import { id } from './id';
|
||||
import { hotkeys } from '@ohif/core';
|
||||
import initWorkflowSteps from './initWorkflowSteps';
|
||||
import initToolGroups from './initToolGroups';
|
||||
import toolbarButtons from './toolbarButtons';
|
||||
import segmentationButtons from './segmentationButtons';
|
||||
|
||||
const extensionDependencies = {
|
||||
'@ohif/extension-default': '3.7.0-beta.76',
|
||||
'@ohif/extension-cornerstone': '3.7.0-beta.76',
|
||||
'@ohif/extension-cornerstone-dynamic-volume': '3.7.0-beta.76',
|
||||
'@ohif/extension-cornerstone-dicom-seg': '3.7.0-beta.76',
|
||||
'@ohif/extension-tmtv': '3.7.0-beta.76',
|
||||
};
|
||||
|
||||
const ohif = {
|
||||
layout: '@ohif/extension-default.layoutTemplateModule.viewerLayout',
|
||||
defaultSopClassHandler: '@ohif/extension-default.sopClassHandlerModule.stack',
|
||||
chartSopClassHandler: '@ohif/extension-default.sopClassHandlerModule.chart',
|
||||
hangingProtocol: '@ohif/extension-default.hangingProtocolModule.default',
|
||||
leftPanel: '@ohif/extension-default.panelModule.seriesList',
|
||||
rightPanel: '@ohif/extension-default.panelModule.measure',
|
||||
chartViewport: '@ohif/extension-default.viewportModule.chartViewport',
|
||||
};
|
||||
|
||||
const dynamicVolume = {
|
||||
leftPanel: '@ohif/extension-cornerstone-dynamic-volume.panelModule.dynamic-volume',
|
||||
};
|
||||
|
||||
const cornerstone = {
|
||||
viewport: '@ohif/extension-cornerstone.viewportModule.cornerstone',
|
||||
activeViewportWindowLevel: '@ohif/extension-cornerstone.panelModule.activeViewportWindowLevel',
|
||||
};
|
||||
|
||||
function modeFactory({ modeConfiguration }) {
|
||||
return {
|
||||
id,
|
||||
routeName: 'dynamic-volume',
|
||||
displayName: 'Preclinical 4D',
|
||||
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }: withAppTypes) {
|
||||
const {
|
||||
measurementService,
|
||||
toolbarService,
|
||||
cineService,
|
||||
cornerstoneViewportService,
|
||||
toolGroupService,
|
||||
customizationService,
|
||||
viewportGridService,
|
||||
} = servicesManager.services;
|
||||
|
||||
const utilityModule = extensionManager.getModuleEntry(
|
||||
'@ohif/extension-cornerstone.utilityModule.tools'
|
||||
);
|
||||
|
||||
const { toolNames, Enums } = utilityModule.exports;
|
||||
|
||||
measurementService.clearMeasurements();
|
||||
initToolGroups({ toolNames, Enums, toolGroupService, commandsManager, servicesManager });
|
||||
|
||||
toolbarService.addButtons([...toolbarButtons, ...segmentationButtons]);
|
||||
toolbarService.createButtonSection('secondary', ['ProgressDropdown']);
|
||||
|
||||
// the primary button section is created in the workflow steps
|
||||
// specific to the step
|
||||
customizationService.addModeCustomizations([
|
||||
{
|
||||
id: 'PanelSegmentation.tableMode',
|
||||
mode: 'expanded',
|
||||
},
|
||||
{
|
||||
id: 'PanelSegmentation.onSegmentationAdd',
|
||||
onSegmentationAdd: () => {
|
||||
commandsManager.run('createNewLabelMapForDynamicVolume');
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'PanelSegmentation.showAddSegment',
|
||||
showAddSegment: false,
|
||||
},
|
||||
{
|
||||
id: 'PanelSegmentation.readableText',
|
||||
// remove following if you are not interested in that stats
|
||||
readableText: {
|
||||
lesionStats: 'Lesion Statistics',
|
||||
minValue: 'Minimum Value',
|
||||
maxValue: 'Maximum Value',
|
||||
meanValue: 'Mean Value',
|
||||
volume: 'Volume',
|
||||
suvPeak: 'SUV Peak',
|
||||
suvMax: 'Maximum SUV',
|
||||
suvMaxIJK: 'SUV Max IJK',
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
// Auto play the clip initially when the volumes are loaded
|
||||
const { unsubscribe } = cornerstoneViewportService.subscribe(
|
||||
cornerstoneViewportService.EVENTS.VIEWPORT_VOLUMES_CHANGED,
|
||||
() => {
|
||||
const viewportId = viewportGridService.getActiveViewportId();
|
||||
const csViewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
|
||||
cineService.playClip(csViewport.element, { viewportId });
|
||||
// cineService.setIsCineEnabled(true);
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
);
|
||||
},
|
||||
onSetupRouteComplete: ({ servicesManager }: withAppTypes) => {
|
||||
// This needs to run after hanging protocol matching process because
|
||||
// it may change the protocol/stage based on workflow stage settings
|
||||
initWorkflowSteps({ servicesManager });
|
||||
},
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
toolGroupService,
|
||||
syncGroupService,
|
||||
segmentationService,
|
||||
cornerstoneViewportService,
|
||||
} = servicesManager.services;
|
||||
|
||||
toolGroupService.destroy();
|
||||
syncGroupService.destroy();
|
||||
segmentationService.destroy();
|
||||
cornerstoneViewportService.destroy();
|
||||
},
|
||||
get validationTags() {
|
||||
return {
|
||||
study: [],
|
||||
series: [],
|
||||
};
|
||||
},
|
||||
isValidMode: ({ modalities, study }) => {
|
||||
// Todo: we need to find a better way to validate the mode
|
||||
return {
|
||||
valid: study.mrn === 'M1',
|
||||
description: 'This mode is only available for 4D PET/CT studies.',
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Mode Routes are used to define the mode's behavior. A list of Mode Route
|
||||
* that includes the mode's path and the layout to be used. The layout will
|
||||
* include the components that are used in the layout. For instance, if the
|
||||
* default layoutTemplate is used (id: '@ohif/extension-default.layoutTemplateModule.viewerLayout')
|
||||
* it will include the leftPanels, rightPanels, and viewports. However, if
|
||||
* you define another layoutTemplate that includes a Footer for instance,
|
||||
* you should provide the Footer component here too. Note: We use Strings
|
||||
* to reference the component's ID as they are registered in the internal
|
||||
* ExtensionManager. The template for the string is:
|
||||
* `${extensionId}.{moduleType}.${componentId}`.
|
||||
*/
|
||||
routes: [
|
||||
{
|
||||
path: 'preclinical-4d',
|
||||
layoutTemplate: ({ location, servicesManager }) => {
|
||||
return {
|
||||
id: ohif.layout,
|
||||
props: {
|
||||
leftPanels: [[dynamicVolume.leftPanel, cornerstone.activeViewportWindowLevel]],
|
||||
rightPanels: [],
|
||||
rightPanelClosed: true,
|
||||
viewports: [
|
||||
{
|
||||
namespace: cornerstone.viewport,
|
||||
displaySetsToDisplay: [ohif.defaultSopClassHandler],
|
||||
},
|
||||
{
|
||||
namespace: ohif.chartViewport,
|
||||
displaySetsToDisplay: [ohif.chartSopClassHandler],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
extensions: extensionDependencies,
|
||||
// Default protocol gets self-registered by default in the init
|
||||
hangingProtocol: 'default4D',
|
||||
// Order is important in sop class handlers when two handlers both use
|
||||
// the same sop class under different situations. In that case, the more
|
||||
// general handler needs to come last. For this case, the dicomvideo must
|
||||
// come first to remove video transfer syntax before ohif uses images
|
||||
sopClassHandlers: [ohif.chartSopClassHandler, ohif.defaultSopClassHandler],
|
||||
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||
};
|
||||
}
|
||||
|
||||
const mode = {
|
||||
id,
|
||||
modeFactory,
|
||||
extensionDependencies,
|
||||
};
|
||||
|
||||
export default mode;
|
||||
164
modes/preclinical-4d/src/initToolGroups.tsx
Normal file
164
modes/preclinical-4d/src/initToolGroups.tsx
Normal file
@@ -0,0 +1,164 @@
|
||||
const toolGroupIds = {
|
||||
default: 'dynamic4D-default',
|
||||
PT: 'dynamic4D-pt',
|
||||
Fusion: 'dynamic4D-fusion',
|
||||
CT: 'dynamic4D-ct',
|
||||
};
|
||||
|
||||
const colours = {
|
||||
'viewport-0': 'rgb(200, 0, 0)',
|
||||
'viewport-1': 'rgb(200, 200, 0)',
|
||||
'viewport-2': 'rgb(0, 200, 0)',
|
||||
};
|
||||
|
||||
const colorsByOrientation = {
|
||||
axial: 'rgb(200, 0, 0)',
|
||||
sagittal: 'rgb(200, 200, 0)',
|
||||
coronal: 'rgb(0, 200, 0)',
|
||||
};
|
||||
|
||||
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, servicesManager) {
|
||||
const { cornerstoneViewportService } = servicesManager.services;
|
||||
const tools = {
|
||||
active: [
|
||||
{
|
||||
toolName: toolNames.WindowLevel,
|
||||
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
|
||||
},
|
||||
{
|
||||
toolName: toolNames.Pan,
|
||||
bindings: [{ mouseButton: Enums.MouseBindings.Auxiliary }],
|
||||
},
|
||||
{
|
||||
toolName: toolNames.Zoom,
|
||||
bindings: [{ mouseButton: Enums.MouseBindings.Secondary }],
|
||||
},
|
||||
{
|
||||
toolName: toolNames.StackScroll,
|
||||
bindings: [{ mouseButton: Enums.MouseBindings.Wheel }],
|
||||
},
|
||||
],
|
||||
passive: [
|
||||
{ toolName: toolNames.Length },
|
||||
{ toolName: toolNames.ArrowAnnotate },
|
||||
{ toolName: toolNames.Bidirectional },
|
||||
{ toolName: toolNames.Probe },
|
||||
{ toolName: toolNames.EllipticalROI },
|
||||
{ toolName: toolNames.RectangleROI },
|
||||
{ toolName: toolNames.RectangleROIThreshold },
|
||||
{ toolName: toolNames.RectangleScissors },
|
||||
{ toolName: toolNames.PaintFill },
|
||||
{ toolName: toolNames.StackScroll },
|
||||
{ toolName: toolNames.Magnify },
|
||||
{
|
||||
toolName: 'CircularBrush',
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'FILL_INSIDE_CIRCLE',
|
||||
brushSize: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
toolName: 'CircularEraser',
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'ERASE_INSIDE_CIRCLE',
|
||||
brushSize: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
toolName: 'SphereBrush',
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'FILL_INSIDE_SPHERE',
|
||||
brushSize: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
toolName: 'SphereEraser',
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'ERASE_INSIDE_SPHERE',
|
||||
brushSize: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
toolName: 'ThresholdCircularBrush',
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_CIRCLE',
|
||||
brushSize: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
toolName: 'ThresholdSphereBrush',
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_SPHERE',
|
||||
brushSize: 7,
|
||||
},
|
||||
},
|
||||
{ toolName: toolNames.CircleScissors },
|
||||
{ toolName: toolNames.RectangleScissors },
|
||||
{ toolName: toolNames.SphereScissors },
|
||||
{ toolName: toolNames.StackScroll },
|
||||
{ toolName: toolNames.Magnify },
|
||||
],
|
||||
enabled: [],
|
||||
disabled: [
|
||||
{
|
||||
toolName: toolNames.Crosshairs,
|
||||
configuration: {
|
||||
viewportIndicators: true,
|
||||
viewportIndicatorsConfig: {
|
||||
circleRadius: 5,
|
||||
xOffset: 0.95,
|
||||
yOffset: 0.05,
|
||||
},
|
||||
disableOnPassive: true,
|
||||
autoPan: {
|
||||
enabled: false,
|
||||
panSize: 10,
|
||||
},
|
||||
getReferenceLineColor: viewportId => {
|
||||
const viewportInfo = cornerstoneViewportService.getViewportInfo(viewportId);
|
||||
const viewportOptions = viewportInfo?.viewportOptions;
|
||||
if (viewportOptions) {
|
||||
return (
|
||||
colours[viewportOptions.id] ||
|
||||
colorsByOrientation[viewportOptions.orientation] ||
|
||||
'#0c0'
|
||||
);
|
||||
} else {
|
||||
console.warn('missing viewport?', viewportId);
|
||||
return '#0c0';
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.PT, {
|
||||
...tools,
|
||||
passive: [...tools.passive, { toolName: 'RectangleROIStartEndThreshold' }],
|
||||
});
|
||||
|
||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.CT, {
|
||||
...tools,
|
||||
passive: [...tools.passive, { toolName: 'RectangleROIStartEndThreshold' }],
|
||||
});
|
||||
|
||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.Fusion, {
|
||||
...tools,
|
||||
passive: [...tools.passive, { toolName: 'RectangleROIStartEndThreshold' }],
|
||||
});
|
||||
|
||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.default, tools);
|
||||
}
|
||||
|
||||
function initToolGroups({ toolNames, Enums, toolGroupService, commandsManager, servicesManager }) {
|
||||
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager, servicesManager);
|
||||
}
|
||||
|
||||
export { initToolGroups as default, toolGroupIds };
|
||||
9
modes/preclinical-4d/src/initWorkflowSteps.ts
Normal file
9
modes/preclinical-4d/src/initWorkflowSteps.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import getWorkflowSettings from './getWorkflowSettings';
|
||||
|
||||
export default function initWorkflowSteps({ servicesManager }: withAppTypes): void {
|
||||
const { workflowStepsService } = servicesManager.services;
|
||||
const workflowSettings = getWorkflowSettings({ servicesManager });
|
||||
|
||||
workflowStepsService.addWorkflowSteps(workflowSettings.steps);
|
||||
workflowStepsService.setActiveWorkflowStep(workflowSettings.steps[0].id);
|
||||
}
|
||||
163
modes/preclinical-4d/src/segmentationButtons.ts
Normal file
163
modes/preclinical-4d/src/segmentationButtons.ts
Normal file
@@ -0,0 +1,163 @@
|
||||
import type { Button } from '@ohif/core/types';
|
||||
|
||||
const toolbarButtons: Button[] = [
|
||||
{
|
||||
id: 'BrushTools',
|
||||
uiType: 'ohif.buttonGroup',
|
||||
props: {
|
||||
groupId: 'BrushTools',
|
||||
items: [
|
||||
{
|
||||
id: 'Brush',
|
||||
icon: 'icon-tool-brush',
|
||||
label: 'Brush',
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircularBrush', 'SphereBrush'],
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Size (mm)',
|
||||
id: 'brush-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
step: 0.5,
|
||||
value: 7,
|
||||
commands: {
|
||||
commandName: 'setBrushSize',
|
||||
commandOptions: { toolNames: ['CircularBrush', 'SphereBrush'] },
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Shape',
|
||||
type: 'radio',
|
||||
id: 'brush-mode',
|
||||
value: 'CircularBrush',
|
||||
values: [
|
||||
{ value: 'CircularBrush', label: 'Circle' },
|
||||
{ value: 'SphereBrush', label: 'Sphere' },
|
||||
],
|
||||
commands: 'setToolActiveToolbar',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'Eraser',
|
||||
icon: 'icon-tool-eraser',
|
||||
label: 'Eraser',
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircularEraser', 'SphereEraser'],
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Radius (mm)',
|
||||
id: 'eraser-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
step: 0.5,
|
||||
value: 7,
|
||||
commands: {
|
||||
commandName: 'setBrushSize',
|
||||
commandOptions: { toolNames: ['CircularEraser', 'SphereEraser'] },
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Shape',
|
||||
type: 'radio',
|
||||
id: 'eraser-mode',
|
||||
value: 'CircularEraser',
|
||||
values: [
|
||||
{ value: 'CircularEraser', label: 'Circle' },
|
||||
{ value: 'SphereEraser', label: 'Sphere' },
|
||||
],
|
||||
commands: 'setToolActiveToolbar',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'Threshold',
|
||||
icon: 'icon-tool-threshold',
|
||||
label: 'Eraser',
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'],
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Radius (mm)',
|
||||
id: 'threshold-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
step: 0.5,
|
||||
value: 7,
|
||||
commands: {
|
||||
commandName: 'setBrushSize',
|
||||
commandOptions: {
|
||||
toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Shape',
|
||||
type: 'radio',
|
||||
id: 'eraser-mode',
|
||||
value: 'ThresholdCircularBrush',
|
||||
values: [
|
||||
{ value: 'ThresholdCircularBrush', label: 'Circle' },
|
||||
{ value: 'ThresholdSphereBrush', label: 'Sphere' },
|
||||
],
|
||||
commands: 'setToolActiveToolbar',
|
||||
},
|
||||
{
|
||||
name: 'ThresholdRange',
|
||||
type: 'double-range',
|
||||
id: 'threshold-range',
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 0.5,
|
||||
value: [2, 50],
|
||||
commands: {
|
||||
commandName: 'setThresholdRange',
|
||||
commandOptions: {
|
||||
toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'Shapes',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
label: 'Shapes',
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'],
|
||||
},
|
||||
icon: 'icon-tool-shape',
|
||||
options: [
|
||||
{
|
||||
name: 'Shape',
|
||||
type: 'radio',
|
||||
value: 'CircleScissor',
|
||||
id: 'shape-mode',
|
||||
values: [
|
||||
{ value: 'CircleScissor', label: 'Circle' },
|
||||
{ value: 'SphereScissor', label: 'Sphere' },
|
||||
{ value: 'RectangleScissor', label: 'Rectangle' },
|
||||
],
|
||||
commands: 'setToolActiveToolbar',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default toolbarButtons;
|
||||
166
modes/preclinical-4d/src/toolbarButtons.tsx
Normal file
166
modes/preclinical-4d/src/toolbarButtons.tsx
Normal file
@@ -0,0 +1,166 @@
|
||||
import { defaults, ToolbarService } from '@ohif/core';
|
||||
import { toolGroupIds } from './initToolGroups';
|
||||
|
||||
const { createButton } = ToolbarService;
|
||||
|
||||
const setToolActiveToolbar = {
|
||||
commandName: 'setToolActiveToolbar',
|
||||
commandOptions: {
|
||||
toolGroupIds: [toolGroupIds.PT, toolGroupIds.CT, toolGroupIds.Fusion, toolGroupIds.default],
|
||||
},
|
||||
};
|
||||
|
||||
const toolbarButtons = [
|
||||
{
|
||||
id: 'MeasurementTools',
|
||||
uiType: 'ohif.splitButton',
|
||||
props: {
|
||||
groupId: 'MeasurementTools',
|
||||
evaluate: 'evaluate.group.promoteToPrimaryIfCornerstoneToolNotActiveInTheList',
|
||||
primary: createButton({
|
||||
id: 'Length',
|
||||
icon: 'tool-length',
|
||||
label: 'Length',
|
||||
tooltip: 'Length Tool',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
}),
|
||||
secondary: {
|
||||
icon: 'chevron-down',
|
||||
tooltip: 'More Measure Tools',
|
||||
},
|
||||
items: [
|
||||
{
|
||||
id: 'Length',
|
||||
icon: 'tool-length',
|
||||
label: 'Length',
|
||||
tooltip: 'Length Tool',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
{
|
||||
id: 'Bidirectional',
|
||||
icon: 'tool-bidirectional',
|
||||
label: 'Bidirectional',
|
||||
tooltip: 'Bidirectional Tool',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
{
|
||||
id: 'ArrowAnnotate',
|
||||
icon: 'tool-annotate',
|
||||
label: 'Annotation',
|
||||
tooltip: 'Arrow Annotate',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
{
|
||||
id: 'EllipticalROI',
|
||||
icon: 'tool-ellipse',
|
||||
label: 'Ellipse',
|
||||
tooltip: 'Ellipse ROI',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'Zoom',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
icon: 'tool-zoom',
|
||||
label: 'Zoom',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'WindowLevel',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
icon: 'tool-window-level',
|
||||
label: 'Window Level',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'Pan',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
type: 'tool',
|
||||
icon: 'tool-move',
|
||||
label: 'Pan',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'TrackballRotate',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
type: 'tool',
|
||||
icon: 'tool-3d-rotate',
|
||||
label: '3D Rotate',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'Capture',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
icon: 'tool-capture',
|
||||
label: 'Capture',
|
||||
commands: 'showDownloadViewportModal',
|
||||
evaluate: [
|
||||
'evaluate.action',
|
||||
{
|
||||
name: 'evaluate.viewport.supported',
|
||||
unsupportedViewportTypes: ['video', 'wholeSlide'],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'Layout',
|
||||
uiType: 'ohif.layoutSelector',
|
||||
props: {
|
||||
rows: 3,
|
||||
columns: 4,
|
||||
evaluate: 'evaluate.action',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'Crosshairs',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
type: 'tool',
|
||||
icon: 'tool-crosshair',
|
||||
label: 'Crosshairs',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: 'evaluate.cornerstoneTool',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'ProgressDropdown',
|
||||
uiType: 'ohif.progressDropdown',
|
||||
},
|
||||
{
|
||||
id: 'RectangleROIStartEndThreshold',
|
||||
uiType: 'ohif.radioGroup',
|
||||
props: {
|
||||
icon: 'tool-create-threshold',
|
||||
label: 'Rectangle ROI Threshold',
|
||||
commands: setToolActiveToolbar,
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['RectangleROIStartEndThreshold'],
|
||||
},
|
||||
options: 'tmtv.RectangleROIThresholdOptions',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default toolbarButtons;
|
||||
Reference in New Issue
Block a user