Skip to content
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

Feature/epm UI i 8938 enable ai brain segmentation #189

Merged
merged 3 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/engine/Graphics2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Graphics2d extends React.Component {
constructor(props) {
super(props);

this.store = props;
this.m_mount = React.createRef();

this.onMouseDown = this.onMouseDown.bind(this);
Expand Down Expand Up @@ -527,7 +528,7 @@ class Graphics2d extends React.Component {
if (isSegm) {
const w = this.m_toolPick.m_wScreen;
const h = this.m_toolPick.m_hScreen;
this.segm2d.render(ctx, w, h, this.imgData);
this.segm2d.renderImage(ctx, w, h, this.imgData);
} else {
createImageBitmap(this.imgData)
.then((imageBitmap) => {
Expand Down Expand Up @@ -692,6 +693,12 @@ class Graphics2d extends React.Component {
startY: evt.clientY,
});
}

if (this.m_isSegmented && this.segm2d.model) {
// We do not need update segmented image (with model)
// on mouse move event to performance issues.
return;
}
store.graphics2d.forceUpdate();
}

Expand Down Expand Up @@ -767,13 +774,14 @@ class Graphics2d extends React.Component {
* Invoke forced rendering, after some tool visual changes
*/
forceUpdate(volIndex) {
// console.log('forceUpdate ...');
console.log('forceUpdate ...');
this.prepareImageForRender(volIndex);
// this.forceRender();
if (this.m_isSegmented) {
// need to draw segmented image
if (this.segm2d.model !== null) {
// we have loaded model: applt it to image
// we have loaded model: apply it to image
// TODO update image only on some specific events: zoom, explore
this.segm2d.startApplyImage();
}
} else {
Expand Down
Loading
Loading