Dear all,
With some kindly help, I could open many sub-folder as many stacks now, but I could not go further, I want analysis all the stacks and save the result. Please see the code: ----------------------------------------------------------------- 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 + "]")* ---------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------- Between the double dotline, is what I want to deal with my stacks, however, I could only analysis the last stacks, and could not save the analysis .txt data. would you please help me ? I have a lot of stacks, more than hunders, I need macro to save me. Thank you in advance. Best regards. Duerna -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Well Duerna,
you must put the processing steps in the loop, i.e. *after* run("Image Sequence...", "open=" + path + " sort"); and I would strongly recommend to close each stack after its processing. Because I have no experience with run("wrMTrck ", ... I can't help you with the processing itself. Good luck Herbie :::::::::::::::::::::::::::::::::::: Am 11.11.17 um 14:42 schrieb duerna: > Dear all, > > With some kindly help, I could open many sub-folder as many stacks now, > but I could not go further, I want analysis all the stacks and save the > result. > > Please see the code: > > ----------------------------------------------------------------- > 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 + "]")* > ---------------------------------------------------------------------------------------------------------------- > ---------------------------------------------------------------------------------------------------------------- > > Between the double dotline, is what I want to deal with my stacks, > however, I could only analysis the last stacks, and could not save the > analysis .txt data. > > would you please help me ? > I have a lot of stacks, more than hunders, I need macro to save me. > > Thank you in advance. > > 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 |
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); 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("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 |
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 |
This post was updated on .
Dear Herbie,
Received your reply with thanks. I will read the links you sent to me then try modify my code again, or again and again. Thank you for your time and help, all ways best regards. Duerna -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |