Skip to content

Commit

Permalink
feat(TranferFunctionEditor): upgrade for axis labels
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Jan 5, 2024
1 parent bb50c41 commit 190d81d
Show file tree
Hide file tree
Showing 7 changed files with 672 additions and 427 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"itk-image-io": "^1.0.0-b.84",
"itk-mesh-io": "^1.0.0-b.84",
"itk-viewer-color-maps": "^1.2.0",
"itk-viewer-transfer-function-editor": "^1.5.0",
"itk-viewer-transfer-function-editor": "^1.6.0",
"itk-wasm": "^1.0.0-b.83",
"mobx": "^5.15.7",
"mousetrap": "^1.6.5",
Expand Down
13 changes: 1 addition & 12 deletions src/Rendering/VTKJS/Images/mapToPiecewiseFunctionNodes.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import { windowPointsForSort } from 'itk-viewer-transfer-function-editor'

const getNodes = (range, points) => {
const delta = range[1] - range[0]
const windowedPoints = windowPointsForSort(points)
return windowedPoints.map(([x, y]) => ({
x: range[0] + delta * x,
y,
midpoint: 0.5,
sharpness: 0,
}))
}
import { getNodes } from 'itk-viewer-transfer-function-editor'

// grab head and tail or fallback to data range if 1 or less points
const getRange = nodes =>
Expand Down
11 changes: 7 additions & 4 deletions src/UI/Layers/createLayersUIMachine.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,17 @@ const assignImageContext = assign({
if (!actorContext.piecewiseFunctionPoints.has(component)) {
// Assign default piecewiseFunction
const points = context.use2D
? [
[0, 1],
[1, 1],
]
? [[0.5, 1]]
: [
[0, 0],
[0.9, 0.9],
]
if (context.use2D && components === 1) {
// For 2D ImageMapper, if multiple components,
// opacity function sets component contribution factor.
// If just 1 component, opacity function is irrelevant.
points.length = 0
}
actorContext.piecewiseFunctionPoints.set(component, points)
}
actorContext.colorRanges.set(component, [0.2, 0.8])
Expand Down
Loading

0 comments on commit 190d81d

Please sign in to comment.