Hello,
is there a way to add all the stacks in a folder ? In other words is it possible to use imageCalculator in batch mode ? Thank you , Fabrice. |
Hi Fabrice,
I am not sure what you want to do. Do you want to concatenate all of your stacks (which are in a folder) one after the other, and make one large stack? If so, then I have a macro to do this. Let me know if you want to use it? Ved |
Hello,
and thank you for your answer. Actually if there are 10 stacks with 3 images(01,02,03) , I want to add all together so that all 01 are added, all 02 are added and all 03 are added and so I get a new stack with 3 images. Concatenate thus not help as this produces a new stack but one stack after another. Ther several ways to sum stacks but it is always one to another, and I would like to automate this, maybe in batch mode... 2010/9/8 Ved Sharma <[hidden email]> > Hi Fabrice, > > I am not sure what you want to do. Do you want to concatenate all of your > stacks (which are in a folder) one after the other, and make one large > stack? If so, then I have a macro to do this. Let me know if you want to use > it? > > Ved > > > |
On Sep 8, 2010, at 2:33 AM, fabrice senger wrote:
> Hello, > > and thank you for your answer. > > Actually if there are 10 stacks with 3 images(01,02,03) , I want to add all > together so that all 01 are added, all 02 are added and all 03 are added and > so I get a new stack with 3 images. > > Concatenate thus not help as this produces a new stack but one stack after > another. > > Ther several ways to sum stacks but it is always one to another, and I would > like to automate this, maybe in batch mode... Here is an easy way to do this: 1. Use File>Import>Raw to Open the 10 stacks as a single 30 image stack. 2. Use Image>Hyperstacks>Stack to Hyperstack to convert the stack to a 10 slice, 3 frame hyperstack (Order="xyctz", c=1, z=10, t=3, display mode="Grayscale"). 3. Use Image>Stack>Z Project (Projection type = "Sum Slices"). Use the command recorder (Plugins>Macros>Record) to generate a macro. It will look something like this: run("Image Sequence...", "open=/Users/wayne/stack/stack01.tif sort"); run("Stack to Hyperstack...", "order=xyctz channels=1 slices=4 frames=3 display=Grayscale"); run("Z Project...", "projection=[Sum Slices] all"); -wayne |
Hi there, this is what I was looking for...
In any case I attach the code I was working on. Thank you, Fabrice. dir = getDirectory("Choose a Directory "); list = getFileList(dir); run(dir+list[0]); id1 = getImageID; run(dir+list[1]); id2 = getImageID; imageCalculator("Add create stack", id1,id2); rename("test"); waitForUser("checkpoint"); for (i=0; i<list.length-2; i++) { showProgress(i, list.length); run(dir+list[i+2]); id3=getImageID; imageCalculator("Add create stack", "test",id3); rename("test"); } 2010/9/8 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]> > On Sep 8, 2010, at 2:33 AM, fabrice senger wrote: > > > Hello, > > > > and thank you for your answer. > > > > Actually if there are 10 stacks with 3 images(01,02,03) , I want to add > all > > together so that all 01 are added, all 02 are added and all 03 are added > and > > so I get a new stack with 3 images. > > > > Concatenate thus not help as this produces a new stack but one stack > after > > another. > > > > Ther several ways to sum stacks but it is always one to another, and I > would > > like to automate this, maybe in batch mode... > > Here is an easy way to do this: > > 1. Use File>Import>Raw to Open the 10 stacks as a single 30 image stack. > 2. Use Image>Hyperstacks>Stack to Hyperstack to convert the stack to > a 10 slice, 3 frame hyperstack (Order="xyctz", c=1, z=10, t=3, display > mode="Grayscale"). > 3. Use Image>Stack>Z Project (Projection type = "Sum Slices"). > > Use the command recorder (Plugins>Macros>Record) to generate a macro. It > will look something like this: > > run("Image Sequence...", "open=/Users/wayne/stack/stack01.tif sort"); > run("Stack to Hyperstack...", "order=xyctz channels=1 slices=4 frames=3 > display=Grayscale"); > run("Z Project...", "projection=[Sum Slices] all"); > > -wayne > |
In reply to this post by fabrice senger-2
Hi Fabrice,
I think it will also work your way. See the code below: --------------------- dir = getDirectory("Choose a Directory "); list = getFileList(dir); open(dir+list[0]); rename("combined"); for (i=1; i<list.length; i++) { showProgress(i, list.length); open(dir+list[i]); current = getTitle(); imageCalculator("Add stack", "combined",current); selectWindow(current); close(); } ---------------------- Ved |
nice !
2010/9/8 Ved Sharma <[hidden email]> > Hi Fabrice, > > I think it will also work your way. See the code below: > > --------------------- > dir = getDirectory("Choose a Directory "); > list = getFileList(dir); > open(dir+list[0]); > rename("combined"); > > for (i=1; i<list.length; i++) { > showProgress(i, list.length); > open(dir+list[i]); > current = getTitle(); > imageCalculator("Add stack", "combined",current); > selectWindow(current); > close(); > } > ---------------------- > > Ved > |
Free forum by Nabble | Edit this page |