Login  Register

Re: Batch splitting of stacks and saving

Posted by Michael Schmid on Mar 14, 2012; 3:19pm
URL: http://imagej.273.s1.nabble.com/Batch-splitting-of-stacks-and-saving-tp4578247p4578568.html

Hi Ash,

it is not 100% clear what you want, but maybe a macro like the following?
You could run it with Process>Batch>Macro

It assumes your input images are tiffs, each of them a stack that contains two images, the first with the DAPI and the second with the 488.

title=getTitle();
if (endsWith(title, ".tif"))
 title = substring(title, 0, lengthOf(title)-4); //remove '.tif' at the end
dir=getDirectory("image"); //assumes you want to save into the original directory
setSlice(1);
titleD=title+"_DAPI.tif"
run("Duplicate...", "title=["titleD+"]");
saveAs("Tiff", dir+titleD);
close();
setSlice(2);
title488=title+"_488.tif"
run("Duplicate...", "title=["title488+"]");
saveAs("Tiff", dir+title488);
close();
close(); //closes the original

(I have note really tried the macro - I have no such images. So there may be bugs in it, and I leave it to you to debug it)


Michael
________________________________________________________________
On Mar 14, 2012, at 14:43, Ash Dunne wrote:

> Hi all,
>
> I'm struggling a bit with what I presume must be a fairly simple task.
>
> I have a load of images that have been acquired as stacks with the first
> slice being DAPI, and the second being 488.
>
> I want to find a way to split these into separate images and save them with
> file names that obviously relate to each other and to the original image. I
> can do this manually, but have hundreds of images that need this doing to
> them. There must be a way to batch it with a macro or plugin, but I'm not a
> programmer!
>
> Any help greatly appreciated.
>
> Kind regards,
>
> Ash
>
> --
> View this message in context: http://imagej.1557.n6.nabble.com/Batch-splitting-of-stacks-and-saving-tp4578247p4578247.html
> Sent from the ImageJ mailing list archive at Nabble.com.