/* ver100 20160316 michael.cammer@med.nyu.edu for ImageJ 1.50i This macro works on any stack but was designed for hyperstacks with T, Z, C. It is for extracting individual Z positions from one channel at each timepoint manually because of unpredictable shifts in Z. It could be modified to extract multiple channels. Also, if there were shifts in XY, after running the macro, before cropping, user may want to execute one of the automatic registration routines. Step 1. Open a hyperstack. Step 2. Run "Setup new extraction" Step 3. For each frame to be added to the new stack/movie, select it (make shure on correct channel) and press "q". If you added an incorrect frame, simply delete it using Image > Stacks > Delete Slice. Step 4. When done, run macro "Delete the last slice when done" Step 5. Save. Optional Step 6. Image > Stacks > Label... to put times on movie. */ var newStackID = 0; //============================================== macro "Setup new extraction" { b = bitDepth(); width = getWidth(); height = getHeight(); newImage("newStack", "" + b +" -bit ramp", width, height, 1); newStackID = getImageID(); setPasteMode("Copy"); } //============================================== // At the end, manually delete the last slice macro "Pop Current Frame Onto Stack [q]" { //run("Duplicate...", "title=temp"); run("Select All"); run("Copy"); selectImage(newStackID); run("Add Slice"); setSlice(nSlices()-1); run("Paste"); } //============================================== macro "Delete the last slice when done" { setSlice(nSlices()); run("Delete Slice"); }