Login  Register

Re: Bring up threshold menu

Posted by chenyanpei on Mar 18, 2011; 1:58pm
URL: http://imagej.273.s1.nabble.com/Bring-up-threshold-menu-tp3685355p3685361.html

Thank you very much. I already tried. but after I saved the images,they
change to  not the threshold image again. I want to use the Mtraker2, so i
need the threshold image . it need the stack to threshold image.
the rest parts of my macro is here:

makeRectangle(90, 16, 697, 493);//
run("Crop");
//run("Invert");
run("Subtract Background...", "rolling=50 light");
//run("Watershed");
//run("Invert");
setAutoThreshold("Default");
setThreshold(0, 128);
run("Convert to Mask");
run("Set Measurements...", "area mean centroid center");
//run("Analyze Particles...","clear record");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Nothing display record");
setForegroundColor(0,0,0);
setBackgroundColor(255,255,255);
j=0;
x=0;
y=0;
for(j=0;j<nResults;j++){
x=getResult('X',j);
y=getResult('Y',j);
doWand(x, y);
getStatistics(area);
if(area<200)
//run("Clear","slice");
run("Fill", "slice");
}
run("Clear Results");

run("8-bit");

run("Threshold...");
setThreshold(255, 255);
run("Convert to Mask");
saveAs("Jpeg", dir2+list[i]);
close();

2011/3/17 Jerome Mutterer <[hidden email]>

> >
> > How I can get a "threshold" image automaticly. I running...
>
>
> Chen,
> run("Threshold..."); is optionnal, it will just open the threshold tool
> window. You don't need that if you want an automated thresholding.
>
> setThreshold(255, 255); this will retain only pixels with value 255 in your
> threshold.
>
> If you want an automatically computed threshold, you could try:
>
> setAutoThreshold(method);
>
> 'method' should be one of the available methods described at :
>
> http://imagej.nih.gov/ij/docs/guide/userguide-25.html#toc-Subsubsection-25.2.4
> and http://pacific.mpi-cbg.de/wiki/index.php/Auto_Threshold
>
> saveAs("Jpeg", dir2+list[i]);
> it looks that you only pasted part of the faulty macro. This makes it
> difficult to guess why it doesn't behave as expected.
>
> Sincerely,
> Jerome.
>
>
>
> On Thu, Mar 17, 2011 at 5:04 PM, Yanpei Chen <[hidden email]> wrote:
>
> > How I can get a "threshold" image automaticly. I running
> > run("8-bit");
> > run("Threshold...");
> > setThreshold(255, 255);
> > run("Convert to Mask");
> > saveAs("Jpeg", dir2+list[i]);
> > close();
> > but I still get the image
> > Title: 00002.jpg
> > Width:  738 pixels
> > Height:  495 pixels
> > Pixel size: 1x1 pixel
> > ID: -2
> > Coordinate origin:  0,0
> > Bits per pixel: 8 (grayscale LUT)
> > Display range: 0-255
> > No Threshold
> > Uncalibrated
> > Path: K:\R1\00002.jpg
> > No Selection
> >
> >
> >
> > Thank you very much!
> >
> >
> > 2011/3/17 Himanish Ghosh <[hidden email]>
> >
> > > Hello
> > >
> > > Jerome,
> > >
> > >
> > > Thank you very much, it worked just right.
> > >
> > > I tried all sorts of combinations before i sent the email.
> > >
> > > cheers
> > >
> > >
> > >
> > > On Thu, Mar 17, 2011 at 3:09 PM, Jerome Mutterer <
> > > [hidden email]> wrote:
> > >
> > > > Himanish, you could use:
> > > >
> > > > run("Threshold...");
> > > > waitForUser("Adjsut Threshold and click OK to continue");
> > > >
> > > > Sincerely,
> > > > Jerome
> > > >
> > > > On Thu, Mar 17, 2011 at 2:29 PM, Himanish Ghosh <
> > [hidden email]
> > > > >wrote:
> > > >
> > > > > Hello All,
> > > > >
> > > > >  From my macro I would like to call the threshold image menu and
> show
> > > it
> > > > > and
> > > > > wait for the user to adjust parameters in the threshold dialog and
> > then
> > > > > resume the macro.
> > > > >
> > > > > How can this be done
> > > > >
> > > > > thank you
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Himanish Ghosh
> > >
> > > http://www.jaxtr.com/himanishghosh
> > > the journey has begun
> > >
> >
> >
> >
> > --
> > Chen Yanpei, phD
> > MssMat
> > Ecole Centrale Paris
> > Grande voie des vignes
> > 92295 Châtenay Malabry
> > Paris, France
> >
>



--
Chen Yanpei, phD
MssMat
Ecole Centrale Paris
Grande voie des vignes
92295 Châtenay Malabry
Paris, France