DeNardoLab / DeepTraCE

Deep-learning based pipeline for analysis of whole-brain light sheet microscopy images
GNU General Public License v3.0
9 stars 7 forks source link

Fix for ImageJ macro for scaling on newer ImageJ versions #1

Open BrainofZedZed opened 1 year ago

BrainofZedZed commented 1 year ago

Changing the way the string of the path is handled lets the macro run on newer ImageJ versions after 1.5.2 (tested on 1.5.4)

Line 5 should have brackets around the path which will looks like: run("Image Sequence...", "open=[" + path + "] sort use");

Making the updated thing:

// Takes unscaled data and scales it to a 10um space. Also converts to 8-bit.
paths = newArray("E:\\DeSousa_cleared_brains\\5B\\488\\15-29-24_5B_488_UltraII_C00_xyz-Table Z0000.ome.tif");
for (i=0; i<paths.length; i++) {
    path = paths[i];
    run("Image Sequence...", "open=[" + path + "] sort use");
    run("Scale...", "x=0.40625 y=0.40625 z=0.3 interpolation=Bilinear average process create");
    run("8-bit");
    parent = File.getParent(path);
    dir = File.getParent(parent) + File.separator + File.getName(parent) + "_scaled";
    File.makeDirectory(dir);
    name = "10um";
    saveAs("Tiff", dir+File.separator+name);
}