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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Stein Rørvik
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.
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: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

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

Wayne Rasband-2
> 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: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

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

Stein Rørvik
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
Reply | Threaded
Open this post in threaded view
|

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

Stein Rørvik
I have tested the old problem from 2018 (not being able to set the min/max values) in different ImageJ versions and it fails until 1.52s, and works since 1.52t.

The new problem (not being able to propagate min/max values) works until 1.52s and fails since 1.52t.

The exact image size that causes the old problem to occur is 3000x 4112, 3000x4111 works. I noticed that when reducing the image size until it works, and then trying a bigger image size again, the problem does not occur on the big image. You must try the B/C dialog on a big image after restarting ImageJ to have it fail again.

The exact image size that causes the new problem to fail is not reproducible, but it seems to consistently work at 1700x2000 and consistently fail at 1800x2000. Also here, if you reduce image size until it works and then increase the size again, it does not fail with the bigger size, until you restart ImageJ. So the two problems seem to be linked.

Stein

-----Original Message-----
Sent: 23. november 2020 20:26
Subject: Re: Propagate min-max does not work via the GUI for large 16-bit images

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.
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.1557.x6.nabble.com%2FSet-min-max-does-not-work-via-the-GUI-for-large-32-bit-images-td5019893.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C61f0be499fde4bd6572908d88fe628d5%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637417565977886383%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=5cAwmyR8uUSzjFWzn6FO7CAu9T%2B8Nk3VAT9vCyAvOlY%3D&amp;reserved=0

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%7C61f0be499fde4bd6572908d88fe628d5%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637417565977886383%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ho18v3ZPEhQUCF6kJd%2BgG1NQHPMUs2iGnpjGB3zq%2FbU%3D&amp;reserved=0

--
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%7C61f0be499fde4bd6572908d88fe628d5%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637417565977886383%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ho18v3ZPEhQUCF6kJd%2BgG1NQHPMUs2iGnpjGB3zq%2FbU%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

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

Wayne Rasband-2
In reply to this post by Stein Rørvik
> 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.
> 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.

This bug is fixed in the ImageJ 1.53g51 daily build.

-wayne

> 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: http://imagej.nih.gov/ij/list.html