Dear all,
I am trying to illustrate artefacts introduced by storing files as jpg by showing the difference of two identical 16-bit images, one stored as jpg and one as tiff. With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, I end up with files having their values set to 65535 exclusively. Only with k2 = 0 I seem to get more or less reasonable results, but I lose negative values. Could please anybody give me a hint? Thank you. Kind regards, Thomas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Good day Thomas,
you wrote: "[...] by showing the difference of two identical 16-bit images, one stored as jpg and one as tiff."" How did you manage to get a 16bit JPEG-compressed image? As far as I know JPEG-compression is limited to 8bit (RGB) images. Just curious Herbie :::::::::::::::::::::::::::::::::::::::::::: Am 27.03.17 um 13:50 schrieb Thomas Eschner: > Dear all, > > I am trying to illustrate artefacts introduced by storing files as > jpg by showing the difference of two identical 16-bit images, one > stored as jpg and one as tiff. > > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, > I end up with files having their values set to 65535 exclusively. > > Only with k2 = 0 I seem to get more or less reasonable results, but I > lose negative values. > > Could please anybody give me a hint? > > Thank you. > > Kind regards, Thomas > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Thomas Eschner
Hi Thomas,
Why not try one of the colocalization programs? For identical images, all the points on one image should correspond to those on the other. The differences between jpeg and tiff should be apparent. Joel Joel B. Sheffield, Ph.D Department of Biology Temple University Philadelphia, PA 19122 Voice: 215 204 8839 e-mail: [hidden email] URL: *http://tinyurl.com/khbouft <http://tinyurl.com/khbouft>* On Mon, Mar 27, 2017 at 7:50 AM, Thomas Eschner <[hidden email]> wrote: > Dear all, > > I am trying to illustrate artefacts introduced by storing files as jpg by > showing the difference of two identical 16-bit images, one stored as jpg > and one as tiff. > > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, I end > up with files having their values set to 65535 exclusively. > > Only with k2 = 0 I seem to get more or less reasonable results, but I lose > negative values. > > Could please anybody give me a hint? > > Thank you. > > Kind regards, > Thomas > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Thomas Eschner
Hi Thomas,
if you want to subtract 16-bit data and get a signed result, the easiest is using Process>Image Calculator and select "32-bit (float) result". The other option is 'difference' instead of 'subtract' mode, it will give you the absolute value of the difference. By the way, if you save a 16-bit image as jpg, it will be converted to 8 bits on all programs that I am aware of. Michael ________________________________________________________________ On 27/03/2017 13:50, Thomas Eschner wrote: > Dear all, > > I am trying to illustrate artefacts introduced by storing files as > jpg by showing the difference of two identical 16-bit images, one > stored as jpg and one as tiff. > > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, > I end up with files having their values set to 65535 exclusively. > > Only with k2 = 0 I seem to get more or less reasonable results, but I > lose negative values. > > Could please anybody give me a hint? > > Thank you. > > Kind regards, Thomas > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Thomas Eschner
Hi Thomas,
I usually do these sorts of comparisons using the Image Calculator command, subtracting one image from the other, and checking the "32-bit result" box. This is fine if your goal is to illustrate visually as you say. For quantitative comparison, I agree with Joel that it's better to be more rigorous, with something like colocalization. Regards, Curtis -- Curtis Rueden LOCI software architect - https://loci.wisc.edu/software ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden Did you know ImageJ has a forum? http://forum.imagej.net/ On Mon, Mar 27, 2017 at 6:50 AM, Thomas Eschner <[hidden email]> wrote: > Dear all, > > I am trying to illustrate artefacts introduced by storing files as jpg by > showing the difference of two identical 16-bit images, one stored as jpg > and one as tiff. > > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, I end > up with files having their values set to 65535 exclusively. > > Only with k2 = 0 I seem to get more or less reasonable results, but I lose > negative values. > > Could please anybody give me a hint? > > Thank you. > > Kind regards, > Thomas > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Curtis, hi all, thank you for your input. As i understand - the quirk is there, but there's also a workaround. That should do it at the moment. Thanks once more. Kind regards, Thomas Gesendet: Montag, 27. März 2017 um 18:03 Uhr Von: "Curtis Rueden" <[hidden email]> An: [hidden email] Betreff: Re: Calculator Plus Hi Thomas, I usually do these sorts of comparisons using the Image Calculator command, subtracting one image from the other, and checking the "32-bit result" box. This is fine if your goal is to illustrate visually as you say. For quantitative comparison, I agree with Joel that it's better to be more rigorous, with something like colocalization. Regards, Curtis -- Curtis Rueden LOCI software architect - https://loci.wisc.edu/software ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden[https://imagej.net/User:Rueden] Did you know ImageJ has a forum? http://forum.imagej.net/[http://forum.imagej.net/] On Mon, Mar 27, 2017 at 6:50 AM, Thomas Eschner <[hidden email]> wrote: > Dear all, > > I am trying to illustrate artefacts introduced by storing files as jpg by > showing the difference of two identical 16-bit images, one stored as jpg > and one as tiff. > > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, I end > up with files having their values set to 65535 exclusively. > > Only with k2 = 0 I seem to get more or less reasonable results, but I lose > negative values. > > Could please anybody give me a hint? > > Thank you. > > Kind regards, > Thomas > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html[http://imagej.nih.gov/ij/list.html] > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html[http://imagej.nih.gov/ij/list.html] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Thomas,
> As i understand - the quirk is there, but there's also a workaround. To comment on the Calculator Plus plugin [1] specifically: my understanding is that Gabriel Landini is currently the maintainer of that plugin, which is bundled with the Fiji distribution of ImageJ. However, essentially no work (bug-fixes or improvements) have been done to that plugin for many years. I do not know if Gabriel considers himself to be actively maintaining the plugin these days -- I'll leave it to him to comment on that. Perhaps he has insight into the behavior you observed. Regards, Curtis -- Curtis Rueden LOCI software architect - https://loci.wisc.edu/software ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden Did you know ImageJ has a forum? http://forum.imagej.net/ [1] https://github.com/fiji/Calculator_Plus On Tue, Mar 28, 2017 at 4:19 AM, Thomas Eschner <[hidden email]> wrote: > > Hi Curtis, hi all, > > thank you for your input. As i understand - the quirk is there, but > there's also a workaround. That should do it at the moment. > > Thanks once more. > > Kind regards, > Thomas > > > > Gesendet: Montag, 27. März 2017 um 18:03 Uhr > Von: "Curtis Rueden" <[hidden email]> > An: [hidden email] > Betreff: Re: Calculator Plus > Hi Thomas, > > I usually do these sorts of comparisons using the Image Calculator command, > subtracting one image from the other, and checking the "32-bit result" box. > This is fine if your goal is to illustrate visually as you say. For > quantitative comparison, I agree with Joel that it's better to be more > rigorous, with something like colocalization. > > Regards, > Curtis > > -- > Curtis Rueden > LOCI software architect - https://loci.wisc.edu/software > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden > [https://imagej.net/User:Rueden] > Did you know ImageJ has a forum? http://forum.imagej.net/[http: > //forum.imagej.net/] > > > On Mon, Mar 27, 2017 at 6:50 AM, Thomas Eschner <[hidden email]> > wrote: > > > Dear all, > > > > I am trying to illustrate artefacts introduced by storing files as jpg by > > showing the difference of two identical 16-bit images, one stored as jpg > > and one as tiff. > > > > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, I > end > > up with files having their values set to 65535 exclusively. > > > > Only with k2 = 0 I seem to get more or less reasonable results, but I > lose > > negative values. > > > > Could please anybody give me a hint? > > > > Thank you. > > > > Kind regards, > > Thomas > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list. > html[http://imagej.nih.gov/ij/list.html] > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list. > html[http://imagej.nih.gov/ij/list.html] > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Mon, Mar 27, 2017 at 6:50 AM, Thomas Eschner <[hidden email]>
> I am trying to illustrate artefacts introduced by storing files as jpg > by showing the difference of two identical 16-bit images, one stored as > jpg and one as tiff. First of all, are there 16bit jpegs?? I do not seem to be able to create one in IJ. > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, I > end up with files having their values set to 65535 exclusively. The subtraction in that plugin is scaled by k1 and offset by k2. I do not understand what is that you are tring to achieve. Why not use just the Image Calculator (not the "Plus" one) with the result as 32 bit? I do not think I am the maintainer of the plugin. I added the support for RGB images, plane-wise, long ago but that was about it. I think the plugin works fine as it is. If it doesn't, please post a macro that shows the problem. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Gabriel, dear all,
as I explained somewhere in-between of this discussion, the order was Taking RGB-image - Storing as jpg and tiff - difference of RGB-jpeg - RGB-tiff (working, but noisy) - 2 x transformation to 16 bit - difference of "16-bit jpeg" - "16-bit tiff" (not working as expected and reason for first of all mails). In that sense I do have 16-bit jpegs, i.e. images containing artefacts from jpg-compression (and possibly from transformation, too). And all I want to achieve is to have a difference of these images. For some reason I tried Calculatur Plus. Butd if for two quite similar images the difference scaled by k1 = 8 and offset by k2 = 128 is 65535 everywhere, I dare to say that subtraction in that plugin is _not_ scaled by k1 and offset by k2. I already learned that I should go with Image Calculator (non-Plus) and surely I will do so. However, I would have liked the idea that all offered tools work as expected/intended, even the simpler ones. I know I could/should do that myself, but let's remain realistic. Gabriel, as you are not the maintainer, I'd suggest to end the discussion at this point, but just fyi I attached two images and this macro: selectWindow("2017010061-130-small.jpg"); run("16-bit"); selectWindow("2017010061-132-small.tif"); run("16-bit"); run("Calculator Plus", "i1=2017010061-130-small.jpg i2=2017010061-132-small.tif operation=[Subtract: i2 = (i1-i2) x k1 + k2] k1=8 k2=128 create"); Kind regards, Thomas Gesendet: Donnerstag, 30. März 2017 um 03:19 Uhr Von: "Gabriel Landini" <[hidden email]> An: [hidden email] Betreff: Re: Calculator Plus On Mon, Mar 27, 2017 at 6:50 AM, Thomas Eschner <[hidden email]> > I am trying to illustrate artefacts introduced by storing files as jpg > by showing the difference of two identical 16-bit images, one stored as > jpg and one as tiff. First of all, are there 16bit jpegs?? I do not seem to be able to create one in IJ. > With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = 16, I > end up with files having their values set to 65535 exclusively. The subtraction in that plugin is scaled by k1 and offset by k2. I do not understand what is that you are tring to achieve. Why not use just the Image Calculator (not the "Plus" one) with the result as 32 bit? I do not think I am the maintainer of the plugin. I added the support for RGB images, plane-wise, long ago but that was about it. I think the plugin works fine as it is. If it doesn't, please post a macro that shows the problem. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html 2017010061-130-small.jpg (12K) Download Attachment 2017010061-132-small.tif (69K) Download Attachment |
Dear Thomas,
from my point of view you didn't specify enough of what you really want. Comparing two RGB images isn't defined per se. You need to tell us how you want to deal with color. One possibility is to compare corresponding color channels. This in turn can be done by subtracting the corresponding channels and this can be done with and without sign, i.e. as 32bit (Subtract) or as 8bit (Difference) result. Finally the resulting channels can again be combined to give an RGB-image. Attached please find the RGB-result from your example image 2017010061-132-small.tif that I saved as JPG-image in ImageJ (with the default quality of ImageJ) for comparison. The resulting RGB image from channel-wise subtraction is displayed as follows: The three bipolar channel-wise 32bit results from the subtractions are made to range from -20 to 20 and this span of 0...40 is finally shown as the RGB-result. Evidently, your original TIF-image is quite noisy and this shows up in pronounced JPG-artifacts all over the image. I hope this clarifies the issue a bit. Regards Herbie :::::::::::::::::::::::::::::::::::::::::::: Am 30.03.17 um 14:03 schrieb Thomas Eschner: > Dear Gabriel, dear all, > > as I explained somewhere in-between of this discussion, the order > was Taking RGB-image - Storing as jpg and tiff - difference of > RGB-jpeg - RGB-tiff (working, but noisy) - 2 x transformation to 16 > bit - difference of "16-bit jpeg" - "16-bit tiff" (not working as > expected and reason for first of all mails). In that sense I do have > 16-bit jpegs, i.e. images containing artefacts from jpg-compression > (and possibly from transformation, too). > > And all I want to achieve is to have a difference of these images. > For some reason I tried Calculatur Plus. Butd if for two quite > similar images the difference scaled by k1 = 8 and offset by k2 = 128 > is 65535 everywhere, I dare to say that subtraction in that plugin is > _not_ scaled by k1 and offset by k2. > > I already learned that I should go with Image Calculator (non-Plus) > and surely I will do so. However, I would have liked the idea that > all offered tools work as expected/intended, even the simpler ones. I > know I could/should do that myself, but let's remain realistic. > > Gabriel, as you are not the maintainer, I'd suggest to end the > discussion at this point, but just fyi I attached two images and this > macro: > > selectWindow("2017010061-130-small.jpg"); run("16-bit"); > selectWindow("2017010061-132-small.tif"); run("16-bit"); > run("Calculator Plus", "i1=2017010061-130-small.jpg > i2=2017010061-132-small.tif operation=[Subtract: i2 = (i1-i2) x k1 + > k2] k1=8 k2=128 create"); > > > Kind regards, Thomas > > > Gesendet: Donnerstag, 30. März 2017 um 03:19 Uhr Von: "Gabriel > Landini" <[hidden email]> An: [hidden email] Betreff: Re: > Calculator Plus On Mon, Mar 27, 2017 at 6:50 AM, Thomas Eschner > <[hidden email]> >> I am trying to illustrate artefacts introduced by storing files as >> jpg by showing the difference of two identical 16-bit images, one >> stored as jpg and one as tiff. > > First of all, are there 16bit jpegs?? I do not seem to be able to > create one in IJ. > >> With Calculator Plus, setting e.g. Subtract with k1 = 1 and k2 = >> 16, I end up with files having their values set to 65535 >> exclusively. > > The subtraction in that plugin is scaled by k1 and offset by k2. I do > not understand what is that you are tring to achieve. Why not use > just the Image Calculator (not the "Plus" one) with the result as 32 > bit? > > I do not think I am the maintainer of the plugin. I added the support > for RGB images, plane-wise, long ago but that was about it. I think > the plugin works fine as it is. If it doesn't, please post a macro > that shows the problem. > > Cheers > > Gabriel > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html Result_2017010061-132-small.png (34K) Download Attachment |
Free forum by Nabble | Edit this page |