Login  Register

Re: macro with many stacks

Posted by Herbie on Nov 11, 2017; 2:22pm
URL: http://imagej.273.s1.nabble.com/macro-with-many-stacks-tp5019684p5019687.html

Duerna,

you should try to make it work like in the first example.

If you want to save the stacks for whatever reason, simply save them in
TIF-format, i.e. as if they would be images.

And please use "close()", not run("Close"), and don't forget the
semicolons at the end of each code line.

Please consult the page

<https://imagej.nih.gov/ij/developer/macro/functions.html>

that lists all macro functions with comments and try to learn how to
code macros according to:

<https://imagej.nih.gov/ij/developer/macro/macros.html>

HTH

Herbie

::::::::::::::::::::::::::::::::::::
Am 11.11.17 um 15:13 schrieb duerna:

> Hi Herbie,
> thank you again.
>
> I am a self-learning code beginner,
> just for my data analysis.
> Please forgive me if I made funny mistakes.
>
> As you said,
> "put the processing steps in the loop",
> I think now I understand why only the last stack was analysis before, thank
> you.
>
> If you please help me to see the follwing modified code, that will greatly
> help me again.
>
>
>   input = getDirectory("choose the input directory");
>> output = getDirectory("choose the output directory");
>>
>> listdir = getFileList( input );
>> for (i = 0; i < listdir.length; i++) {
>>           path = input + listdir[i];
>>           if ( File.isDirectory(  path  )  ) {
>>                   run("Image Sequence...", "open=" + path + " sort");
>> run("Enhance Contrast", "saturated=0.35");
>> run("Apply LUT", "stack");
>> setAutoThreshold("Otsu dark");
>> setThreshold(60, 255);
> *> run("wrMTrck ", "minsize=50 maxsize=10000 maxvelocity=300
> maxareachange=100
>> mintracklength=0 bendthreshold=0 binsize=0 saveresultsfile showpathlengths
>> showlabels showpositions showpaths showsummary roundcoord smoothing
>> plotbendtrack rawdata=1 benddetect=0 fps=0 backsub=0 threshmode=Otsu
>> fontsize=50 * save=[" + output + file + "]")*
> run("Close")
>>           }
>> }
>
>
>
> or
>
>
>   input = getDirectory("choose the input directory");
>> output = getDirectory("choose the output directory");
>>
>> listdir = getFileList( input );
>> for (i = 0; i < listdir.length; i++) {
>>           path = input + listdir[i];
>>           if ( File.isDirectory(  path  )  ) {
>>                   run("Image Sequence...", "open=" + path + " sort");
>> run("Enhance Contrast", "saturated=0.35");
>> run("Apply LUT", "stack");
>> setAutoThreshold("Otsu dark");
>> setThreshold(60, 255);
> *>  run("AVI... ", "compression=None frame=1.96 save=[" + output + file +
> "]")*
> run("Close")
> run("Close")
>>           }
>> }
>
>
>
> I write this two codes, in case the upper one can not save the data,
> if the upper one do not work, then I need save each stacks into AVI.
>
> Looking forward to hearing from you.
>
> Best Regards.
> Duerna
>  
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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