-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Threshold preview tool #534
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
screen-recording-2023-03-30-at-14552-pm_ws91ep70.mp4 |
const callback = ({ value, index, pointIJK }) => { | ||
if (segmentsLocked.includes(value)) { | ||
return; | ||
} | ||
|
||
const { | ||
THRESHOLD_INSIDE_CUBE: { threshold }, | ||
} = strategySpecificConfiguration; | ||
|
||
const voxelValue = imageVolume.scalarData[index]; | ||
|
||
if (threshold[0] <= voxelValue && voxelValue <= threshold[1]) { | ||
scalarData[index] = segmentIndex; | ||
} else { | ||
scalarData[index] = 0; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This callback is getting run more than a million times, it should be as simple as possible and avoid destructuring as much as possible. For instance
const {
THRESHOLD_INSIDE_CUBE: { threshold },
} = strategySpecificConfiguration;
can be moved outside
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup , it is checking for every voxel value , any suggestion for optimising this . I am thinking can i declare a callback in a variable and when their is threshold will return the callback else not ?
const actors = viewport.getActors(); | ||
|
||
const firstVolumeActorUID = actors[0].uid; | ||
const imageVolume = cache.getVolume(firstVolumeActorUID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please look at packages/core/src/utilities/getTargetVolumeAndSpacingInNormalDir.ts to see how we find the primary volume? maybe refactor that code inside a util in core
const intervalTime = 16; | ||
const numberOfFrames = Math.ceil(animationLength / intervalTime); | ||
|
||
clearInterval(this.highlightIntervalId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have all the logic above inside packages/tools/src/tools/displayTools/Labelmap/labelmapDisplay.ts
in render
almost, and we hit that also on each segmentation updated, so I'm thinking maybe we augment that render
to be able to handle animations like below. My thought would be to add something like animationType
Enums, and for now we have easeInOutBell
and then there if that is presented inside the segmentationRepresentation
as key, we add animation. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea , will implement that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool tool, see my comments please
…roup, moved easeInOut to the animation helper
Threshold preview tool