How to change channels and stack slice in a confocal image through macro? – Image Analysis


I’m attempting to open a multichannel confocal czi stack navigate to a specific slice and then take a picture of the 3rd and 2nd channel. My macro is below. It doesn’t work properly.

First is a minor issue, it opens up the gui and makes me select hyperstack before it proceeds

Second is it doesn’t appear to navigate to the right slice. It opens up at slice 7 rather than 20.

Third it doesn’t appear to take images in the proper channels. The code below will just take both tif images of channel two. If I delete Stack.setChannel(2) it will take them in the wrong order with L1R being channel 2 and L1G being channel 3 when I mean for them to be in the opposite order.

What can I do to fix this?

open("/home/samp/Documents/organ/quant/file.czi");
Stack.setChannel(3)
setSlice(20);

run("Duplicate...", "title=[file_L1R.czi]");
saveAs("Tiff", "/home/samp/Documents/organ/file_L1R.tif");
close;

Stack.setChannel(2)
selectImage("file.czi");
run("Duplicate...", "title=[file_L1G.czi]");
saveAs("Tiff", "/home/samp/Documents/organ/file_L1G.tif");
close;



Source link

Leave a Comment