Density is defined as mass per unit volume, or mass divided by volume.
The volume of the fluid contained in the flow tubes remains constant, so the only way the mass of the fluid can change is if the density also changes. Because of this relationship between mass and density, the mass of the full flow tubes indicates the density of the fluid contained.

Demonstration:
Increase density
Decrease density