TreeColour is a tool for adding color information to tree files based on various attributes or image data. It can color branches, trunks, or entire trees using attribute values or external images.
treecolour <tree_file> <attribute>
Color by branch-level attributes in greyscale:
treecolour forest.txt diameter
treecolour <tree_file> trunk <attribute>
Color by trunk-level attributes:
treecolour forest.txt trunk diameter
treecolour <tree_file> tree <attribute>
Color by tree-level attributes:
treecolour forest.txt tree height
treecolour <tree_file> <r>,<g>,<b>
Set RGB values or use attribute names:
treecolour forest.txt 1,length,diameter
treecolour <tree_file> trunk <r>,<g>,<b>
treecolour forest.txt trunk 1,length,diameter
treecolour <tree_file> tree <r>,<g>,<b>
treecolour forest.txt tree 1,height,width
Apply colors from an image to tree locations:
treecolour <tree_file> <image_file> <x_min>,<y_min>,<pixel_width>
treecolour forest.txt LAI_image.hdr 10.3,-12.4,0.2
x_min,y_min: Minimum coordinates of the image in world spacepixel_width: Size of each pixel in meters
--multiplier <value>or-m <value>: Apply uniform color scale multiplier--scale <r>,<g>,<b>or-s <r>,<g>,<b>: Apply per-channel color scales
--gradient_rgbor-g: Use red→green→blue gradient instead of greyscale
Colors attributes using grayscale values based on attribute ranges.
Uses a red→green→blue color spectrum when --gradient_rgb is specified.
Projects image colors onto tree locations based on spatial coordinates.
Color branches by diameter in greyscale:
treecolour trees.txt diameter
Color trunks by diameter with RGB gradient:
treecolour forest.txt trunk diameter --gradient_rgb
Color trees by height:
treecolour forest.txt tree height
Use multiple attributes for RGB channels:
treecolour forest.txt 1,length,diameter
Color trunks with custom RGB mapping:
treecolour forest.txt trunk 0.5,height,diameter
Apply LAI (Leaf Area Index) image colors:
treecolour forest.txt lai_map.hdr 100.5,200.3,0.1
Apply RGB image with scaling:
treecolour trees.txt aerial.png 0,0,0.5 --scale 2,1,1.5
Apply uniform scaling to all colors:
treecolour forest.txt diameter --multiplier 2.0 --gradient_rgb
Apply different scaling per color channel:
treecolour forest.txt 1,length,diameter --scale 1,0.8,1.2
The tool can use any attribute present in the tree file:
diameter- Branch diameterlength- Segment lengthradius- Branch radiusheight- Tree height (tree-level attribute)volume- Branch or tree volume- Custom attributes from tree reconstruction
- HDR files (
.hdr) - High dynamic range images - Standard formats (PNG, JPG, etc.) - Via STB image library
The tool modifies the tree file in-place, adding or updating:
redattributegreenattributeblueattribute
If color attributes already exist, they are replaced with new values. If not, new color attributes are added to all segments.
- Color-code trees by biological properties
- Highlight specific tree characteristics
- Create visually informative tree renderings
- Visual quality assessment of tree attributes
- Identify patterns in forest structure
- Compare attribute distributions
- Apply remote sensing data to tree models
- Integrate LiDAR intensity with tree structure
- Combine multiple data sources
- Colors are applied consistently across tree hierarchies
- Image-based coloring uses bilinear interpolation
- For more detailed information on coloring algorithms, refer to the
TreeColoursource code attreetools/treetools/treecolour/treecolour.cpp.