Re: Propagate min-max does not work via the GUI for large 16-bit images

Posted by Stein Rørvik on
URL: http://imagej.273.s1.nabble.com/Propagate-min-max-does-not-work-via-the-GUI-for-large-16-bit-images-tp5024225p5024227.html

Ok,

the problem seems to be related to the image size, so I assume there is some calculation of the min/max values that overflows somewhere.

I reported a problem with the B/C dialog in January 2018 which may be related. This problem also occurred with images larger than 3000 pixels height/width and not smaller ones.
http://imagej.1557.x6.nabble.com/Set-min-max-does-not-work-via-the-GUI-for-large-32-bit-images-td5019893.html

Also that time you were not able to reproduce the problem. However, the problem from jan.2018 is no longer present in 1.53g, I am not sure when it disappeared, I can check that if it helps. I keep an archive of all the release versions for such testing.

Stein

-----Original Message-----

Sent: 23. november 2020 19:28
Subject: Re: Propagate min-max does not work via the GUI for large 16-bit images

> On Nov 23, 2020, at 11:08 AM, Stein Rørvik <[hidden email]> wrote:
>
> There is a problem with the Brightness/Contrast dialog for larger images:
>
> If the image size is 3000 pixels or more wide, the propagate min/max choice does not work.

I was able to reproduce this problem on Windows, I added some debug statements to the ContrastAdjuster.propagate() method, but then I was no longer able to reproduce the problem! Here is what the code (in 1.53g46) looks like:

         for (int i=0; i<nImages; i++) {
            ImagePlus img2 = WindowManager.getImage(list[i]);
            if (IJ.debugMode) IJ.log("Propagate: "+i+" "+img+"\n"+img2);
            if (img2!=null && img2.getBitDepth()==depth && img2.getID()!=id
            && img2.getNChannels()==1 && img2.getWindow()!=null) {
               if (IJ.debugMode) IJ.log("   "+min+" "+max);
               ImageProcessor ip2 = img2.getProcessor();
               ip2.setMinAndMax(min, max);
               img2.updateAndDraw();
            }

-wayne


> Instead of propagating the set values, the min/max values of the other images are reset to their min/max pixel value.
> If the image size is smaller like 2000 pixels wide then it works ok. I have 16-bit range set to automatic.
>
> I didn't try to investigate at exactly what image size it fails, but the problem is definitely bound to the image size.
> I checked the ImageJ version by downgrading and it works as expected in version 1.52r and earlier.
>
> Here is a demo macro to help reproduce the issue:
>
> -----------------------
> run("Close All");
> run("CT (420K, 16-bit DICOM)");
> //width=888 height=495
> run("Scale...", "x=4 y=4 interpolation=Bilinear create");
> //width=3552 height=1980
> run("Tile");
> selectWindow("ct.dcm-1.tif");
> run("Brightness/Contrast...");
> waitForUser("Please Set contrast and select 'Propagate to all
> images'"); //works until 1.52r //fails in 1.52s: min/max is reset when
> Brightness/Contrast is opened; propagate is ok //fails since 1.52t:
> min/max is not propagated, other images have instead min/max reset
> -----------------------
>
> If you resize to a smaller size like
>                run("Scale...", "x=2 y=2 interpolation=Bilinear
> create"); then the problem does not occur.
>
> I am using daily build ImageJ 1.53g with Java 1.8.0_172 on Windows 10/64-bit.
>
>
> Stein

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C3d5c0eb9bdd84495128a08d88fddc701%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637417529980985298%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=%2BLjAKM%2F94xNj0ZRYhf3ARbL0ocBQI6nlOGCHAZWcqeM%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html