Splitting a tif series between multiple folders.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Splitting a tif series between multiple folders.

Colin Rickman-3
Hi

I have a 16,000 frame dataset that I would like to export as a tif
series (ie 16,000). However, I need to split the dataset in batches of
100 frames contained in a single folder (ie 160 folders each containing
100 individual tif files). Does anybody know of a macro/plugin that can
do this?

Hope you can help

Regards

Colin

--
Dr Colin Rickman
School of Engineering and Physical Sciences
Heriot-Watt University
Edinburgh
EH14 4AS

Tel: +44 131 6511512
Fax: +44 131 6503128
Reply | Threaded
Open this post in threaded view
|

AW: Splitting a tif series between multiple folders.

Ingo Bartholomaeus
Hi Colin,

this macro worked at least on my sample dataset...


Path=File.openDialog("Choose one file of dataset to process");
tarDir=getDirectory("Select output directory");
Portion=getNumber("Split Interval", 100);

run("Image Sequence...", "open=[Path] starting=1 increment=1 scale=100 file=[] or=[] sort use");
i=nSlices();

for  (n=1; n<=(i/Portion)+1; n++) {
Folder=tarDir+n;
if ((n-1)*Portion!=i) {
File.makeDirectory(Folder);
run("Duplicate...", "title=[x] duplicate range="+(n-1)*Portion+1+"-"+Portion*n);
j=nSlices();
if (j!=1) run("Image Sequence... ", "format=TIFF name=[Slice] start=0 digits=3 use  save=["+Folder+"\\"+"Slice000.tif]");
if (j==1) saveAs("Tiff", Folder+"\\"+"LastSlice.tif]");
close();
}
}
close();


- Ingo
________________________________________
Von: ImageJ Interest Group [[hidden email]] im Auftrag von Colin Rickman [[hidden email]]
Gesendet: Montag, 23. November 2009 20:12
An: [hidden email]
Betreff: Splitting a tif series between multiple folders.

Hi

I have a 16,000 frame dataset that I would like to export as a tif
series (ie 16,000). However, I need to split the dataset in batches of
100 frames contained in a single folder (ie 160 folders each containing
100 individual tif files). Does anybody know of a macro/plugin that can
do this?

Hope you can help

Regards

Colin

--
Dr Colin Rickman
School of Engineering and Physical Sciences
Heriot-Watt University
Edinburgh
EH14 4AS

Tel: +44 131 6511512
Fax: +44 131 6503128