Closed idmpacs closed 8 years ago
Papaya will use the NIFTI header display range if it is available -- or else it will use the image range as the display range.
My guess is that that NIFTI header has a display range specified and possibly the other software is ignoring it. Select "Show Header" from the image button in the top-right of Papaya and see the Display Range field.
If this is the case, I can perhaps add a way to ignore the header values.
Here is the header information and it has Display Range: Max = 0 Min = 0.
Dim Info = 0 Image Dimensions (1-8): 3, 175, 224, 256, 1, 1, 1, 1 Intent Parameters (1-3): 0, 0, 0 Intent Code = 0 Datatype = 4 Bits Per Voxel = 16 Slice Start = 0 Voxel Dimensions (1-8): 1, 1, 1, 1, 1.9, 1, 1, 32074.14 Image Offset = 352 Data Scale: Slope = 1 Intercept = 0 Slice End = 0 Slice Code = 0 Units Code = 10 Display Range: Max = 0 Min = 0 Slice Duration = 0 Time Axis Shift = 0 Description: "CEREBRIX" Auxiliary File: "" Q-Form Code = 1 S-Form Code = 1 Quaternion Parameters: b = -0.0002841152 c = 0.02698462 d = 0.01052417 Quaternion Offsets: x = -93.57744598388672 y = -137.93295288085938 z = -149.5122833251953 S-Form Parameters X: 0.9983221, -0.02105484, 0.05394061, -93.57745 S-Form Parameters Y: 0.02102417, 0.9997783, 0.001135984, -137.933 S-Form Parameters Z: -0.05395257, 0, 0.9985435, -149.5123 Intent Name: ""
Since the display range is 0, Papaya will use the image range. This will have a tendency to make the display look darker and with less contrast. There is nothing else in the header that describes how to set the window level/center.
I will look into possibly of setting better default values. For now, I just added support for minPercent
and maxPercent
which can be used like this:
params["images"] = ["data/myBaseImage.nii.gz"];
params["myBaseImage.nii.gz"] = {minPercent: 0.4, maxPercent: 0.9};
This will set the display minimum (black) to 40% of image max and set the display maximum (white) to 90% of image max. (These values tend to look pretty good.)
If you happen to know good display range values, then you can always set them explicitly like so:
params["myBaseImage.nii.gz"] = {min: 100, max: 12345};
Also, note that a user can always dynamically fix the display range by: 1) Right-click and dragging (left/right contrast, up/down brightness) 2) Clicking the image button and adjusting the display min/max or adjusting the slider.
I'll look into if there is a better approach for calculating a reasonable default display range...
I looked into this a bit more. One idea is to run a histogram as the image loads. Using a histogram, you should be able to come up with a reasonably good display range. But this really seems like overkill and may affect loading performance.
The simple approach of using some percentage of the image max to calculate a display range should work in most cases, but it susceptible to outliers. Some really bright spot in the image might cause everything else to look very dark.
The safest thing to ensure that the user will see something, even across the widest variety of images (PET, MR T1, MR T2, with and without head/skull stripping) is to just set the display range to the image range, assuming no display range is set in the header already. If the header does contain a display range, then that's what will always be used.
I'm not sure what the other software is doing to come up with that display range. There is nothing in the header that Papaya is ignoring, there is just no information there.
Two solutions for now... 1) The developer can either set min/max or minPercent/maxPercent to make up for a lack of display range info in the header. 2) The user can adjust using the slider or right-click dragging to adjust the display window.
Thanks for adding minPercent/maxPercent - it's very useful!
In Papaya Viewer the NIFTI file looks different (Window Level values) than when I open it in another viewer. See below screen grabs.
This issue does not come with DICOM images.