HenriquesLab / NanoJ-eSRRF

Apache License 2.0
19 stars 2 forks source link

Batch analysis #13

Open JlvtNicolas opened 5 months ago

JlvtNicolas commented 5 months ago

Hi

I was wondering if there is a way to process batch analysis (aka: opening several stacks of images, and run the plugin to analyse all the stack one-by-one without re-lunch the analysis)?

bet regards

NJ

HannahSHeil commented 5 months ago

Hi sure, the easiest way to batch process is creating a Macro to run through all files in a folder. This is an example:

// Get path to temp directory dir = "D:\!!!ADD PATH!!!"; print("\Clear"); savedir = "D:\!!!ADD Path!!!";

list = getFileList(dir); setBatchMode(true); for (i = 0; i < lengthOf(list); i++) { // for (i = 0; i < 1; i++) { if (endsWith(list[i], ".nd2")){ print("---------------------"); print(list[i]); print("---------------------"); run("Bio-Formats Windowless Importer", "open=["+dir+"\"+list[i]+"]"); run("eSRRF - Analysis", "magnification=5 radius=1.50 sensitivity=3 #=100 vibration avg wide-field #_0=25 axial=400");

    selectWindow(list[i]+" - eSRRF (AVG)");
    saveAs("Tiff", savedir+"//"+list[i]+" - eSRRF (AVG)"+".tif");
    //selectWindow(list[i]+" - eSRRF (STD)");
    //saveAs("Tiff", savedir+"//"+list[i]+" - eSRRF (STD)"+".tif");
    selectWindow(list[i]+" - interpolated image");
    saveAs("Tiff", savedir+"//"+list[i]+" - interpolated image"+".tif");
    run("Close All");
}

}

setBatchMode(false); print("-----------------"); print("All done.");

Let me know if you need more support. Best, Hannah