Before I go on and write the macro to do that,
Does anybody know if I can quickly use an image and expand it to a stack, let's say of 121 times this same image ? Seems silly, but it would be usefull for me because I want to overlay a fluorescent time-lapse (so, a stack) with a unique transmission image taken at the first time point (so, a unique image), and get a movie (so, a stack) of the overlay. SO I want to use RGB merge or RGB+Gray merge, but First I have to get my transmission image to a stack the dimension of my time-lapse fluorescent sequence... Thank you ! |
Hi Christophe,
The following plugin should do exactly what you want. Until now it only works with 8 bit images. Cheers Arne import ij.*; import ij.gui.*; import ij.process.*; import ij.plugin.*; /** Creates a stack from a single picture. * Comments to [hidden email] */ public class CreateStack_ implements PlugIn { public void run(String arg) { ImagePlus imp = WindowManager.getCurrentImage(); if(imp==null) { IJ.noImage(); return ; } int numStacks = imp.getStackSize(); if(numStacks>1) { IJ.error("Must call this plugin on a single image."); return; } int bd=imp.getBitDepth(); if (bd !=8 || numStacks>1){ IJ.error("Sorry! This Plugin only works on 8-Bit Image"); return; } String sPrompt = "Number of frames "; int num = (int)IJ.getNumber(sPrompt,1); if(num==IJ.CANCELED) return; if(!imp.lock()) return; // exit if in use ImageProcessor ip = imp.getProcessor(); int w=ip.getWidth(); int h=ip.getHeight(); ImagePlus overlay = NewImage.createByteImage("CreateStack", w,h,num, NewImage.FILL_BLACK); ImageProcessor over_ip = overlay.getProcessor(); imp.getProcessor(); for (int i =1;i<=num;i++){ overlay.setSlice(i); over_ip.copyBits(ip,0,0,Blitter.COPY); } overlay.show(); imp.unlock(); } } ____________________________________________________ Arne Seitz, Scientific Officer Advanced Light Microscopy Facility EMBL Heidelberg +49 6221 387 8467 -----Ursprüngliche Nachricht----- Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von Christophe Leterrier Gesendet: Donnerstag, 28. September 2006 10:49 An: [hidden email] Betreff: Unique Image to Stack ? Before I go on and write the macro to do that, Does anybody know if I can quickly use an image and expand it to a stack, let's say of 121 times this same image ? Seems silly, but it would be usefull for me because I want to overlay a fluorescent time-lapse (so, a stack) with a unique transmission image taken at the first time point (so, a unique image), and get a movie (so, a stack) of the overlay. SO I want to use RGB merge or RGB+Gray merge, but First I have to get my transmission image to a stack the dimension of my time-lapse fluorescent sequence... Thank you ! |
In reply to this post by lechristophe
On Sep 28, 2006, at 4:48 AM, Christophe Leterrier wrote:
> Before I go on and write the macro to do that, > Does anybody know if I can quickly use an image and expand it to a > stack, let's say of 121 times this same image ? > Seems silly, but it would be usefull for me because I want to overlay > a fluorescent time-lapse (so, a stack) with a unique transmission > image taken at the first time point (so, a unique image), and get a > movie (so, a stack) of the overlay. > SO I want to use RGB merge or RGB+Gray merge, but First I have to get > my transmission image to a stack the dimension of my time-lapse > fluorescent sequence... Here is a macro that does this: n = getNumber("Stack Size:", 121); run("Copy"); for (i=0; i<n-1; i++) { run("Add Slice"); run("Paste"); } -wayne |
In reply to this post by lechristophe
In case we need three solutions, my Stack Sorter plugin has this capability.
Bob Robert P. Dougherty, Ph.D. President, OptiNav, Inc. Phone (425) 467-1118 Fax (425) 467-1119 www.optinav.com |
Free forum by Nabble | Edit this page |