Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hello all,
We do have a macro "Analyze Particles" (the copy is joined below). We would like to add to that macro a watershed function. We tried to add run("Watershed"); just after setThreshold(30, 80); but this did not work. A message telling "8-bit binary image (0 and 255) required" appears. Anybody has a solution??? Thanks a lot Best regards Michelina Nascimbeni requires("1.38o"); dir = getDirectory("Choose a Directory "); list = getFileList(dir); setBatchMode(true); for (i=0; i<list.length; i++) { showProgress(i, list.length); open(dir+list[i]); getStatistics(area, mean, min, max, std); threshold = mean + 2.5*std; setThreshold(30, 80); run("Analyze Particles...", "size=100-650 summarize"); close; } selectWindow("Summary"); saveAs("Text", getDirectory("home")+"Summary.txt"); |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Michelina,
you have to run Edit>Selection>Create Mask after setThreshold: run("Create Mask"); This creates the 8-bit binary image required. The mask will be in a separate window, so don't forget to close both, the mask and the original window. Michael ________________________________________________________________ On 11 Jul 2007, at 16:35, Nascimbeni wrote: > Hello all, > > We do have a macro "Analyze Particles" (the copy is joined below). > We would like to add to that macro a watershed function. > We tried to add run("Watershed"); just after setThreshold(30, 80); but > this did not work. A message telling "8-bit binary image (0 and 255) > required" appears. > Anybody has a solution??? > > Thanks a lot > Best regards > Michelina Nascimbeni > > > > requires("1.38o"); > dir = getDirectory("Choose a Directory "); > list = getFileList(dir); > setBatchMode(true); > for (i=0; i<list.length; i++) { > showProgress(i, list.length); > open(dir+list[i]); > getStatistics(area, mean, min, max, std); > threshold = mean + 2.5*std; > setThreshold(30, 80); > run("Analyze Particles...", "size=100-650 summarize"); > close; > } > selectWindow("Summary"); > saveAs("Text", getDirectory("home")+"Summary.txt"); ... [show rest of quote]
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Michael,
Thanks for your answer. Actually, our macro runs on a folder containing a set of images. We need to include the watershed function into this macro and run this on the whole folder not only on one single picture. Any other idea? Thanks Michelina 2007/7/11, Michael Schmid <[hidden email]>: > > Hi Michelina, > > you have to run Edit>Selection>Create Mask after setThreshold: > run("Create Mask"); > This creates the 8-bit binary image required. > The mask will be in a separate window, so don't forget to close > both, the mask and the original window. > > Michael > ________________________________________________________________ > > On 11 Jul 2007, at 16:35, Nascimbeni wrote: > > > Hello all, > > > > We do have a macro "Analyze Particles" (the copy is joined below). > > We would like to add to that macro a watershed function. > > We tried to add run("Watershed"); just after setThreshold(30, 80); but > > this did not work. A message telling "8-bit binary image (0 and 255) > > required" appears. > > Anybody has a solution??? > > > > Thanks a lot > > Best regards > > Michelina Nascimbeni > > > > > > > > requires("1.38o"); > > dir = getDirectory("Choose a Directory "); > > list = getFileList(dir); > > setBatchMode(true); > > for (i=0; i<list.length; i++) { > > showProgress(i, list.length); > > open(dir+list[i]); > > getStatistics(area, mean, min, max, std); > > threshold = mean + 2.5*std; > > setThreshold(30, 80); > > run("Analyze Particles...", "size=100-650 summarize"); > > close; > > } > > selectWindow("Summary"); > > saveAs("Text", getDirectory("home")+"Summary.txt"); > ... [show rest of quote]
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Michelina,
no problem, you have to put it into the loop of your macro. requires("1.38o"); dir = getDirectory("Choose a Directory "); list = getFileList(dir); setBatchMode(true); for (i=0; i<list.length; i++) { showProgress(i, list.length); open(dir+list[i]); getStatistics(area, mean, min, max, std); threshold = mean + 2.5*std; setThreshold(30, 80); //probably you want something like setThreshold(threshold, max); here? run("Create Mask"); rename(list[i]); //otherwise all lines in the summary will be labelled "mask" run("Watershed"); run("Analyze Particles...", "size=100-650 summarize"); close; close; } selectWindow("Summary"); saveAs("Text", getDirectory("home")+"Summary.txt"); Michael ________________________________________________________________ On 11 Jul 2007, at 17:50, Michelina Nascimbeni wrote: > Hi Michael, > > Thanks for your answer. Actually, our macro runs on a folder > containing a > set of images. We need to include the watershed function into this > macro and > run this on the whole folder not only on one single picture. > Any other idea? > Thanks > Michelina |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Thanks a lot Michael. This works fine!
Michelina 2007/7/12, Michael Schmid <[hidden email]>: > > Hi Michelina, > > no problem, you have to put it into the loop of your macro. > > requires("1.38o"); > dir = getDirectory("Choose a Directory "); > list = getFileList(dir); > setBatchMode(true); > for (i=0; i<list.length; i++) { > showProgress(i, list.length); > open(dir+list[i]); > getStatistics(area, mean, min, max, std); > threshold = mean + 2.5*std; > setThreshold(30, 80); > //probably you want something like setThreshold(threshold, max); here? > run("Create Mask"); > rename(list[i]); //otherwise all lines in the summary will > be labelled "mask" > run("Watershed"); > run("Analyze Particles...", "size=100-650 summarize"); > close; > close; > } > selectWindow("Summary"); > saveAs("Text", getDirectory("home")+"Summary.txt"); > > > Michael > ________________________________________________________________ > > On 11 Jul 2007, at 17:50, Michelina Nascimbeni wrote: > > > Hi Michael, > > > > Thanks for your answer. Actually, our macro runs on a folder > > containing a > > set of images. We need to include the watershed function into this > > macro and > > run this on the whole folder not only on one single picture. > > Any other idea? > > Thanks > > Michelina > ... [show rest of quote]
|
Free forum by Nabble | Disable Popup Ads | Edit this page |