2D histogram of two channels

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

2D histogram of two channels

Rainer M. Engel
Hey..

I did some search for 2D histograms of two channels (or of two one
channel/grey images).

It would look for example like this:
https://www.pyimagesearch.com/wp-content/uploads/2014/01/grant-2d-histograms.png
Source [1]

I found another resource, which describes image properties one
could read from these [2]. By this I got some new search phrases and
found Coloc 2 as an ImageJ-Plugin [3].

Can this plugin export the resulting 256x256px 2D Histograms? I have not
made this so far. Here they are called 2D intensity histograms. The
distributions' weight is also shown with an overlayed straight line
(regression line). This seems to be a static feature.

Is there a way to access/store this "2D intensity histogram"?

Any help is much appreciated.

Regards,
Rainer


[1]
https://www.pyimagesearch.com/2014/01/22/clever-girl-a-guide-to-utilizing-color-histograms-for-computer-vision-and-image-search-engines/

[2] https://svi.nl/TwoChannelHistogram

[3] https://imagej.net/Coloc_2


--
Rainer M. Engel
Pichelsdorferstr. 143
D-13595 Berlin

Tel: +49 (0)30-922 52 0 96
Mob: +49 (0)174-3355549

Web:    www.endime.de
E-Mail: [hidden email]

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

Re: 2D histogram of two channels

CARL Philippe (LBP)
Grüß Gott Rainer,
Would the following plugin:
        http://punias.free.fr/ImageJ/Colocalization_Finder.jar
which is the following update:
        http://punias.free.fr/ImageJ/colocalization-finder.html
of this plugin:
        https://imagej.nih.gov/ij/plugins/colocalization-finder.html
fulfill your needs?
If yes, please enjoy!
My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Rainer
M. Engel
Envoyé : mardi 4 juin 2019 12:38
À : [hidden email]
Objet : 2D histogram of two channels

Hey..

I did some search for 2D histograms of two channels (or of two one
channel/grey images).

It would look for example like this:
https://www.pyimagesearch.com/wp-content/uploads/2014/01/grant-2d-histograms
.png
Source [1]

I found another resource, which describes image properties one
could read from these [2]. By this I got some new search phrases and
found Coloc 2 as an ImageJ-Plugin [3].

Can this plugin export the resulting 256x256px 2D Histograms? I have not
made this so far. Here they are called 2D intensity histograms. The
distributions' weight is also shown with an overlayed straight line
(regression line). This seems to be a static feature.

Is there a way to access/store this "2D intensity histogram"?

Any help is much appreciated.

Regards,
Rainer


[1]
https://www.pyimagesearch.com/2014/01/22/clever-girl-a-guide-to-utilizing-co
lor-histograms-for-computer-vision-and-image-search-engines/

[2] https://svi.nl/TwoChannelHistogram

[3] https://imagej.net/Coloc_2


--
Rainer M. Engel
Pichelsdorferstr. 143
D-13595 Berlin

Tel: +49 (0)30-922 52 0 96
Mob: +49 (0)174-3355549

Web:    www.endime.de
E-Mail: [hidden email]

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

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

Re: 2D histogram of two channels

Jan Eglinger
In reply to this post by Rainer M. Engel
Dear Rainer,

in Fiji, you can get the result image of the Coloc_2 plugin directly via
scripting languages, e.g. using the following Groovy script:

```
#@ Img input1
#@ Img input2

import sc.fiji.coloc.gadgets.DataContainer
import sc.fiji.coloc.algorithms.Histogram2D

container = new DataContainer(input1, input2, 0, 0, "First", "Second")

hist2d = new Histogram2D("My custom 2D histogram")
hist2d.execute(container)

result = hist2d.getPlotImage()
```

The result image is 32-bit, so you will have to adjust the display range
to see anything.

For the red and green channel of the Clown sample image, I get the
attached result image. Interestingly, there seem to be some strange
artifacts in the 2D histogram image that I can't see in the 1d histogram
plots of the same image. Dan White (the author of Coloc_2) might want to
comment on this, but I'm not sure if he still subscribed to this mailing
list, so it might be worth asking on the image.sc forum instead:
https://forum.image.sc/

Best regards
Jan


On 04.06.2019 12:38, Rainer M. Engel wrote:

