Posted by
Krs5 on
May 26, 2020; 4:29pm
URL: http://imagej.273.s1.nabble.com/Please-help-creating-a-macro-for-Z-project-and-save-as-tif-tp5023384p5023401.html
Dear Patriciody ,
If I understand you correct you have one nd2 file containing all the z-slices? If so, the macro below might do what you want (not tested).
dir1 = getDirectory("Select folder with nd2 files");
list = getFileList(dir1);
dir2 = getDirectory("Select folder to save the results");
for (i=0; i<list.length; i++){
// setBatchMode(true); // if all works fine you can remove the "// " at the start of this line to speed up the process; no images will be opened on the screen.
path = dir1 + list[i];
run("Bio-Formats Importer", "open="+path"+ autoscale color_mode=Default rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT");
getDimensions(width, height, channels, slices, frames);
run("Make Substack...", "delete slices=1-"+slices+"-2");
run("Z Project...", "projection=[Max Intensity]");
saveAs("tif", dir2+"C1"+list[i]+".tif");
close();
selectWindow(list[i]);
run("Z Project...", "projection=[Max Intensity]");
saveAs("tif", dir2+"C2"+list[i]+".tif");
run("Close All");
}
Best wishes
Kees
________________________________
Hi everyone,
I would like to know if someone could help me create a macro that will save
me a lot of time. I take photos of my fluorescent samples using 2 channels
and many z stacks, which gets saved as a .nd2 file. I would like to have a
macro that joins all Z stacks using Z project max intensity, then split the
2 channels into 2 individual pictures and save them as .tif
Would this be possible? I really appreciate if you could help me, and thanks
a lot in advance.
--
Sent from:
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.1557.x6.nabble.com%2F&data=02%7C01%7Ckrs5%40leicester.ac.uk%7Caded84ec771c425f3d1108d800171cbd%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637259446557004995&sdata=nAqdZEaXTPZ5ga6w8HZcoZPpfJ3v9d27E1qrxU7sDCo%3D&reserved=0--
ImageJ mailing list:
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7Caded84ec771c425f3d1108d800171cbd%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637259446557004995&sdata=qdwUWzJBmroKIt8m8DP2L5d67SERUcqMBENEWSoSGgs%3D&reserved=0--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html