Hello There - I am really not firm with coding and such, so I recorded a macro in ImageJ that let's me analyse the area fraction. It looks as follows:
open(); close(); close(); setAutoThreshold("Otsu"); //run("Threshold..."); setAutoThreshold("Otsu dark"); run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Nothing display summarize"); close(); run("Clear Results"); You're maybe wondering, why there are 2 close-functions - the .ZVI image is obtained from a microscope (Zeiss) and has 3 channels. It closes the first 2 channels ans runs the analysis on the last one, cloeses the image. It's fine, opening one image after another but there are hundrets of pictures to be analysed. I read through some stuff with GetFileList and such but it won't work because it will prompt, that the file-type is not supported or anything. Any sugestions or help with that? Let's assume the path is "c:\myimagepath" so that even I can follow ;) Thanks in advance!! |
Hello kagebunshin,
I've got some experience with .zvi files and written a simple macro. You can find some useful info on: http://wiki.imagej.net/Scripting_toolbox#Opening.2C_processing You'll need to use Bioformats to open the files. My little macro will prompt you for a directory containing your files. With the Zeiss-software you can sometimes change the order for the channels, so you have to specify that at the beginning (in my case Red, Green and Blue). In this case I select the 'Blue' channel (ie. the third channel) to do something with (like analysing particles). //macro will open all images in same folder, adapted from: // http://wiki.imagej.net/Scripting_toolbox#Opening.2C_processing. //2C_and_saving_a_sequence_of_files_in_a_folder //print("\\Clear"); //if you want to erase the log window 1st //Set the channels Red=1; //Channel 1 is Red, etc. Green=2; Blue=3; //Selecting your files: imageExtension = ".zvi"; myImagePath = getDirectory("Input directory"); //Dialog asking for folder imageList = getFileList(myImagePath); //Processing each file in your directory in turn: for (i=0; i<imageList.length; i++) { if (endsWith(imageList[i], imageExtension)) { fileInfo = myImagePath + imageList[i]; print("Opening \"" + myImagePath + imageList[i] + "\""); run("Bio-Formats Importer", "open=[" + fileInfo + "] color_mode=Composite view=Hyperstack stack_order=XYCZT"); //Select channels to work with, corresponding to what was stated at the beginning of the macro. Stack.setChannel(Blue); //Do your things here: print("Doing nothing yet ...");print(""); //close the image close(); } } print("Finished"); On 07/09/15 14:12, kagebunshin wrote: > Hello There - I am really not firm with coding and such, so I recorded a > macro in ImageJ that let's me analyse the area fraction. It looks as > follows: > > open(); > close(); > close(); > setAutoThreshold("Otsu"); > //run("Threshold..."); > setAutoThreshold("Otsu dark"); > run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 > show=Nothing display summarize"); > close(); > run("Clear Results"); > > You're maybe wondering, why there are 2 close-functions - the .ZVI image is > obtained from a microscope (Zeiss) and has 3 channels. It closes the first 2 > channels ans runs the analysis on the last one, cloeses the image. It's > fine, opening one image after another but there are hundrets of pictures to > be analysed. I read through some stuff with GetFileList and such but it > won't work because it will prompt, that the file-type is not supported or > anything. Any sugestions or help with that? > Let's assume the path is "c:\myimagepath" so that even I can follow ;) > Thanks in advance!! > > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Macro-Problem-with-ZVI-Files-tp5014253.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
With this Macro it will show an error in line 18, ")" expected, I just re-recorded the opening of a file with Bioformats and changed the hardcoded image-file into + fileInfo + - the Macro now works perfectly. Thanks a lot!
|
Free forum by Nabble | Edit this page |