Renaming channels in stack


I have a 10 channel stack in ImageJ.

Currently when I import this stack into QuPath it simply labels each channel as 1 thru 10. Is there a way in ImageJ to reassign the specific channel names i.e. CD33 that will then be visible in Qupath?


So this macro is not exactly useful to you, but I will paste the whole thing so that you can see the important line in context.

dir1 = getDirectory("Choose Source Directory ");
dir2 = getDirectory("Choose Destination Directory ");

channelList = getFileList(dir1);
batchList = getFileList(dir1+channelList[0]);
//Open groups of files, one per channel for a set
for (j=0; j<batchList.length; j++){
	imageList = getFileList(dir1+channelList[0]+batchList[j]);
	for (k=0; k<imageList.length; k++){
		for (i=0; i<channelList.length; i++) {
			run("Properties...", "channels=1 slices=1 frames=1 unit=um pixel_width=0.5 pixel_height=0.5 voxel_depth=1");
		run("Images to Stack", "name=["+imageList[k]+"] title=[] use");
		run("Properties...", "channels=6 slices=1 frames=1 unit=µm pixel_width=0.5000000 pixel_height=0.5000000 voxel_depth=1.0000000");
		saveAs("TIFF", dir2+imageList[k]);
		while (nImages>0) { 

When I am combining my TIFFs into a stack, the line “rename(channelList[i]);” renames the open TIFF, which is then used in the final stack as the name for that image. You can also see the macro handles forcing channel number, as opposed to letting FIJI choose whether to create a Z stack.
The channel list itself, in this case, is pulled from the directory where the TIFFs are stored, so the renamed image will have whatever names were used in the folders. You could also create your own array of text to pull the channel name from.

1 Like

*Edit: Less of a problem in 0.2.0 where measurements are named after the channels.

Thinking about this a little further, this does rename the channels such that they show up in the color list and a couple of other areas… but nothing changes the measurements list where everything is referred to as “Cytoplasm: Channel 10 mean” and so on. Adjusting that behavior would cause a lot of problems calling measurement values in scripts.