Skip to content

Progressive loading of vtkjs viewport #1055

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

Merged
merged 15 commits into from
Oct 18, 2019

Conversation

JamesAPetts
Copy link
Member

Closes #1051

  • Progressively load volumes in vtkjs. The volume and UI is still interactable whilst waiting on frames to come from the data source. The volume is re-loaded into the GPU every 20% of frames that are loaded.
  • WWWC on viewport overlay correctly updates on change.
  • Auto window level based on leveling of cornerstone viewport on mode switch.
  • PT leveled from 0-5 SUV.

@codecov
Copy link

codecov bot commented Oct 16, 2019

Codecov Report

Merging #1055 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1055   +/-   ##
======================================
  Coverage    9.62%   9.62%           
======================================
  Files         251     251           
  Lines        6257    6257           
  Branches     1162    1162           
======================================
  Hits          602     602           
  Misses       4600    4600           
  Partials     1055    1055
Flag Coverage Δ
#core 13.59% <ø> (ø) ⬆️
#viewer 0.42% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d49b31...db927ce. Read the comment docs.

@dannyrb
Copy link
Member

dannyrb commented Oct 16, 2019

@JamesAPetts is this ready for review?

this.setState({
volumes: [volumeActor],
});
}, 200);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ 👉 👇 👈

Copy link
Member Author

@JamesAPetts JamesAPetts Oct 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, this was Erik and I trying to make something render to the user ASAP. Hence the massive disclaimer up top. Feel free to fix it if you find a way!

@@ -35,7 +35,8 @@ class LoadingIndicator extends PureComponent {
<div className="imageViewerLoadingIndicator loadingIndicator">
<div className="indicatorContents">
<p>
Loading... <i className="fa fa-spin fa-circle-o-notch fa-fw" />{' '}
Reformatting...{' '}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the translation function for i18n, and remove that {' '} thing

@@ -172,47 +172,53 @@ class OHIFVTKViewport extends Component {
default:
imageDataObject = getImageData(stack.imageIds, displaySetInstanceUid);

const loadImageDataPromise = loadImageData(imageDataObject);
//loadImageData(imageDataObject);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can remove this line

paintFilterLabelMapImageData: null, // TODO
percentComplete: 0,
},
() => {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless callback

@@ -285,6 +321,56 @@ class OHIFVTKViewport extends Component {
}
}

loadProgressively() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe pass imageDataObject into the function instead of expecting it in this? Seems cleaner.

// TODO -> Just do this higher up, call when loadImageData is first
// called and then do this once after all apis are made.
if (
this.props.viewportIndex === 0 &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does viewportIndex matter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it only happens once, I'll move this down the viewport 👍 .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved down here: OHIF/react-vtkjs-viewport#56

const numViewports = numRows * numColumns;

if (viewportPropsArray && viewportPropsArray.length !== numViewports) {
reject(
Copy link
Member

@swederik swederik Oct 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reject with new Error('viewportProps is supplied but its length is not equal to numViewports') instead of just a string? I thought we had an ESLint rule for that (https://eslint.org/docs/rules/prefer-promise-reject-errors)

@@ -42,3 +53,65 @@ export default function setMPRLayout(displaySet) {
);
});
}

/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove this instead of leaving a massive comment block

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops!

Copy link
Member

@swederik swederik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending minor changes and a double check of whether or not we still need RAF

@JamesAPetts
Copy link
Member Author

Addressed issues and removed RAF successfully.

Just need to wait for react-vtkjs-viewport to publish and I'll merge this.

@JamesAPetts JamesAPetts merged commit 9cdf8b6 into OHIF:master Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add progressive loading for Volume for MPR mode
3 participants