// Calibrate_Chroma macro by Christophe Leterrier // 11/04/2022 // // Processes a folder full of multichannel tif, register each channel relative to one of them using the NanoJ-core plugin; // then generates an average translation mask from each calculated translation mask // // Correction of stacks is then made using the Correct_Apo_2 macro, applying the NanoJ-Core translation mask correction macro "Calibrate_Chroma" { // Default values for the Options Panel CROP_DEF = "Full"; // Center crop option FILT_DEF = true; // Fourier filtering REF_CH_DEF = 1; // means reference channel is first channel ie C=0 SIM_DEF = 0.5; // Minimal similarity (from tests: 0.5 for apo, 0.25 for STORM 256, 0.1 for STORM 512) GAUSS_DEF = 1; // gaussian blur before aligning // Initialize choices variables CROP_ARRAY = newArray("Full", "1024", "512", "256"); // Input folder INPUT_DIR=getDirectory("Select the input stacks directory"); ALL_NAMES=getFileList(INPUT_DIR); Array.sort(ALL_NAMES); print("\n\n\n*** Calibrate Chroma Log ***"); print(""); // Options Dialog.create("Calibrate Chroma Options"); Dialog.addChoice("Crop to center pixels:", CROP_ARRAY, CROP_DEF); Dialog.addCheckbox("Filter background", FILT_DEF); Dialog.addNumber("Reference channel:", REF_CH_DEF); Dialog.addNumber("Minimal similarity:", SIM_DEF, 2, 4, ""); Dialog.addNumber("Gaussian blur:", GAUSS_DEF, 1, 3, "px"); Dialog.show(); // Feeding variables from dialog choices CROP = Dialog.getChoice(); FILT = Dialog.getCheckbox(); REF_CHANNEL = Dialog.getNumber(); SIM = Dialog.getNumber(); GAUSS = Dialog.getNumber(); setBatchMode(true); print("Processing images in folder:" + INPUT_DIR); // Stack counter for average f = 0; // Array of trasnlation mask titles TM_TITLES = newArray(0); CONCAT_STRING = "open "; // Loop on tif images for (n=0; n 0) index = minOf(tifindex, zviindex); else index = tifindex; short = substring(Name, 0, index); // print(short); return short; }