-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(video): add support for contour ROI and contour based segmentati…
…on (#988) * feat: Add spline to video * Add video spline tools * Add livewire example * fix: example was broken * Fixes to make livewire work on RGB * Faster convert to grayscale * Fix the video tools example * PR review fixes, fix fourth/fifth mouse buttons * PR fixes * yarn lock * feat: Add livewire segmentation on video viewports * feat: Add spline segmentation for video * chore(test): Basic changes to have jest running tests (#984) * Basic changes to have jest running tests * Fix unit test imports for now * Fix build issues with recursive imports * yarn lock * chore(version): version.json [skip ci] * chore(version): Update package versions [skip ci] * Only display on the exact image for the segmentation contour * Add the planar freehand segmentation * PR changes * Fix PR comment --------- Co-authored-by: ohif-bot <[email protected]>
- Loading branch information
1 parent
2d4cc21
commit 944949e
Showing
23 changed files
with
991 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,4 +47,5 @@ temp/ | |
|
||
# Report Output | ||
junit/ | ||
junit.xml | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export default function convertToGrayscale( | ||
scalarData, | ||
width: number, | ||
height: number | ||
) { | ||
const isRGBA = scalarData.length === width * height * 4; | ||
const isRGB = scalarData.length === width * height * 3; | ||
if (isRGBA || isRGB) { | ||
const newScalarData = new Float32Array(width * height); | ||
let offset = 0; | ||
let destOffset = 0; | ||
const increment = isRGBA ? 4 : 3; | ||
for (let x = 0; x < width; x++) { | ||
for (let y = 0; y < height; y++) { | ||
const r = scalarData[offset]; | ||
const g = scalarData[offset + 1]; | ||
const b = scalarData[offset + 2]; | ||
newScalarData[destOffset] = (r + g + b) / 3; | ||
offset += increment; | ||
destOffset++; | ||
} | ||
} | ||
return newScalarData; | ||
} else { | ||
return scalarData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.