> Hey..
>
> I did some search for 2D histograms of two channels (or of two one
> channel/grey images).
>
> It would look for example like this:
> https://www.pyimagesearch.com/wp-content/uploads/2014/01/grant-2d-histograms.png
> Source [1]
>
> I found another resource, which describes image properties one
> could read from these [2]. By this I got some new search phrases and
> found Coloc 2 as an ImageJ-Plugin [3].
>
> Can this plugin export the resulting 256x256px 2D Histograms? I have not
> made this so far. Here they are called 2D intensity histograms. The
> distributions' weight is also shown with an overlayed straight line
> (regression line). This seems to be a static feature.
>
> Is there a way to access/store this "2D intensity histogram"?
>
> Any help is much appreciated.
>
> Regards,
> Rainer
>
>
> [1]
> https://www.pyimagesearch.com/2014/01/22/clever-girl-a-guide-to-utilizing-color-histograms-for-computer-vision-and-image-search-engines/
>
> [2] https://svi.nl/TwoChannelHistogram
>
> [3] https://imagej.net/Coloc_2
>
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

histogram2d.png (20K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 2D histogram of two channels

Rainer M. Engel
Dear Philipp and Jan,

I tried both methods you proposed.

I used the older version of color finder (2006/08/29: Version 1.2),
which gives me a 256x256px image right away. It applies some Auto
Threshold and sets "Fire" as LUT.

The groovy script Jan provided works also nice and as it seems maybe
with some advantage regarding speed & accuracy. I'll have to see.

I'm much more accustomed to the macro language, but I understand what
kind of groovy thing is going on and I'll try to extent the script to
some batch processing. I also found some related templates (Fiji Script
Editor).

Thank you both for your help.

Regards,
Rainer



Am 04.06.2019 um 16:38 schrieb Jan Eglinger:

> Dear Rainer,
>
> in Fiji, you can get the result image of the Coloc_2 plugin directly via
> scripting languages, e.g. using the following Groovy script:
>
> ```
> #@ Img input1
> #@ Img input2
>
> import sc.fiji.coloc.gadgets.DataContainer
> import sc.fiji.coloc.algorithms.Histogram2D
>
> container = new DataContainer(input1, input2, 0, 0, "First", "Second")
>
> hist2d = new Histogram2D("My custom 2D histogram")
> hist2d.execute(container)
>
> result = hist2d.getPlotImage()
> ```
>
> The result image is 32-bit, so you will have to adjust the display range
> to see anything.
>
> For the red and green channel of the Clown sample image, I get the
> attached result image. Interestingly, there seem to be some strange
> artifacts in the 2D histogram image that I can't see in the 1d histogram
> plots of the same image. Dan White (the author of Coloc_2) might want to
> comment on this, but I'm not sure if he still subscribed to this mailing
> list, so it might be worth asking on the image.sc forum instead:
> https://forum.image.sc/
>
> Best regards
> Jan
>
>
> On 04.06.2019 12:38, Rainer M. Engel wrote:
>> Hey..
>>
>> I did some search for 2D histograms of two channels (or of two one
>> channel/grey images).
>>
>> It would look for example like this:
>> https://www.pyimagesearch.com/wp-content/uploads/2014/01/grant-2d-histograms.png
>>
>> Source [1]
>>
>> I found another resource, which describes image properties one
>> could read from these [2]. By this I got some new search phrases and
>> found Coloc 2 as an ImageJ-Plugin [3].
>>
>> Can this plugin export the resulting 256x256px 2D Histograms? I have not
>> made this so far. Here they are called 2D intensity histograms. The
>> distributions' weight is also shown with an overlayed straight line
>> (regression line). This seems to be a static feature.
>>
>> Is there a way to access/store this "2D intensity histogram"?
>>
>> Any help is much appreciated.
>>
>> Regards,
>> Rainer
>>
>>
>> [1]
>> https://www.pyimagesearch.com/2014/01/22/clever-girl-a-guide-to-utilizing-color-histograms-for-computer-vision-and-image-search-engines/
>>
>>
>> [2] https://svi.nl/TwoChannelHistogram
>>
>> [3] https://imagej.net/Coloc_2
>>
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

Re: 2D histogram of two channels

Jeremy Adler
Dear Rainer,
Macro code to make a scatterplot.

Assumes an 8 bit RGB image is selected.
The macro is not fast, around 1 sec for a 400x400 image, but insanely slow without batch mode because it continuously flips between 3 images.

Displaying scatterplots is a problem - the intensity range  is usually very large and low values become difficult to separate from zero.
so - edit a LUT by setting 0 to a midrange grey.
Image/ colour/ edit lut - changing the 16step colour LUT works well.
And set the display range to 0-255, this combination makes single entries visible, but inevitably suppresses number above 255.
As an alternative the macro finds the highest value in the scatterplot and sets the display Range from 0-max/8 a compromise.

// make scatterplot from red and green channels of 8 bit RGB image;
print("\\Clear");
RGBID=getImageID();
wdth=getWidth();
ht=getHeight();
run("Split Channels");
BlueID=getImageID();
RedID=BlueID+2;
GrnID=BlueID+1;
// make scatterplot;
newImage("Scatterplot", "16-bit black", 256, 256, 1);// assumes 8 bit;
scatID=getImageID();
setBatchMode(1);
T0=getTime();// measure time;
Nmax=0; // max number in scatterplot;
for (x=0;x<wdth;x=x+1) {
  for (y=0;y<ht;y++){
selectImage(RedID);// X axis in scatterplot;
vRed=getPixel(x, y);
selectImage(GrnID);// Y axis in scatterplot;
vGrn=255-getPixel(x, y);// origin top left;
 selectImage(scatID);
 vScat=getPixel(vRed, vGrn);
 setPixel(vRed, vGrn, vScat+1);
 if (Nmax<vScat) Nmax=vScat; // track max entries;
}// y loop;
}// x loop;
Tend=getTime();
print("time ",Tend-T0," msecs");
print("max count in scatterplot ",Nmax);
setMinAndMax(0, Nmax/8); // display range
//setMinAndMax(0, 255);
run("16_colors");

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Rainer M. Engel
Sent: den 4 juni 2019 17:13
To: [hidden email]
Subject: Re: 2D histogram of two channels

Dear Philipp and Jan,

I tried both methods you proposed.

I used the older version of color finder (2006/08/29: Version 1.2), which gives me a 256x256px image right away. It applies some Auto Threshold and sets "Fire" as LUT.

The groovy script Jan provided works also nice and as it seems maybe with some advantage regarding speed & accuracy. I'll have to see.

I'm much more accustomed to the macro language, but I understand what kind of groovy thing is going on and I'll try to extent the script to some batch processing. I also found some related templates (Fiji Script Editor).

Thank you both for your help.

Regards,
Rainer



Am 04.06.2019 um 16:38 schrieb Jan Eglinger:

> Dear Rainer,
>
> in Fiji, you can get the result image of the Coloc_2 plugin directly
> via scripting languages, e.g. using the following Groovy script:
>
> ```
> #@ Img input1
> #@ Img input2
>
> import sc.fiji.coloc.gadgets.DataContainer
> import sc.fiji.coloc.algorithms.Histogram2D
>
> container = new DataContainer(input1, input2, 0, 0, "First", "Second")
>
> hist2d = new Histogram2D("My custom 2D histogram")
> hist2d.execute(container)
>
> result = hist2d.getPlotImage()
> ```
>
> The result image is 32-bit, so you will have to adjust the display
> range to see anything.
>
> For the red and green channel of the Clown sample image, I get the
> attached result image. Interestingly, there seem to be some strange
> artifacts in the 2D histogram image that I can't see in the 1d
> histogram plots of the same image. Dan White (the author of Coloc_2)
> might want to comment on this, but I'm not sure if he still subscribed
> to this mailing list, so it might be worth asking on the image.sc forum instead:
> https://forum.image.sc/
>
> Best regards
> Jan
>
>
> On 04.06.2019 12:38, Rainer M. Engel wrote:
>> Hey..
>>
>> I did some search for 2D histograms of two channels (or of two one
>> channel/grey images).
>>
>> It would look for example like this:
>> https://www.pyimagesearch.com/wp-content/uploads/2014/01/grant-2d-his
>> tograms.png
>>
>> Source [1]
>>
>> I found another resource, which describes image properties one could
>> read from these [2]. By this I got some new search phrases and found
>> Coloc 2 as an ImageJ-Plugin [3].
>>
>> Can this plugin export the resulting 256x256px 2D Histograms? I have
>> not made this so far. Here they are called 2D intensity histograms.
>> The distributions' weight is also shown with an overlayed straight
>> line (regression line). This seems to be a static feature.
>>
>> Is there a way to access/store this "2D intensity histogram"?
>>
>> Any help is much appreciated.
>>
>> Regards,
>> Rainer
>>
>>
>> [1]
>> https://www.pyimagesearch.com/2014/01/22/clever-girl-a-guide-to-utili
>> zing-color-histograms-for-computer-vision-and-image-search-engines/
>>
>>
>> [2] https://svi.nl/TwoChannelHistogram
>>
>> [3] https://imagej.net/Coloc_2
>>
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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








När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy

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