Help to create macro

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Help to create macro

OBEID Patricia 154904
Hello,
I want to write a macro allowing me to characterize inclusions in the cell nucleus (number / nucleus, size and intensity of fluorescence).
I think at first to segment the nuclei and then look inside this mask for the inclusions of interest.
My problem is that I do not know how to make a new segmentation in the segmentation of the nuclei.
Thank you in advance for your advice and ideas so that I can write this macro.
I attach an image of cores (DAPI) and an image with the marker of interest (TxRed).
A big thank you to all,
Patricia

_______________________________________
[http://www.cea.fr/var/cea/signatures/cea_logo.jpg]<http://www.cea.fr/>

Patricia OBEÏD
Ingénieur de Recherche /Animateur Informatique Biomics
Institut de Recherche Interdisciplinaire de Grenoble
DRF / IRIG / DS /BGE U1038/ Biomics / Bât 4020
Commissariat à l'énergie atomique et aux énergies alternatives
Email : [hidden email]<mailto:[hidden email]>
Tél : (+33)4 38 78 47 12         Fax : (+33)4 38 78 59 17

Toute notre actualité sur www.cea.fr et sur http://www.cea.fr/drf/big/bge/biomics<http://www.cea.fr>

<http://www.cea.fr>Suivez-nous également sur Twitter : @CEA_Recherche<https://twitter.com/#!/CEA_Recherche> et sur https://twitter.com/BiomicsLab




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

image001.jpg (11K) Download Attachment
s1_TxRed.tif (700K) Download Attachment
s1_DAPI.tif (700K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help to create macro

Gabriel Landini
This kind of problem can be resolved using RCC
https://blog.bham.ac.uk/intellimic/spatial-reasoning-with-imagej-using-the-region-connection-calculus/

Once you segment your objects as binary, you could look for the relation of
regions in one image with the regions in the other image.
See "Computing relations between multiple regions" section in that page. RCC5
should be enough to detect the PP relations between the intranuclear regions
and the nuclei.
Once you have the RCC table generated, then it is a matter of searching the
table across the "nuclear regions axis" and count how many PP relations they
hold with the "intranuclear regions" axis.

There are several papers with examples here:
https://blog.bham.ac.uk/intellimic/references/

Hope it helps.

Gabriel

On Thursday, 12 December 2019 05:31:49 GMT [hidden email] wrote:

> Hello,
> I want to write a macro allowing me to characterize inclusions in the cell
> nucleus (number / nucleus, size and intensity of fluorescence). I think at
> first to segment the nuclei and then look inside this mask for the
> inclusions of interest. My problem is that I do not know how to make a new
> segmentation in the segmentation of the nuclei. Thank you in advance for
> your advice and ideas so that I can write this macro. I attach an image of
> cores (DAPI) and an image with the marker of interest (TxRed). A big thank
> you to all,
> Patricia
>
> _______________________________________
> [http://www.cea.fr/var/cea/signatures/cea_logo.jpg]<http://www.cea.fr/>
>
> Patricia OBEÏD
> Ingénieur de Recherche /Animateur Informatique Biomics
> Institut de Recherche Interdisciplinaire de Grenoble
> DRF / IRIG / DS /BGE U1038/ Biomics / Bât 4020
> Commissariat à l'énergie atomique et aux énergies alternatives
> Email : [hidden email]<mailto:[hidden email]>
> Tél : (+33)4 38 78 47 12         Fax : (+33)4 38 78 59 17
>
> Toute notre actualité sur www.cea.fr et sur
> http://www.cea.fr/drf/big/bge/biomics<http://www.cea.fr>
>
> <http://www.cea.fr>Suivez-nous également sur Twitter :
> @CEA_Recherche<https://twitter.com/#!/CEA_Recherche> et sur
> https://twitter.com/BiomicsLab
>
>
>
>
> --
> 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: Help to create macro

gnelson
In reply to this post by OBEID Patricia 154904
That may be overkill if I understand the original question.  Do you just need to count the objects inside the ROIs?  If that is the case, then you can cycle through each ROI in the ROI manager and find local maxima in each ROI on the channel of interest.  The manual code below will let you do it.  Obviously, you can automate the whole thing.  If you need/want other data for the spots, then obviously this won't work, and I would consider Gabriel's option, or you could try cycling through each ROI and duplicating that ROI as a new image to allow analysis of the spots in that- I have considered doing this before- you need to delete data outside the ROI after duplicating, since it duplicates a rectangle around the ROI.  I abandoned this since I was more interested in counts, and it was getting a bit complicated for my abilities!

------
//collect ROIS (e.g. nuclei) from one image,then swap to object of interest (e.g. foci) channel and count the spots.  
//Assumes you have both images open (the one for finding the ROIs, eg nuclear counterstain and the one for the spots inside it.  

var tolerance = 30;

originalImage = getTitle();
run("8-bit");
run("Overlay Options...", "stroke=red width=1 fill=none set");
run("Median...", "radius=6");
run("Subtract Background...", "rolling=125 sliding");
run("Threshold", "method=Default white");
roiManager("Reset");
run("Analyze Particles...", "pixel exclude clear add");

waitForUser("Select the image for spot counting");
run("8-bit");

run("Gaussian Blur...", "sigma=1");
run("Subtract Background...", "rolling=25");

for(i=0; i<roiManager("count"); i++) {
        roiManager("select", i);
        run("Find Maxima...", "noise="+tolerance+" output=[Count]");
        run("Find Maxima...", "noise="+tolerance+" output=[Point Selection]");
        run("Add Selection...");
}
------

Glyn

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

Re: Help to create macro

OBEID Patricia 154904
Hi Glyn,
I'm actually interested in the intensity and size of each object contained in the nucleus.
So I'm trying to adapt Gabriel's solution but I admit that I'm getting lost ...
Thank you very much for your feedback.
Regards,
Patricia

-----Message d'origine-----
De : ImageJ Interest Group <[hidden email]> De la part de Glyn Nelson
Envoyé : vendredi 13 décembre 2019 12:52
À : [hidden email]
Objet : Re: Help to create macro

That may be overkill if I understand the original question.  Do you just need to count the objects inside the ROIs?  If that is the case, then you can cycle through each ROI in the ROI manager and find local maxima in each ROI on the channel of interest.  The manual code below will let you do it.  Obviously, you can automate the whole thing.  If you need/want other data for the spots, then obviously this won't work, and I would consider Gabriel's option, or you could try cycling through each ROI and duplicating that ROI as a new image to allow analysis of the spots in that- I have considered doing this before- you need to delete data outside the ROI after duplicating, since it duplicates a rectangle around the ROI.  I abandoned this since I was more interested in counts, and it was getting a bit complicated for my abilities!

------
//collect ROIS (e.g. nuclei) from one image,then swap to object of interest (e.g. foci) channel and count the spots.  
//Assumes you have both images open (the one for finding the ROIs, eg nuclear counterstain and the one for the spots inside it.  

var tolerance = 30;

originalImage = getTitle();
run("8-bit");
run("Overlay Options...", "stroke=red width=1 fill=none set"); run("Median...", "radius=6"); run("Subtract Background...", "rolling=125 sliding"); run("Threshold", "method=Default white"); roiManager("Reset"); run("Analyze Particles...", "pixel exclude clear add");

waitForUser("Select the image for spot counting"); run("8-bit");

run("Gaussian Blur...", "sigma=1");
run("Subtract Background...", "rolling=25");

for(i=0; i<roiManager("count"); i++) {
        roiManager("select", i);
        run("Find Maxima...", "noise="+tolerance+" output=[Count]");
        run("Find Maxima...", "noise="+tolerance+" output=[Point Selection]");
        run("Add Selection...");
}
------

Glyn

--
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: Help to create macro

Gabriel Landini
On Tuesday, 17 December 2019 13:44:41 GMT [hidden email] wrote:
> Hi Glyn,
> I'm actually interested in the intensity and size of each object contained
> in the nucleus. So I'm trying to adapt Gabriel's solution but I admit that
> I'm getting lost ... Thank you very much for your feedback.
> Regards,
> Patricia

If you get stuck with the RCC analysis, please binarise (and clean) the images
of the nuclei and the bright dots in the nuclei and post them here. I can then
attempt to show you how I think this can be resolved using macros calling the
RCC plugin(s).

Cheers

Gabriel

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

Re: Help to create macro

OBEID Patricia 154904
Good evening Gabriel,
as proposed, here are the binarized and cleaned images (as best as I could).
Thank you very much for your help.
Cordially
Patricia

-----Message d'origine-----
De : ImageJ Interest Group <[hidden email]> De la part de Gabriel Landini
Envoyé : mardi 17 décembre 2019 15:38
À : [hidden email]
Objet : Re: Help to create macro

On Tuesday, 17 December 2019 13:44:41 GMT [hidden email] wrote:
> Hi Glyn,
> I'm actually interested in the intensity and size of each object
> contained in the nucleus. So I'm trying to adapt Gabriel's solution
> but I admit that I'm getting lost ... Thank you very much for your feedback.
> Regards,
> Patricia

If you get stuck with the RCC analysis, please binarise (and clean) the images of the nuclei and the bright dots in the nuclei and post them here. I can then attempt to show you how I think this can be resolved using macros calling the RCC plugin(s).

Cheers

Gabriel

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

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

s1_TxRed_binary.tif (350K) Download Attachment
s1_DAPI_binary.tif (350K) Download Attachment