Skip to content
Snippets Groups Projects
Commit e0c1f862 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Ensure to convert to 8-bit in a reasonable fashion

Unlike what we had assumed, the "resetMinAndMax()" command doesn't set the
display range to min and max of the current bit depth but rather to the min and
max from the actual values. This was causing a high offset (many pixels with
value zero) after converting to 8 bit, so we rather calculate the display range
now from the actual values before converting to 8-bit.
parent 77ea2fdf
No related branches found
No related tags found
No related merge requests found
......@@ -549,7 +549,14 @@ function process_beads() {
print("processing image: " + fname + " (location: [" + fpath + "])");
if (bitDepth() > 8) {
print("image type " + bitDepth() + " bit detected, converting to 8 bit...");
resetMinAndMax();
Stack.getStatistics(_, _, stack_min, stack_max, _);
new_max = stack_max * 1.1;
// NOTE: having a new value larger than the max value of the current bit
// depth is unproblematic since ImageJ apparently just uses the maximum
// possible value then:
print("setting display range min/max to 0/" + new_max + " (was: " +
stack_min + "/" + stack_max + ")");
setMinAndMax(0, new_max);
run("8-bit");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment