I have a quite simple programming question I was hoping somebody could help me with.
I'm working with Tiff files with several channels (all contained in a .lif file, which is Leica format). I want a way to easily convert all my Tiffs to Tiffs containing only a few of the channels (which I specify). Right now I'm doing it manually, for each image and it is tedious. I have no experience in writing macros and some help or a starting point would be much appreciated. I'm sure it's not a complicated macro to write.
As of now I'm using the following manual routine and commands after I have opened all my Tiffs:
- Image > Stacks > Stack to Images - separates the stacked imaged into individual images
- Close images I dont wan't to be in stack.
- Image > Stacks > Images to Stack - Returns the remaining images to a stack and renames it.
- Image > Hyperstacks > Stack to Hyperstack - here I change it so that the image has 3 channels.
- Save the new Tiff with the desired channels and name.
- Close the Tiff and repeat for all Tiffs.
What I want is a Macro that loops the above steps for all open Tiffs, letting the user specify the channels (eg. keep channels: 2,3 and 5). I know it's a very simple programming task, but I could really use some help getting it done.
Thanks! Johannes
There are several less complex possibilities to create a stack with only a subset of channels:
Image > Stacks > Tools > Make Substack..., which lets you specify the channels/slices, and gets recorded as:
Image > Duplicate..., where you can select a continuous range of channels, such as:
To apply this procedure to all images in a folder, have a look at the Process Folder template in the Script Editor (Templates > IJ1 Macro > Process Folder) and at the documentation on the Fiji wiki: