/** * Batch convert images in the .nd format to ImageJ hyperstacks * * The user selects an .nd file. An image can consist of multiple * positions, frames, z-slices and channels. * Each position is converted into an ImageJ hyperstack and writen into * a subfolder of the folder containing the input image. * * (c) 2018, INSERM * written by Volker Baecker at Montpellier RIO Imaging (www.mri.cnrs.fr) * */ var helpURL = "https://github.com/MontpellierRessourcesImagerie/imagej_macros_and_scripts/wiki/MRI_ND_To_Hyperstack"; var _OUT_DIR = "stacks"; var _SATURATED = 0.25; macro "convert nd images [f8]" { convertNDImages(); } macro "convert nd images (f8) Action Tool - C037T1d13nT9d13dC555"{ convertNDImages(); } macro "convert nd images (f8) Action Tool Options" { Dialog.create("Convert ND-Images Options"); Dialog.addNumber("saturated", _SATURATED); Dialog.addString("output folder", _OUT_DIR); Dialog.addMessage("Press the help button below to open the online help!"); Dialog.addHelp(helpURL); Dialog.show(); _SATURATED = Dialog.getNumber(); _OUT_DIR = Dialog.getString(); } function convertNDImages() { path = File.openDialog("Please select a .nd file"); parentPath =File.getParent(path); stageNames = getStageNamesFromNDFile(path); outPath = parentPath + "/" + _OUT_DIR; if (!File.exists(outPath)) File.makeDirectory(outPath); setBatchMode(true); print("\\Clear"); print("Converting nd-images to hyperstack..."); for(i=0; i