feat: Add DICOM SEG support and MPR, referenceLines and StackSync and more (#3015)
* feat: add initial sop class handler for SEG * feat: move segmentation service * update segmentation service methods * fix: viewport data structure * feat: Add initial render for the DICOM SEG for each displaySet * fix: various wrong architectural dependencies between services * feat: initial separate SEG display in each viewport * feat: refactore viewport action bar * initial work for SEG hydration * fix: various bugs regarding drag and dropping different viewports * fix: rendering issues for multiple seg displaysets * fix: bugs for thumbnail and hydration * feat: fix the initial segment color * update after rebase * feat: initial design for the segmentation group table * feat: initial new design for the segmentation panel * feat: segmentation panel * feat: make segmentation appear on all related viewports * fix: segmentation load bug based on functional groups * initial work for segmentation crosshairs * fix: various stylings and functionality * fix: various stylings for the seg panel * fix: overflow styles * feat: add more ui components * feat: added segmentation config * feat: add jump to segment * feat: add jump to segment for DICOM SEG viewport * fix: bugs after rebase * feat: jump in segmentation viewport * fix: mpr support for seg * feat: add more icons * feat: new icons * feat: add new side panel * feat: add segmentation config * feat: add loading indicator to ohif * feat: make hanging protocols follow matching rules for viewports * feat: enhance drag and drop to be hanging protocol aware * fix: mpr restore previous layout * fix: crosshairs toggle * fix: add auth headers to the dicom loader via dicomwebclient * fix: bug for crosshairs toggle in mpr * fix: seg viewport reusing old toolGroup * feat: add loading animation with lottie * fix: various bugs for Segmentation hydration in mpr * feat: change outline alpha to outline opacity * feat: loading indicator for seg viewport * fix: various segmentation group styles * fix: local mode for seg * feat: add animation for the highlight * fix: loading indicatro to show segment indices * feat: enhance modality drop down ui * fix: panels * fix: download form * fix: layout shift in loading indicator * fix: loading indicator to have correct values * fix: update software number * fix: image jump between MPR and default * fix: segmentation cleanup and cine service cleanup * fix: segmentation toolgroup clena up * fix: highlight interval should not trigger again * fix: issue with multiframe sorting * rename: change onSeriesChange to onArrowsClick * fix: buttons for tmtv and layout shift * fix: various bugs wrt crosshairs * fix: crosshairs re init on reset camera * fix: middle slice calculation different from cs middle reset camera * fix: reset camera should reset viewport camera * fix: loading segments in MPR mode * fix: tmtv hp back to before * fix: layout shift * feat: orientation markers for volume viewport * fix: capture for volume viewports * fix: memory leak for back to worklist * fix: loading bar bg color * fix: side panel for only one panel * fix: react select style in production * fix: various styling for segmentation groups * fix: various ui styles * feat: add new segmentation config styles * fix: hover state for segmentation item * fix: side panel layout shift * temp add panels * try to fix scrollbar for thimbnail * fix: scroll not appearing for side panels * feat: changed styles for scrollbar * feat: add cpu fallback warning * fix: webworker destroy * fix: select styles * fix: orientation marker color and position * fix: capture screenshot for volume viewports * fix: hide segment visibility on mpr * fix: reloading an already loaded seg displayset * feat: add is equal * fix: mpr jump to measurements * apply review comments * fix: optimization for the segmentation load * fix: remove unnecessary context menu and hp service reset * fix: segmentation service wrt brush settings * feat: initial work for the stack synchronization * fix: add validateDisplaySetSelectorsForNewDisplaySets to make sure drag and drop can follow requirements * fix: various react proptypes * fix: thumbnails for the tmtv and change default props to default params * feat: make showing loading indicator configurable and add docs * bump versions and add more docs * fix demo * update cornerstone versions * apply review comments * feat: add reference lines * fix build * fix unit tests * add reference lines icon * fix: e2e tests * fix static wado config * docs: add segmentation service docs * fix: docker build * fix: keep camera and bump versions * Try re-enabling minification to fix deploy previews Co-authored-by: Erik Ziegler <erik.sweed@gmail.com>
This commit is contained in:
1 parent
08c58b0634
commit
83ea228d86
254 files changed
+12856
-3141
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import domtoimage from 'dom-to-image';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import html2canvas from 'html2canvas';
|
||||
import {
|
||||
Enums,
|
||||
getEnabledElement,
|
||||
getOrCreateCanvas,
|
||||
StackViewport,
|
||||
VolumeViewport,
|
||||
} from '@cornerstonejs/core';
|
||||
import { ToolGroupManager } from '@cornerstonejs/tools';
|
||||
import PropTypes from 'prop-types';
|
||||
@@ -17,7 +17,6 @@ const MINIMUM_SIZE = 100;
|
||||
const DEFAULT_SIZE = 512;
|
||||
const MAX_TEXTURE_SIZE = 10000;
|
||||
const VIEWPORT_ID = 'cornerstone-viewport-download-form';
|
||||
const TOOLGROUP_ID = 'cornerstone-viewport-download-form-toolgroup';
|
||||
|
||||
const CornerstoneViewportDownloadForm = ({
|
||||
onClose,
|
||||
@@ -26,15 +25,57 @@ const CornerstoneViewportDownloadForm = ({
|
||||
}) => {
|
||||
const enabledElement = OHIFgetEnabledElement(activeViewportIndex);
|
||||
const activeViewportElement = enabledElement?.element;
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
|
||||
const {
|
||||
viewportId: activeViewportId,
|
||||
renderingEngineId,
|
||||
} = activeViewportEnabledElement;
|
||||
|
||||
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
||||
activeViewportId,
|
||||
renderingEngineId
|
||||
);
|
||||
|
||||
const toolModeAndBindings = Object.keys(toolGroup.toolOptions).reduce(
|
||||
(acc, toolName) => {
|
||||
const tool = toolGroup.toolOptions[toolName];
|
||||
const { mode, bindings } = tool;
|
||||
|
||||
return {
|
||||
...acc,
|
||||
[toolName]: {
|
||||
mode,
|
||||
bindings,
|
||||
},
|
||||
};
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
Object.keys(toolModeAndBindings).forEach(toolName => {
|
||||
const { mode, bindings } = toolModeAndBindings[toolName];
|
||||
toolGroup.setToolMode(toolName, mode, { bindings });
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
const enableViewport = viewportElement => {
|
||||
if (viewportElement) {
|
||||
const renderingEngine = CornerstoneViewportService.getRenderingEngine();
|
||||
const { renderingEngine, viewport } = getEnabledElement(
|
||||
activeViewportElement
|
||||
);
|
||||
|
||||
const viewportInput = {
|
||||
viewportId: VIEWPORT_ID,
|
||||
element: viewportElement,
|
||||
type: Enums.ViewportType.STACK,
|
||||
type: viewport.type,
|
||||
defaultOptions: {
|
||||
background: viewport.defaultOptions.background,
|
||||
orientation: viewport.defaultOptions.orientation,
|
||||
},
|
||||
};
|
||||
|
||||
renderingEngine.enableElement(viewportInput);
|
||||
@@ -43,11 +84,9 @@ const CornerstoneViewportDownloadForm = ({
|
||||
|
||||
const disableViewport = viewportElement => {
|
||||
if (viewportElement) {
|
||||
const renderingEngine = CornerstoneViewportService.getRenderingEngine();
|
||||
|
||||
const { renderingEngine } = getEnabledElement(viewportElement);
|
||||
return new Promise(resolve => {
|
||||
renderingEngine.disableElement(VIEWPORT_ID);
|
||||
ToolGroupManager.destroyToolGroup(TOOLGROUP_ID);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -115,26 +154,39 @@ const CornerstoneViewportDownloadForm = ({
|
||||
|
||||
const { viewport } = activeViewportEnabledElement;
|
||||
|
||||
if (!(viewport instanceof StackViewport)) {
|
||||
throw new Error('Viewport is not a StackViewport');
|
||||
}
|
||||
|
||||
const imageId = viewport.getCurrentImageId();
|
||||
|
||||
const renderingEngine = CornerstoneViewportService.getRenderingEngine();
|
||||
const downloadViewport = renderingEngine.getViewport(
|
||||
VIEWPORT_ID
|
||||
) as StackViewport;
|
||||
const downloadViewport = renderingEngine.getViewport(VIEWPORT_ID);
|
||||
|
||||
downloadViewport.setStack([imageId]).then(() => {
|
||||
if (downloadViewport instanceof StackViewport) {
|
||||
const imageId = viewport.getCurrentImageId();
|
||||
const properties = viewport.getProperties();
|
||||
downloadViewport.setProperties(properties);
|
||||
|
||||
downloadViewport.setStack([imageId]).then(() => {
|
||||
downloadViewport.setProperties(properties);
|
||||
|
||||
const newWidth = Math.min(width || image.width, MAX_TEXTURE_SIZE);
|
||||
const newHeight = Math.min(
|
||||
height || image.height,
|
||||
MAX_TEXTURE_SIZE
|
||||
);
|
||||
|
||||
resolve({ width: newWidth, height: newHeight });
|
||||
});
|
||||
} else if (downloadViewport instanceof VolumeViewport) {
|
||||
const actors = viewport.getActors();
|
||||
// downloadViewport.setActors(actors);
|
||||
actors.forEach(actor => {
|
||||
downloadViewport.addActor(actor);
|
||||
});
|
||||
|
||||
downloadViewport.setCamera(viewport.getCamera());
|
||||
downloadViewport.render();
|
||||
|
||||
const newWidth = Math.min(width || image.width, MAX_TEXTURE_SIZE);
|
||||
const newHeight = Math.min(height || image.height, MAX_TEXTURE_SIZE);
|
||||
|
||||
resolve({ width: newWidth, height: newHeight });
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,31 +216,20 @@ const CornerstoneViewportDownloadForm = ({
|
||||
renderingEngineId
|
||||
);
|
||||
|
||||
let downloadToolGroup = ToolGroupManager.getToolGroupForViewport(
|
||||
downloadViewportId,
|
||||
renderingEngineId
|
||||
);
|
||||
// add the viewport to the toolGroup
|
||||
toolGroup.addViewport(downloadViewportId);
|
||||
|
||||
if (downloadToolGroup === undefined) {
|
||||
downloadToolGroup = ToolGroupManager.createToolGroup(TOOLGROUP_ID);
|
||||
|
||||
// what tools were in the active viewport?
|
||||
// make them all enabled instances so that they can not be interacted
|
||||
// with in the download viewport
|
||||
Object.values(toolGroup._toolInstances).forEach(tool => {
|
||||
downloadToolGroup.addTool(tool.getToolName());
|
||||
});
|
||||
|
||||
// add the viewport to the toolGroup
|
||||
downloadToolGroup.addViewport(downloadViewportId);
|
||||
}
|
||||
|
||||
Object.values(downloadToolGroup._toolInstances).forEach(tool => {
|
||||
const toolName = tool.getToolName();
|
||||
if (toggle) {
|
||||
downloadToolGroup.setToolEnabled(toolName);
|
||||
Object.keys(toolGroup._toolInstances).forEach(toolName => {
|
||||
// make all tools Enabled so that they can not be interacted with
|
||||
// in the download viewport
|
||||
if (toggle && toolName !== 'Crosshairs') {
|
||||
try {
|
||||
toolGroup.setToolEnabled(toolName);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
} else {
|
||||
downloadToolGroup.setToolDisabled(toolName);
|
||||
toolGroup.setToolDisabled(toolName);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -199,10 +240,10 @@ const CornerstoneViewportDownloadForm = ({
|
||||
`div[data-viewport-uid="${VIEWPORT_ID}"]`
|
||||
);
|
||||
|
||||
domtoimage.toPng(divForDownloadViewport).then(dataUrl => {
|
||||
html2canvas(divForDownloadViewport).then(canvas => {
|
||||
const link = document.createElement('a');
|
||||
link.download = file;
|
||||
link.href = dataUrl;
|
||||
link.href = canvas.toDataURL(fileType, 1.0);
|
||||
link.click();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Types, getRenderingEngine, utilities } from '@cornerstonejs/core';
|
||||
|
||||
export default function calculateViewportRegistrations(
|
||||
viewports: Types.IViewportId[]
|
||||
) {
|
||||
const viewportPairs = _getViewportPairs(viewports);
|
||||
|
||||
for (const [viewport, nextViewport] of viewportPairs) {
|
||||
// check if they are in the same Frame of Reference
|
||||
const renderingEngine1 = getRenderingEngine(viewport.renderingEngineId);
|
||||
const renderingEngine2 = getRenderingEngine(nextViewport.renderingEngineId);
|
||||
|
||||
const csViewport1 = renderingEngine1.getViewport(viewport.viewportId);
|
||||
const csViewport2 = renderingEngine2.getViewport(nextViewport.viewportId);
|
||||
|
||||
utilities.calculateViewportsSpatialRegistration(csViewport1, csViewport2);
|
||||
}
|
||||
}
|
||||
|
||||
const _getViewportPairs = (viewports: Types.IViewportId[]) => {
|
||||
const viewportPairs = [];
|
||||
|
||||
for (let i = 0; i < viewports.length; i++) {
|
||||
for (let j = i + 1; j < viewports.length; j++) {
|
||||
viewportPairs.push([viewports[i], viewports[j]]);
|
||||
}
|
||||
}
|
||||
|
||||
return viewportPairs;
|
||||
};
|
||||
@@ -38,6 +38,10 @@ const getImageInstance = dataset => {
|
||||
return dataset && dataset.images && dataset.images[0];
|
||||
};
|
||||
|
||||
const getNonImageInstance = dataset => {
|
||||
return dataset && dataset.instance;
|
||||
};
|
||||
|
||||
const getImageInstanceId = imageInstance => {
|
||||
return getImageId(imageInstance);
|
||||
};
|
||||
@@ -89,19 +93,28 @@ const getImageLoaderType = imageId => {
|
||||
|
||||
class DicomLoaderService {
|
||||
getLocalData(dataset, studies) {
|
||||
if (dataset && dataset.localFile) {
|
||||
// Use referenced imageInstance
|
||||
const imageInstance = getImageInstance(dataset);
|
||||
let imageId = getImageInstanceId(imageInstance);
|
||||
// Use referenced imageInstance
|
||||
const imageInstance = getImageInstance(dataset);
|
||||
const nonImageInstance = getNonImageInstance(dataset);
|
||||
|
||||
// or Try to get it from studies
|
||||
if (someInvalidStrings(imageId)) {
|
||||
imageId = findImageIdOnStudies(studies, dataset.displaySetInstanceUID);
|
||||
}
|
||||
if (
|
||||
(!imageInstance && !nonImageInstance) ||
|
||||
!nonImageInstance.imageId.startsWith('dicomfile')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!someInvalidStrings(imageId)) {
|
||||
return cornerstoneWADOImageLoader.wadouri.loadFileRequest(imageId);
|
||||
}
|
||||
const instance = imageInstance || nonImageInstance;
|
||||
|
||||
let imageId = getImageInstanceId(instance);
|
||||
|
||||
// or Try to get it from studies
|
||||
if (someInvalidStrings(imageId)) {
|
||||
imageId = findImageIdOnStudies(studies, dataset.displaySetInstanceUID);
|
||||
}
|
||||
|
||||
if (!someInvalidStrings(imageId)) {
|
||||
return cornerstoneWADOImageLoader.wadouri.loadFileRequest(imageId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,13 +195,14 @@ class DicomLoaderService {
|
||||
}
|
||||
}
|
||||
|
||||
*getLoaderIterator(dataset, studies) {
|
||||
*getLoaderIterator(dataset, studies, headers) {
|
||||
yield this.getLocalData(dataset, studies);
|
||||
yield this.getDataByImageType(dataset);
|
||||
yield this.getDataByDatasetType(dataset);
|
||||
}
|
||||
|
||||
findDicomDataPromise(dataset, studies) {
|
||||
findDicomDataPromise(dataset, studies, headers) {
|
||||
dataset.authorizationHeaders = headers;
|
||||
const loaderIterator = this.getLoaderIterator(dataset, studies);
|
||||
// it returns first valid retriever method.
|
||||
for (const loader of loaderIterator) {
|
||||
|
||||
@@ -8,15 +8,19 @@ const CORONAL = 'coronal';
|
||||
export default function getCornerstoneOrientation(
|
||||
orientation: string
|
||||
): Enums.OrientationAxis {
|
||||
switch (orientation.toLowerCase()) {
|
||||
case AXIAL:
|
||||
return Enums.OrientationAxis.AXIAL;
|
||||
case SAGITTAL:
|
||||
return Enums.OrientationAxis.SAGITTAL;
|
||||
case CORONAL:
|
||||
return Enums.OrientationAxis.CORONAL;
|
||||
default:
|
||||
log.wanr('Choosing acquisition plane orientation');
|
||||
return Enums.OrientationAxis.ACQUISITION;
|
||||
if (orientation) {
|
||||
switch (orientation.toLowerCase()) {
|
||||
case AXIAL:
|
||||
return Enums.OrientationAxis.AXIAL;
|
||||
case SAGITTAL:
|
||||
return Enums.OrientationAxis.SAGITTAL;
|
||||
case CORONAL:
|
||||
return Enums.OrientationAxis.CORONAL;
|
||||
default:
|
||||
log.wanr('Choosing acquisition plane orientation');
|
||||
return Enums.OrientationAxis.ACQUISITION;
|
||||
}
|
||||
}
|
||||
|
||||
return Enums.OrientationAxis.ACQUISITION;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Given the ViewportGridService state it will re create the protocol viewport structure
|
||||
* that was used at the hanging protocol creation time. This is used to re create the
|
||||
* viewport structure when the user decides to go back to a previous cached
|
||||
* layout in the viewport grid.
|
||||
*
|
||||
*
|
||||
* viewportGrid's viewports look like
|
||||
*
|
||||
* viewports = [
|
||||
* {
|
||||
* displaySetInstanceUIDs: string[],
|
||||
* displaySetOptions: [],
|
||||
* viewportOptions: {}
|
||||
* height: number,
|
||||
* width: number,
|
||||
* x: number,
|
||||
* y: number
|
||||
* },
|
||||
* ]
|
||||
*
|
||||
* and hanging protocols viewport structure looks like
|
||||
*
|
||||
* viewportStructure: {
|
||||
* layoutType: 'grid',
|
||||
* properties: {
|
||||
* rows: 3,
|
||||
* columns: 4,
|
||||
* layoutOptions: [
|
||||
* {
|
||||
* x: 0,
|
||||
* y: 0,
|
||||
* width: 1 / 4,
|
||||
* height: 1 / 3,
|
||||
* },
|
||||
* {
|
||||
* x: 1 / 4,
|
||||
* y: 0,
|
||||
* width: 1 / 4,
|
||||
* height: 1 / 3,
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* },
|
||||
*/
|
||||
export default function getProtocolViewportStructureFromGridViewports({
|
||||
numRows,
|
||||
numCols,
|
||||
viewports,
|
||||
}: {
|
||||
numRows: number;
|
||||
numCols: number;
|
||||
viewports: any[];
|
||||
}) {
|
||||
const viewportStructure = {
|
||||
layoutType: 'grid',
|
||||
properties: {
|
||||
rows: numRows,
|
||||
columns: numCols,
|
||||
layoutOptions: [],
|
||||
},
|
||||
};
|
||||
|
||||
viewports.forEach(viewport => {
|
||||
viewportStructure.properties.layoutOptions.push({
|
||||
x: viewport.x,
|
||||
y: viewport.y,
|
||||
width: viewport.width,
|
||||
height: viewport.height,
|
||||
});
|
||||
});
|
||||
|
||||
return viewportStructure;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export default function interleaveCenterLoader({
|
||||
* listen to it and as the other viewports are created we can set the volumes for them
|
||||
* since volumes are already started loading.
|
||||
*/
|
||||
if (matchDetails.length !== viewportIdVolumeInputArrayMap.size) {
|
||||
if (matchDetails.size !== viewportIdVolumeInputArrayMap.size) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function interleaveTopToBottom({
|
||||
* listen to it and as the other viewports are created we can set the volumes for them
|
||||
* since volumes are already started loading.
|
||||
*/
|
||||
if (matchDetails.length !== viewportIdVolumeInputArrayMap.size) {
|
||||
if (matchDetails.size !== viewportIdVolumeInputArrayMap.size) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { segmentation } from '@cornerstonejs/tools';
|
||||
|
||||
function removeToolGroupSegmentationRepresentations(toolGroupId) {
|
||||
const representations = segmentation.state.getSegmentationRepresentations(
|
||||
toolGroupId
|
||||
);
|
||||
|
||||
if (!representations || !representations.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
representations.forEach(representation => {
|
||||
segmentation.state.removeSegmentationRepresentation(
|
||||
toolGroupId,
|
||||
representation.segmentationRepresentationUID
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export default removeToolGroupSegmentationRepresentations;
|
||||
@@ -1,30 +0,0 @@
|
||||
import { Enums as csToolsEnums } from '@cornerstonejs/tools';
|
||||
|
||||
const Labelmap = {
|
||||
toSegmentation: segmentationState => {
|
||||
const {
|
||||
activeSegmentIndex,
|
||||
cachedStats: data,
|
||||
segmentsLocked,
|
||||
representationData,
|
||||
label,
|
||||
segmentationId,
|
||||
text,
|
||||
} = segmentationState;
|
||||
|
||||
const labelmapRepresentationData =
|
||||
representationData[csToolsEnums.SegmentationRepresentations.Labelmap];
|
||||
|
||||
return {
|
||||
id: segmentationId,
|
||||
activeSegmentIndex,
|
||||
segmentsLocked,
|
||||
data,
|
||||
label,
|
||||
volumeId: labelmapRepresentationData.volumeId,
|
||||
displayText: text || [],
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default Labelmap;
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
import Labelmap from './Labelmap';
|
||||
|
||||
const segmentationServiceMappingsFactory = (
|
||||
SegmentationService,
|
||||
DisplaySetService
|
||||
) => {
|
||||
return {
|
||||
Labelmap: {
|
||||
matchingCriteria: {},
|
||||
toSegmentation: csToolsSegmentation =>
|
||||
Labelmap.toSegmentation(csToolsSegmentation, DisplaySetService),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default segmentationServiceMappingsFactory;
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* It is a bell curved function that uses ease in out quadratic for css
|
||||
* transition timing function for each side of the curve.
|
||||
*
|
||||
* @param {number} x - The current time, in the range [0, 1].
|
||||
* @param {number} baseline - The baseline value to start from and return to.
|
||||
* @returns the value of the transition at time x.
|
||||
*/
|
||||
export function easeInOutBell(x: number, baseline: number): number {
|
||||
const alpha = 1 - baseline;
|
||||
|
||||
// prettier-ignore
|
||||
if (x < 1 / 4) {
|
||||
return 4 * Math.pow(2 * x, 3) * alpha + baseline;
|
||||
} else if (x < 1 / 2) {
|
||||
return (1 - Math.pow(-4 * x + 2, 3) / 2) * alpha + baseline;
|
||||
} else if (x < 3 / 4) {
|
||||
return (1 - Math.pow(4 * x - 2, 3) / 2) * alpha + baseline;
|
||||
} else {
|
||||
return (- 4 * Math.pow(2 * x - 2, 3)) * alpha + baseline;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user