/* 3D ANIMATOR * ¯¯¯¯¯¯¯¯¯¯¯ * 3D Animator is an ImageJ macro that creates a 3D animation and a maximum * intensity projection image from a microscopy fluorescence Z-Stack. The * program runs in batch mode, asking for a folder, and doing all stacks in * that folder. It creates 2 sub-folders named 3D and MIP with the results. * The animation goes through the Z-Stack, then progressively creates an MIP, * then rotates the full projection 45° left and right before unfolding back * into the first Z-Stack image. * * AUTHOR : Alexandre Bastien, Copyright (c) 2018 * EMAIL : alexandre.bastien@fsaa.ulaval.ca * LICENSE : Licensed under MIT License, see file LICENSE */ // Runs in Batch Mode setBatchMode(false); // User select folder and subfolder are created dir = getDirectory("Choose input directory"); list = getFileList(dir); File.makeDirectory(dir+"MIP"); File.makeDirectory(dir+"3D"); // Main loop for batch processing for (ii=0; iins){run("Re-order Hyperstack ...", "channels=[Channels (c)] slices=[Frames (t)] frames=[Slices (z)]")}; run("3D Project...", "projection=[Brightest Point] axis=Y-Axis slice=1 initial=0 "+ "total=45 rotation=1 lower=1 upper=255 opacity=0 surface=100 interior=50 interpolate"); wait(300); rename("3D-1"); makeRectangle(0, 0, w, h); run("Crop"); // Crop is needed as animation is a bit larger // Create right 3D animation selectWindow("St"); run("3D Project...", "projection=[Brightest Point] axis=Y-Axis slice=1 initial=315 "+ "total=44 rotation=1 lower=1 upper=255 opacity=0 surface=100 interior=50 interpolate"); wait(300); rename("3D-2"); makeRectangle(0, 0, w, h); run("Crop"); // Convertion from slice to time frame of the main stack (St) // is needed for later concatenate selectWindow("St"); run("Re-order Hyperstack ...", "channels=[Channels (c)] slices=[Frames (t)] frames=[Slices (z)]"); // For all 4 opened images: // Enhance contraste in a standardize way // Convert to RGB type // Interleave (doubles frames) to slow down (St and StP only) // Create the reverse images for rewind effect imwin = getList("image.titles"); for (i=0; i