<Back to QuPath article list

 Colors - Channels

Adjusting the channel displays - mostly for fluroescence.

 In addition to recoloring objects, channels and displays are also malleable by way of code.

The simplest change is to adjust the name of the channels, which can be incredibly useful in fluorescent images.

 
setChannelNames("PDL1", "CD8","FoxP3","CD68","PD1","CK","DAPI","AF")

Simplifying the channel names before generating cells will use the updated channel names for the cell measurements.

Longer channel names

Longer channel names

Shorter channel names

Shorter channel names

Some other methods of controlling channels can be found here.

Changing the first two channels of the LuCA image to white and green would look like this.

 
setChannelColors( getColorRGB(255, 255, 255), getColorRGB(0, 255, 0) )
Displaying only channels 1 and 2 in the LuCa sample imageTop: with the default colors, and Bottom: after running the script

Displaying only channels 1 and 2 in the LuCa sample image

Top: with the default colors, and

Bottom: after running the script

.

 

The colors can be changed back to red and yellow by double clicking on the channel in the Brightness and Contrast menu and selecting the color you want - or you can figure out the RGB values to change the colors back by script. Alternatively, by swapping images and coming back without saving, the channels will return to normal. If you save the image with the channel colors changed, they will stay changed!

To alter the channel brightness, you can use the following, where the first value is the channel number (starting with 0 for the first channel), the second is the black limit, and the last is the max pixel intensity. All other pixel intensities will appear stretched between the last two values, although these changes will not alter your underlying data. 

 
setChannelDisplayRange(1,0, 20)

Alternatively, the channel name can be used.

 
setChannelDisplayRange("CD8",0, 20)

Putting this all together, we can set channel names, change the colors of the first two (they are always in order, so if you do not want to change one, add in the current color), and then adjust the display range on the second channel.

 
setChannelNames("PDL1", "CD8","FoxP3","CD68","PD1","CK","DAPI","AF") setChannelColors( getColorRGB(255, 255, 255), getColorRGB(0, 255, 0) ) setChannelDisplayRange("CD8",0, 5)