Hello guys! For sure this is a simple task but I am trying and not getting it done. I want some particles to be selected *by color**treshold*. Please see the excample tiff file attached, it is just an excample to illustrae the principle. I want the large blue particles (including the green inclusions) on the right selected without having the blue on the left side selected... But how? Best regards, Jonas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I guess there are several solutions. Here is one, considering you only want
blue particles that contain green ones. Color threshold to select green regions. Dilate result. Color threshold to select blue regions. Use a function to mark the blue objects that touch the dilated green objects. This function is available in tbe Biovoxxel set of plugins ( http://www.biovoxxel.de/macros.html) by Jan Brocher. Hope that helps. Prof. Sidnei Paciornik Grupo de Análise de Imagens e Microscopia Digital DEMa <http://www.dema.puc-rio.br/> - Departamento de Engenharia de Materiais PUC-Rio <http://www.puc-rio.br/> Rua Marquês de São Vicente 225 Prédio Leme, Sala 501L Gávea - Rio de Janeiro - RJ 22451-900 - Brasil tel: (55)(21)3527-1243 On Wed, Jun 12, 2013 at 7:07 AM, Jonas Boehnke <[hidden email]> wrote: > > Hello guys! > > For sure this is a simple task but I am trying and not getting it done. > I want some particles to be selected *by color**treshold*. > Please see the excample tiff file attached, it is just an excample to > illustrae the principle. > I want the large blue particles (including the green inclusions) on the > right selected without having the blue on the left side selected... > > But how? > > Best regards, > Jonas > > > -- > 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 |
In reply to this post by Jonas Boehnke
Hi,
It is fairly straightforward. Macro at the end of this email. I combined 2 colour thresholds, 1 to find blue objects, and one to find green ones, Then I dilated the green objects and used the dilated image as a seed in an binary reconstruct operation to find blue objects in contact with the green ones. The binary reconstruct plugin is from Gabriel Landini's Morpholoy collection of plugins, available from his web site here: http://www.dentistry.bham.ac.uk/landinig/software/software.html The colour threshold code is generated by the colour threshold dialog by hitting the "Macro" button (you do need to have the macro recorder running to record this). Hope this helps, Rob Macro: run("Duplicate...", "title=in1"); run("Duplicate...", "title=in2"); selectWindow("in1"); //First select all blue particles // Color Thresholder 1.47t // Autogenerated macro, single images only! min=newArray(3); max=newArray(3); filter=newArray(3); a=getTitle(); run("HSB Stack"); run("Convert Stack to Images"); selectWindow("Hue"); rename("0"); selectWindow("Saturation"); rename("1"); selectWindow("Brightness"); rename("2"); min[0]=157; max[0]=184; filter[0]="pass"; min[1]=47; max[1]=255; filter[1]="pass"; min[2]=134; max[2]=255; filter[2]="pass"; for (i=0;i<3;i++){ selectWindow(""+i); setThreshold(min[i], max[i]); run("Convert to Mask"); if (filter[i]=="stop") run("Invert"); } imageCalculator("AND create", "0","1"); imageCalculator("AND create", "Result of 0","2"); for (i=0;i<3;i++){ selectWindow(""+i); close(); } selectWindow("Result of 0"); close(); selectWindow("Result of Result of 0"); rename(a); // Colour Thresholding end of autogenerated code------------- selectWindow("in2"); //Next select green particles // Color Thresholder 1.47t // Autogenerated macro, single images only! min=newArray(3); max=newArray(3); filter=newArray(3); a=getTitle(); run("HSB Stack"); run("Convert Stack to Images"); selectWindow("Hue"); rename("0"); selectWindow("Saturation"); rename("1"); selectWindow("Brightness"); rename("2"); min[0]=65; max[0]=116; filter[0]="pass"; min[1]=101; max[1]=255; filter[1]="pass"; min[2]=135; max[2]=255; filter[2]="pass"; for (i=0;i<3;i++){ selectWindow(""+i); setThreshold(min[i], max[i]); run("Convert to Mask"); if (filter[i]=="stop") run("Invert"); } imageCalculator("AND create", "0","1"); imageCalculator("AND create", "Result of 0","2"); for (i=0;i<3;i++){ selectWindow(""+i); close(); } selectWindow("Result of 0"); close(); selectWindow("Result of Result of 0"); rename(a); // Colour Thresholding end of autogenerated code------------- //now find blue objects with green centre selectWindow("in2"); setOption("BlackBackground", true); run("Dilate"); //use binary reconstruct from Gabriel Landini to find blue //objects that overlap partially with green inner particles run("BinaryReconstruct ", "mask=in1 seed=in2 create white"); rename("blue particles"); selectWindow("in2"); rename("green centers"); selectWindow("in1"); close(); On 12/06/2013 11:07, Jonas Boehnke wrote: > > Hello guys! > > For sure this is a simple task but I am trying and not getting it done. > I want some particles to be selected *by color**treshold*. > Please see the excample tiff file attached, it is just an excample to > illustrae the principle. > I want the large blue particles (including the green inclusions) on > the right selected without having the blue on the left side selected... > > But how? > > Best regards, > Jonas > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- _____________________________ Dr. Rob van 't Hof Reader Centre for Molecular Medicine MRC IGMM University of Edinburgh Western General Hospital Crewe Road, Edinburgh EH4 2XU United Kingdom Phone: (+44)-131-6511031 email: [hidden email] _____________________________ The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Wednesday 12 Jun 2013 13:06:37 Rob van 't Hof wrote:
> It is fairly straightforward. Macro at the end of this email. > I combined 2 colour thresholds, 1 to find blue objects, and one to find > green ones, Then I dilated the green objects and used the dilated image > as a seed in an binary reconstruct operation to find blue objects in > contact with the green ones. The binary reconstruct plugin is from > Gabriel Landini's Morpholoy collection of plugins, available from his > web site here: > http://www.dentistry.bham.ac.uk/landinig/software/software.html > > The colour threshold code is generated by the colour threshold dialog by > hitting the "Macro" button (you do need to have the macro recorder > running to record this). That is a way of doing it, however it would fail if one blue regions touches (but does not surround) a green region. A way of avoiding this is to segment the regions a Rob suggested, but then do a binary fill of the blue regions, and use the green (without dilating) as seeds for the reconstruction. That way you reconstruct the filled blue regions that have green "inside" them, but not the ones that touch (there aren't any in the image, but there could be). If you need the blue regions with a hole where the green region was, just AND the result of the reconstruction with the firstly segmented blue image. Another way of resolving this is via region connection calculus http://www.dentistry.bham.ac.uk/landinig/software/spatial/rcc8d.html If you separate the blue and green regions in two different binary images and fill the blue regions, then the green regions are non-tangential proper part (NTPP relation) of the filled blue regions. The reference for this is: Randell DA, Landini, G, Galton A. Discrete Mereotopology for spatial reasoning in automated histological image analysis. IEEE Trans Patt Rec Mach Intell 35(3): 568-581, 2013. DOI: 10.1109/TPAMI.2012.128 Hope it is useful. Regards Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Rob van 't Hof-2
Thank you very much Gabriel, Sidnei and Rob.
I use Gabrial Landini's binary reconstruct (as described by Rob) and it works great! In my case, we analyse gold particles. Best regards, Jonas Am 12.06.2013 14:06, schrieb Rob van 't Hof: > Hi, > It is fairly straightforward. Macro at the end of this email. > I combined 2 colour thresholds, 1 to find blue objects, and one to > find green ones, Then I dilated the green objects and used the dilated > image as a seed in an binary reconstruct operation to find blue > objects in contact with the green ones. The binary reconstruct plugin > is from Gabriel Landini's Morpholoy collection of plugins, available > from his web site here: > http://www.dentistry.bham.ac.uk/landinig/software/software.html > > The colour threshold code is generated by the colour threshold dialog > by hitting the "Macro" button (you do need to have the macro recorder > running to record this). > > Hope this helps, > > Rob > > Macro: > > > run("Duplicate...", "title=in1"); > run("Duplicate...", "title=in2"); > selectWindow("in1"); > //First select all blue particles > // Color Thresholder 1.47t > // Autogenerated macro, single images only! > min=newArray(3); > max=newArray(3); > filter=newArray(3); > a=getTitle(); > run("HSB Stack"); > run("Convert Stack to Images"); > selectWindow("Hue"); > rename("0"); > selectWindow("Saturation"); > rename("1"); > selectWindow("Brightness"); > rename("2"); > min[0]=157; > max[0]=184; > filter[0]="pass"; > min[1]=47; > max[1]=255; > filter[1]="pass"; > min[2]=134; > max[2]=255; > filter[2]="pass"; > for (i=0;i<3;i++){ > selectWindow(""+i); > setThreshold(min[i], max[i]); > run("Convert to Mask"); > if (filter[i]=="stop") run("Invert"); > } > imageCalculator("AND create", "0","1"); > imageCalculator("AND create", "Result of 0","2"); > for (i=0;i<3;i++){ > selectWindow(""+i); > close(); > } > selectWindow("Result of 0"); > close(); > selectWindow("Result of Result of 0"); > rename(a); > // Colour Thresholding end of autogenerated code------------- > > selectWindow("in2"); > //Next select green particles > // Color Thresholder 1.47t > // Autogenerated macro, single images only! > min=newArray(3); > max=newArray(3); > filter=newArray(3); > a=getTitle(); > run("HSB Stack"); > run("Convert Stack to Images"); > selectWindow("Hue"); > rename("0"); > selectWindow("Saturation"); > rename("1"); > selectWindow("Brightness"); > rename("2"); > min[0]=65; > max[0]=116; > filter[0]="pass"; > min[1]=101; > max[1]=255; > filter[1]="pass"; > min[2]=135; > max[2]=255; > filter[2]="pass"; > for (i=0;i<3;i++){ > selectWindow(""+i); > setThreshold(min[i], max[i]); > run("Convert to Mask"); > if (filter[i]=="stop") run("Invert"); > } > imageCalculator("AND create", "0","1"); > imageCalculator("AND create", "Result of 0","2"); > for (i=0;i<3;i++){ > selectWindow(""+i); > close(); > } > selectWindow("Result of 0"); > close(); > selectWindow("Result of Result of 0"); > rename(a); > // Colour Thresholding end of autogenerated code------------- > > //now find blue objects with green centre > selectWindow("in2"); > setOption("BlackBackground", true); > run("Dilate"); > //use binary reconstruct from Gabriel Landini to find blue > //objects that overlap partially with green inner particles > run("BinaryReconstruct ", "mask=in1 seed=in2 create white"); > rename("blue particles"); > selectWindow("in2"); > rename("green centers"); > selectWindow("in1"); > close(); > > On 12/06/2013 11:07, Jonas Boehnke wrote: >> >> Hello guys! >> >> For sure this is a simple task but I am trying and not getting it done. >> I want some particles to be selected *by color**treshold*. >> Please see the excample tiff file attached, it is just an excample to >> illustrae the principle. >> I want the large blue particles (including the green inclusions) on >> the right selected without having the blue on the left side selected... >> >> But how? >> >> Best regards, >> Jonas >> >> >> -- >> 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 Rob van 't Hof-2
Hi again!
I got one more thing: As described by Rob, two images are created, one with "seed" particles to be dilated and one with "mask" objects. I would like to know the difference between "seed" and "mask" (in area or pixel or percent or so). I could simply perform "analyze particles" with both of them and then substract the second half of particles (see screenshot, particles 6-10) from the first half (1-5). It would be much easier to have the difference (in area, pixel or percent) in the same line with each particle, say instead of "FeretX" (see screenshot). I am thinking of how to change the "binary reconstruct" plugin, sothat the area diffence is not filled white, but say grey and then get a proportional value by analyzing the "mean grey value" (analyze/set measurements) What do you think? And how do I change the plugin to get a grey value instead of white? Thank you! Really great that you spend your free time to help others and me with such challenges! Best regards, Jonas Am 12.06.2013 14:06, schrieb Rob van 't Hof: > Hi, > It is fairly straightforward. Macro at the end of this email. > I combined 2 colour thresholds, 1 to find blue objects, and one to > find green ones, Then I dilated the green objects and used the dilated > image as a seed in an binary reconstruct operation to find blue > objects in contact with the green ones. The binary reconstruct plugin > is from Gabriel Landini's Morpholoy collection of plugins, available > from his web site here: > http://www.dentistry.bham.ac.uk/landinig/software/software.html > > The colour threshold code is generated by the colour threshold dialog > by hitting the "Macro" button (you do need to have the macro recorder > running to record this). > > Hope this helps, > > Rob > > Macro: > > > run("Duplicate...", "title=in1"); > run("Duplicate...", "title=in2"); > selectWindow("in1"); > //First select all blue particles > // Color Thresholder 1.47t > // Autogenerated macro, single images only! > min=newArray(3); > max=newArray(3); > filter=newArray(3); > a=getTitle(); > run("HSB Stack"); > run("Convert Stack to Images"); > selectWindow("Hue"); > rename("0"); > selectWindow("Saturation"); > rename("1"); > selectWindow("Brightness"); > rename("2"); > min[0]=157; > max[0]=184; > filter[0]="pass"; > min[1]=47; > max[1]=255; > filter[1]="pass"; > min[2]=134; > max[2]=255; > filter[2]="pass"; > for (i=0;i<3;i++){ > selectWindow(""+i); > setThreshold(min[i], max[i]); > run("Convert to Mask"); > if (filter[i]=="stop") run("Invert"); > } > imageCalculator("AND create", "0","1"); > imageCalculator("AND create", "Result of 0","2"); > for (i=0;i<3;i++){ > selectWindow(""+i); > close(); > } > selectWindow("Result of 0"); > close(); > selectWindow("Result of Result of 0"); > rename(a); > // Colour Thresholding end of autogenerated code------------- > > selectWindow("in2"); > //Next select green particles > // Color Thresholder 1.47t > // Autogenerated macro, single images only! > min=newArray(3); > max=newArray(3); > filter=newArray(3); > a=getTitle(); > run("HSB Stack"); > run("Convert Stack to Images"); > selectWindow("Hue"); > rename("0"); > selectWindow("Saturation"); > rename("1"); > selectWindow("Brightness"); > rename("2"); > min[0]=65; > max[0]=116; > filter[0]="pass"; > min[1]=101; > max[1]=255; > filter[1]="pass"; > min[2]=135; > max[2]=255; > filter[2]="pass"; > for (i=0;i<3;i++){ > selectWindow(""+i); > setThreshold(min[i], max[i]); > run("Convert to Mask"); > if (filter[i]=="stop") run("Invert"); > } > imageCalculator("AND create", "0","1"); > imageCalculator("AND create", "Result of 0","2"); > for (i=0;i<3;i++){ > selectWindow(""+i); > close(); > } > selectWindow("Result of 0"); > close(); > selectWindow("Result of Result of 0"); > rename(a); > // Colour Thresholding end of autogenerated code------------- > > //now find blue objects with green centre > selectWindow("in2"); > setOption("BlackBackground", true); > run("Dilate"); > //use binary reconstruct from Gabriel Landini to find blue > //objects that overlap partially with green inner particles > run("BinaryReconstruct ", "mask=in1 seed=in2 create white"); > rename("blue particles"); > selectWindow("in2"); > rename("green centers"); > selectWindow("in1"); > close(); > > On 12/06/2013 11:07, Jonas Boehnke wrote: >> >> Hello guys! >> >> For sure this is a simple task but I am trying and not getting it done. >> I want some particles to be selected *by color**treshold*. >> Please see the excample tiff file attached, it is just an excample to >> illustrae the principle. >> I want the large blue particles (including the green inclusions) on >> the right selected without having the blue on the left side selected... >> >> But how? >> >> Best regards, >> Jonas >> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Am 18.06.2013 00:24, schrieb Jonas Boehnke:
> Hi again! > I got one more thing: > > As described by Rob, two images are created, one with "seed" particles > to be dilated and one with "mask" objects. I would like to know the > difference between "seed" and "mask" (in area or pixel or percent or so). > I could simply perform "analyze particles" with both of them and then > substract the second half of particles (see screenshot, particles > 6-10) from the first half (1-5). > > It would be much easier to have the difference (in area, pixel or > percent) in the same line with each particle, say instead of "FeretX" > (see screenshot). > I am thinking of how to change the "binary reconstruct" plugin, sothat > the area diffence is not filled white, but say grey and then get a > proportional value by analyzing the "mean grey value" (analyze/set > measurements) > > What do you think? And how do I change the plugin to get a grey value > instead of white? > > Thank you! > Really great that you spend your free time to help others and me with > such challenges! > > Best regards, > Jonas > > > > > Am 12.06.2013 14:06, schrieb Rob van 't Hof: >> Hi, >> It is fairly straightforward. Macro at the end of this email. >> I combined 2 colour thresholds, 1 to find blue objects, and one to >> find green ones, Then I dilated the green objects and used the >> dilated image as a seed in an binary reconstruct operation to find >> blue objects in contact with the green ones. The binary reconstruct >> plugin is from Gabriel Landini's Morpholoy collection of plugins, >> available from his web site here: >> http://www.dentistry.bham.ac.uk/landinig/software/software.html >> >> The colour threshold code is generated by the colour threshold dialog >> by hitting the "Macro" button (you do need to have the macro recorder >> running to record this). >> >> Hope this helps, >> >> Rob >> >> Macro: >> >> >> run("Duplicate...", "title=in1"); >> run("Duplicate...", "title=in2"); >> selectWindow("in1"); >> //First select all blue particles >> // Color Thresholder 1.47t >> // Autogenerated macro, single images only! >> min=newArray(3); >> max=newArray(3); >> filter=newArray(3); >> a=getTitle(); >> run("HSB Stack"); >> run("Convert Stack to Images"); >> selectWindow("Hue"); >> rename("0"); >> selectWindow("Saturation"); >> rename("1"); >> selectWindow("Brightness"); >> rename("2"); >> min[0]=157; >> max[0]=184; >> filter[0]="pass"; >> min[1]=47; >> max[1]=255; >> filter[1]="pass"; >> min[2]=134; >> max[2]=255; >> filter[2]="pass"; >> for (i=0;i<3;i++){ >> selectWindow(""+i); >> setThreshold(min[i], max[i]); >> run("Convert to Mask"); >> if (filter[i]=="stop") run("Invert"); >> } >> imageCalculator("AND create", "0","1"); >> imageCalculator("AND create", "Result of 0","2"); >> for (i=0;i<3;i++){ >> selectWindow(""+i); >> close(); >> } >> selectWindow("Result of 0"); >> close(); >> selectWindow("Result of Result of 0"); >> rename(a); >> // Colour Thresholding end of autogenerated code------------- >> >> selectWindow("in2"); >> //Next select green particles >> // Color Thresholder 1.47t >> // Autogenerated macro, single images only! >> min=newArray(3); >> max=newArray(3); >> filter=newArray(3); >> a=getTitle(); >> run("HSB Stack"); >> run("Convert Stack to Images"); >> selectWindow("Hue"); >> rename("0"); >> selectWindow("Saturation"); >> rename("1"); >> selectWindow("Brightness"); >> rename("2"); >> min[0]=65; >> max[0]=116; >> filter[0]="pass"; >> min[1]=101; >> max[1]=255; >> filter[1]="pass"; >> min[2]=135; >> max[2]=255; >> filter[2]="pass"; >> for (i=0;i<3;i++){ >> selectWindow(""+i); >> setThreshold(min[i], max[i]); >> run("Convert to Mask"); >> if (filter[i]=="stop") run("Invert"); >> } >> imageCalculator("AND create", "0","1"); >> imageCalculator("AND create", "Result of 0","2"); >> for (i=0;i<3;i++){ >> selectWindow(""+i); >> close(); >> } >> selectWindow("Result of 0"); >> close(); >> selectWindow("Result of Result of 0"); >> rename(a); >> // Colour Thresholding end of autogenerated code------------- >> >> //now find blue objects with green centre >> selectWindow("in2"); >> setOption("BlackBackground", true); >> run("Dilate"); >> //use binary reconstruct from Gabriel Landini to find blue >> //objects that overlap partially with green inner particles >> run("BinaryReconstruct ", "mask=in1 seed=in2 create white"); >> rename("blue particles"); >> selectWindow("in2"); >> rename("green centers"); >> selectWindow("in1"); >> close(); >> >> On 12/06/2013 11:07, Jonas Boehnke wrote: >>> >>> Hello guys! >>> >>> For sure this is a simple task but I am trying and not getting it done. >>> I want some particles to be selected *by color**treshold*. >>> Please see the excample tiff file attached, it is just an excample >>> to illustrae the principle. >>> I want the large blue particles (including the green inclusions) on >>> the right selected without having the blue on the left side selected... >>> >>> But how? >>> >>> Best regards, >>> Jonas >>> >>> >>> -- >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |