-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Handle large volumes #3235
base: master
Are you sure you want to change the base?
Handle large volumes #3235
Conversation
✅ Deploy Preview for ohif-platform-docs canceled.
|
✅ Deploy Preview for ohif-platform-viewer ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Codecov Report
@@ Coverage Diff @@
## v3-stable #3235 +/- ##
==============================================
+ Coverage 25.15% 37.93% +12.77%
==============================================
Files 119 84 -35
Lines 2862 1334 -1528
Branches 555 294 -261
==============================================
- Hits 720 506 -214
+ Misses 1856 664 -1192
+ Partials 286 164 -122 see 76 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -186,9 +201,22 @@ class CornerstoneCacheService { | |||
displaySet, | |||
dataSource | |||
); | |||
const distributedCopy = (items, n) => { |
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 is going to cause rendering issues when items.length ~= n because it is just going to throw out a certain set of instances, which causes the interval between images to be off by a factor of 2. When n << items.length, it works ok,
because the interval becomes nearly consistent again, or if n = items.length / integer value, then one can sub-select evenly. It is possible to write a inconsistent sample viewer, but currently we assume in the configuration that the sample volume is consistent, and don't account for this type of differences.
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.
You could write a decimator instead - that takes out every other image, or as a general implementation, leaves 1 image, takes k images out, then repeats. Decimators leave consistent spacing.
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.
I added a decimator to CS3D in the HTJ2K progressive branch if you want one.
constructor(images) { | ||
if (Array.isArray(images) !== true) { | ||
throw new Error('ImageSet expects an array of images'); | ||
} | ||
|
||
// @property "images" | ||
Object.defineProperty(this, 'images', { | ||
// @property "rawImages" |
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.
Just set instances to the complete list - instances is used elsewhere to mean all the instance values, whereas images is used for the images for display.
@@ -32,6 +34,24 @@ class ImageSet { | |||
}); | |||
} | |||
|
|||
get images(): any { |
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.
The general design of the display sets is that they are fixed representations of specific groups of DICOM objects - this mapping allows redefining that, and can cause problems when rendering different image sets. I'd rather have a mapping function produce a new ImageSet entirely rather than having the images be variable.
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.
It isn't used anywhere here, and I don't see any testing behaviour for it - I think this is a bad idea without careful consideration of what it means for other classes which expect to the representation of display sets to be consistent.
Wondering if there was any plan to merge this PR soon - we are facing an issue addressed by this PR #3229 (comment) In essence using the 2D MPR feature on our image will consume the entire machine's RAM and crash the browser temporarily on a 3-month old machine. |
@Ouwen Is there someone at your team to handle the comments for this PR to get merged? Thanks! |
this is useful we should add it |
Hey @sedghi, sorry for the radio silence from my side. I've been under pressure on finishing my dissertation ha |
@Ouwen Oh wow, Good luck, nothing is expected, just was trying to include you in the loop |
@sedghi comment and close |
So, after more thinking about this feature, I believe it will not adequately address the problem of large volumes as we desire. However, changing to a 16-bit texture might be the solution for most use cases, and in the future, we can consider the chunk and overlap solution. https://docs.ohif.org/faq#how-do-i-handle-large-volumes-for-mpr-and-volume-rendering Anyway, thanks @Ouwen for this |
I will reopen for visiblity |
Fixes #3235
Context
Some volumes can be 2500-3500 large and it is challenging to load these in memory. This PR helps by limiting the volume size and adds a callback function on the ImageSet class which can be used to filter out or change the metadata of an ImageSet / displaySet
Changes & Results
Large volumes are evenly sampled when they go above the maxFramesInVolume config. Changes have been made to the ImageSet class and config has been added to the CornerstoneCacheService.
Testing
Open the viewer to http://localhost:3000/viewer?StudyInstanceUIDs=1.3.6.1.4.1.25403.345050719074.3824.20170125095722.1
Open MPR mode to go into the volume mode (stack is unaffected by these changes)
Run the following on the console/window
services.CornerstoneCacheService.setMaxFramesInVolume(20)
You should see the volume update due to the DisplaySet being invalidated. You can also use the DisplaySetService to set the ImageMapper and invalidate. This functionality is left to be placed in extensions as use cases can vary.
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment