For our research we are making images of Arabidopsis plants growing in
plates andwe try to measure the area of each plant automatically. In this way we try to obtain the growth rate of each plant in the plate We successfully made a macro to do the analysis of a folder of images and return the results in a text file, but now we sometimes have the problem that one plant is divided into two during automatic analysis. Now I was wondering if it is possible to write a macro to instruct ImageJ to combine the ROIs found within a certain distance of each other. (let say, if the 2 ROIs are less than 2mm apart, they should be combined). |
One possibility is the application of a Process->Binary->Close-
operation with appropriate size. This would join objects with distance less than the given size. Unluckily this operation works on binary images not on ROI's. Regards Karsten Am 20.04.2009 um 09:42 schrieb Karel Jansseune: > For our research we are making images of Arabidopsis plants growing in > plates andwe try to measure the area of each plant automatically. In > this > way we try to obtain the growth rate of each plant in the plate > We successfully made a macro to do the analysis of a folder of > images and > return the results in a text file, but now we sometimes have the > problem > that one plant is divided into two during automatic analysis. > > Now I was wondering if it is possible to write a macro to instruct > ImageJ > to combine the ROIs found within a certain distance of each other. > (let > say, if the 2 ROIs are less than 2mm apart, they should be combined). Karsten [hidden email] |
In reply to this post by Karel Jansseune-2
The binary step is no problem, the image is turned to binary anyhow.
the process itself is fine, it neatly closes the gap, but it also expands the selected region. Also it requires some user input as the gaps aren't always the same distance, for our research, it is important to get the user input to a minimum (to minimize error) anyway, this might solve some of the issues that I'm encountering , thank you for the help On Mon, 20 Apr 2009 11:04:40 +0200, Karsten Rodenacker <[hidden email]> wrote: >One possibility is the application of a Process->Binary->Close- >operation with appropriate size. This would join objects with distance >less than the given size. Unluckily this operation works on binary >images not on ROI's. >Regards >Karsten > >Am 20.04.2009 um 09:42 schrieb Karel Jansseune: > >> For our research we are making images of Arabidopsis plants growing in >> plates andwe try to measure the area of each plant automatically. In >> this >> way we try to obtain the growth rate of each plant in the plate >> We successfully made a macro to do the analysis of a folder of >> images and >> return the results in a text file, but now we sometimes have the >> problem >> that one plant is divided into two during automatic analysis. >> >> Now I was wondering if it is possible to write a macro to instruct >> ImageJ >> to combine the ROIs found within a certain distance of each other. >> (let >> say, if the 2 ROIs are less than 2mm apart, they should be combined). > >Karsten >[hidden email] |
... with some programming you can avoid the enlargement and use the
joined pattern to select the pieces for roi generation. Some "Create Selection" and roiManager("Update") could generate the roi of the (underlying) disconnected pieces. Regards Karsten Am 20.04.2009 um 11:31 schrieb Karel Jansseune: > The binary step is no problem, the image is turned to binary anyhow. > > the process itself is fine, it neatly closes the gap, but it also > expands > the selected region. Also it requires some user input as the gaps > aren't > always the same distance, for our research, it is important to get the > user input to a minimum (to minimize error) > > anyway, this might solve some of the issues that I'm encountering , > > thank you for the help > > > On Mon, 20 Apr 2009 11:04:40 +0200, Karsten Rodenacker > <[hidden email]> wrote: > >> One possibility is the application of a Process->Binary->Close- >> operation with appropriate size. This would join objects with >> distance >> less than the given size. Unluckily this operation works on binary >> images not on ROI's. >> Regards >> Karsten >> >> Am 20.04.2009 um 09:42 schrieb Karel Jansseune: >> >>> For our research we are making images of Arabidopsis plants >>> growing in >>> plates andwe try to measure the area of each plant automatically. In >>> this >>> way we try to obtain the growth rate of each plant in the plate >>> We successfully made a macro to do the analysis of a folder of >>> images and >>> return the results in a text file, but now we sometimes have the >>> problem >>> that one plant is divided into two during automatic analysis. >>> >>> Now I was wondering if it is possible to write a macro to instruct >>> ImageJ >>> to combine the ROIs found within a certain distance of each other. >>> (let >>> say, if the 2 ROIs are less than 2mm apart, they should be >>> combined). >> >> Karsten >> [hidden email] Karsten [hidden email] |
In reply to this post by Karel Jansseune-2
Hi Karel:
two remarks: (1) the Process>Binary>Dilate, Erode, Open, Close commands use square kernels. If distance is really important, use Process>Math>Minimum or Maximum instead, these have circular kernels. If you have large distance, thresholding the EDM (Process>Binary>Distance Map) of the inverted image will be faster than the Math>Minimum or Maximum filters. With the current implementation of the EDM in ImageJ it is not 100% accurate; we might see an EDM with better accuracy soon. (2) you can enlarge/shrink the ROIs: Edit>Selection>Enlarge This uses a circular kernel for irregular rois as those from the particle analyzer. Michael ________________________________________________________________ On 20 Apr 2009, at 11:31, Karel Jansseune wrote: > The binary step is no problem, the image is turned to binary anyhow. > > the process itself is fine, it neatly closes the gap, but it also > expands > the selected region. Also it requires some user input as the gaps > aren't > always the same distance, for our research, it is important to get the > user input to a minimum (to minimize error) > > anyway, this might solve some of the issues that I'm encountering , > > thank you for the help > > > On Mon, 20 Apr 2009 11:04:40 +0200, Karsten Rodenacker > <[hidden email]> wrote: > >> One possibility is the application of a Process->Binary->Close- >> operation with appropriate size. This would join objects with >> distance >> less than the given size. Unluckily this operation works on binary >> images not on ROI's. >> Regards >> Karsten >> >> Am 20.04.2009 um 09:42 schrieb Karel Jansseune: >> >>> For our research we are making images of Arabidopsis plants >>> growing in >>> plates andwe try to measure the area of each plant automatically. In >>> this >>> way we try to obtain the growth rate of each plant in the plate >>> We successfully made a macro to do the analysis of a folder of >>> images and >>> return the results in a text file, but now we sometimes have the >>> problem >>> that one plant is divided into two during automatic analysis. >>> >>> Now I was wondering if it is possible to write a macro to instruct >>> ImageJ >>> to combine the ROIs found within a certain distance of each other. >>> (let >>> say, if the 2 ROIs are less than 2mm apart, they should be >>> combined). >> >> Karsten >> [hidden email] |
In reply to this post by Karel Jansseune-2
Karel Jansseune <karel.jansseune@...> writes:
> > For our research we are making images of Arabidopsis plants growing in > plates andwe try to measure the area of each plant automatically. In this > way we try to obtain the growth rate of each plant in the plate > We successfully made a macro to do the analysis of a folder of images and > return the results in a text file, but now we sometimes have the problem > that one plant is divided into two during automatic analysis. > > Now I was wondering if it is possible to write a macro to instruct ImageJ > to combine the ROIs found within a certain distance of each other. (let > say, if the 2 ROIs are less than 2mm apart, they should be combined). > > //macro code: roiManager("Reset"); run("Blobs (25K)"); setAutoThreshold(); run("Set Measurements...", " centroid"); run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show="+ "Nothing display clear"); minDx=getNumber("Minimum distance between ROIs", 50); n=roiManager("count"); Mlabel="Distance to previous"; setResult(Mlabel, 0, NaN); for(i=0; i<nResults-1; i++) { x1= getResult('X', i); y1=getResult('Y', i); x2= getResult('X', i+1); y2=getResult('Y', i+1); distance= sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); setResult(Mlabel, i+1, distance); } updateResults; for(i=2; i<nResults; i++) { distance=getResult(Mlabel, i); x1= getResult('X', i-1); y1=getResult('Y', i-1); x2= getResult('X', i); y2=getResult('Y', i); if(distance<= minDx) { doWand(x1,y1); setKeyDown("shift"); doWand(x2,y2); roiManager("Add")} } resetThreshold; setOption("Show All", true); // end T. |
In reply to this post by Michael Schmid
On Monday 20 April 2009 10:48:21 Michael Schmid wrote:
> With the current > implementation of the EDM in ImageJ it is not 100% accurate; we might > see an EDM with better accuracy soon. Like now? :-) http://www.optinav.com/Local_Thickness.htm I do not know what are the licensing issues with the distance transform part in that jar, but it would be nice to see this implemented as the default edm in ij. Cheers Gabriel |
Gabriel, Michael
>> With the current >> implementation of the EDM in ImageJ it is not 100% accurate; we might >> see an EDM with better accuracy soon. > > Like now? :-) > http://www.optinav.com/Local_Thickness.htm > > I do not know what are the licensing issues with the distance transform part > in that jar, but it would be nice to see this implemented as the default edm > in ij. > I've been through the source of Local Thickness and it's "All rights reserved" to OptiNav, with its own licensing text. Redistribution and modification are allowed provided that some conditions are met, which include maintaining the text of the licence. That's in conflict with ImageJ's unlicensed public domain status. As I understand it, unless OptiNav gives Wayne specific permission (or releases an unlicensed version) Local Thickness and its classes & methods can't be included in ImageJ without breaching OptiNav's copyright or changing ImageJ's public domain status. Mike |
In reply to this post by Karel Jansseune-2
thank you a lot,
This might be exactely what I need. I already tried it and it looks quite promising. regards, Karel Jansseune On Mon, 20 Apr 2009 10:05:42 +0000, Tiago Ferreira <[hidden email]> wrote: >Karel Jansseune <karel.jansseune@...> writes: > >> >> For our research we are making images of Arabidopsis plants growing in >> plates andwe try to measure the area of each plant automatically. In this >> way we try to obtain the growth rate of each plant in the plate >> We successfully made a macro to do the analysis of a folder of images and >> return the results in a text file, but now we sometimes have the problem >> that one plant is divided into two during automatic analysis. >> >> Now I was wondering if it is possible to write a macro to instruct ImageJ >> to combine the ROIÂs found within a certain distance of each other. (let >> say, if the 2 ROIÂs are less than 2mm apart, they should be combined). >> >> >Don't know if this helps, but maybe you could try something like this: > >//macro code: >roiManager("Reset"); >run("Blobs (25K)"); >setAutoThreshold(); >run("Set Measurements...", " centroid"); >run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show="+ >"Nothing display clear"); >minDx=getNumber("Minimum distance between ROIs", 50); >n=roiManager("count"); >Mlabel="Distance to previous"; >setResult(Mlabel, 0, NaN); >for(i=0; i<nResults-1; i++) { > x1= getResult('X', i); y1=getResult('Y', i); > x2= getResult('X', i+1); y2=getResult('Y', i+1); > distance= sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); > setResult(Mlabel, i+1, distance); >} >updateResults; > >for(i=2; i<nResults; i++) { > distance=getResult(Mlabel, i); > x1= getResult('X', i-1); y1=getResult('Y', i-1); > x2= getResult('X', i); y2=getResult('Y', i); > if(distance<= minDx) { > doWand(x1,y1); > setKeyDown("shift"); > doWand(x2,y2); > roiManager("Add")} >} >resetThreshold; >setOption("Show All", true); > >// end >T. >========================================================================= |
In reply to this post by karo03
Hi
Could you please unsubscribe me to the Image list. Thanks Regards Quang |
Free forum by Nabble | Edit this page |