react-vtkjs-viewport
react-vtkjs-viewport copied to clipboard
PET Images Adjustable Window Level in MPR
I noticed using the OHIF Viewer that PET images in 2DMPR mode can't have their window level changed (using the WWWC tool) like CT images can. After some investigation I found that because the range of window width and window center is much smaller with PET then CT the rounding that takes place effectively makes changes impossible.
publicAPI.windowLevelFromMouse = pos => {
const range = model.volumeActor
.getMapper()
.getInputData()
.getPointData()
.getScalars()
.getRange();
const imageDynamicRange = range[1] - range[0];
const multiplier =
Math.round(imageDynamicRange / 1024) * publicAPI.getLevelScale();
const dx = Math.round((pos[0] - model.wlStartPos[0]) * multiplier);
const dy = Math.round((pos[1] - model.wlStartPos[1]) * multiplier);
let windowWidth = model.levels.windowWidth + dx;
let windowCenter = model.levels.windowCenter - dy;
from vtkInteractorStyleMPRWindowLevel.js
For PET the multiplier gets rounded to 0 and leaves dx and dy as 0 as well. For reasonable changes to take place in the levels in PET we want dx and dy values between -1 and 1. If I remove all three Math.round calls then I can adjust the window level for both PET and CT with no issues.
If others agree that the rounding here is unnecessary I'd be happy to make a PR to address this. I'm open to other solutions to this issue as well.