// Generate_3D_image_stacks.ijm (C) 2016, Tom Boissonnet // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see http://www.gnu.org/licenses/ showMessageWithCancel("Generate slices for Blender project ?","This macro will generate slices in X,Y,Z orientation, taking around 20GB of space. If you wish to generate only one of them, open the macro to find the desired function.") run("Concatenate...", " title=concatenated image1=Dataset1.tif image2=Dataset2.tif"); selectWindow("concatenated"); originalStack= getTitle(); mainFolder = getDirectory("Select the directory where the file Segmented.blend is located."); ZFolder = mainFolder + "Z_Stack" + File.separator; YFolder = mainFolder + "Y_Stack" + File.separator; XFolder = mainFolder + "X_Stack" + File.separator; getVoxelSize(xSize, ySize, zSize, unit); xSize = 10; ySize = 10; zSize = 25; run("Properties...", "channels=1 frames=1 unit=nm pixel_width="+xSize+" pixel_height="+ySize+" voxel_depth="+zSize+""); if ((File.isDirectory(ZFolder)) || File.isDirectory(YFolder) || File.isDirectory(XFolder)) { exit("Folder of Z, Y or X stack already found, macro aborted."); } File.makeDirectory(ZFolder); File.makeDirectory(YFolder); File.makeDirectory(XFolder); selectWindow(originalStack); run("Reslice [/]...", "output="+zSize+" start=Top"); // Vue du haut (Z); rename("Y_"); run("Image Sequence... ", "format=TIFF save=["+YFolder+"Y_0000.tif]"); run("Close"); selectWindow(originalStack); run("Reslice [/]...", "output="+zSize+" start=Left rotate"); // Vue de cote (X); rename("X_"); run("Image Sequence... ", "format=TIFF save=["+XFolder+"X_0000.tif]"); run("Close"); selectWindow(originalStack); rename("Z_"); run("Image Sequence... ", "format=TIFF save=["+ZFolder+"Z_0000.tif]"); run("Close"); call("java.lang.System.gc");