fix(windowing): more robust loading of multi-component DICOMs#578
fix(windowing): more robust loading of multi-component DICOMs#578floryst merged 2 commits intoKitware:mainfrom
Conversation
✅ Deploy Preview for volview-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
| const scalarData = imageData.value.getPointData().getScalars(); | ||
| const [min, max] = scalarData.getRange(); | ||
| // Assumes all data is one component | ||
| const { min, max } = fastComputeRange(scalarData.getData()); |
There was a problem hiding this comment.
Was the original getRange() call causing any particular issue?
There was a problem hiding this comment.
It was working perfectly for one component, which caused NANs in downstream windowing calculations.
There was a problem hiding this comment.
I'm not sure if it makes sense to treat multi-component data as single-component data. How about instead just picking out the first component using scalarData.getRange(0)?
There was a problem hiding this comment.
scalarData.getRange(0) is the default and what was happaning before with just scalarData.getRange(). That is a problem when we compute the autoRangeValues, which computes the histogram from all components from scalarData.getData(). Histogram including all compnents does not make sense to me eather.
We are rendering all components. Looks like a single Window and Level are getting applied to all components:
https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/OpenGL/ImageMapper/index.js#L638-L655
I see this PR as a cludge to keep the app trucking along while still sort of supporting RGB images.
There was a problem hiding this comment.
In that case, this is fine. We will have to revisit this at some point.
|
|
||
| // Original source from https://www.npmjs.com/package/compute-range and vtkDataArray | ||
| // Modified to assume one component array | ||
| function fastComputeRange(arr: number[] | TypedArray) { |
There was a problem hiding this comment.
This function is accessible via vtkDataArray.fastComputeRange. You should be able to just use that + set numComponents to 1.
6b7cb40 to
4bb28a5
Compare
|
LGTM! |
fix(windowing): more robust loading of multi-component DICOMs
Attached DICOM was freezing app.
1-001.zip