Let $V$ be a finite-dimensional complex inner product space. We can equip the lattice $\mathcal{C}$ of closed subspaces with an involutive operation, mapping a subspace $a$ to its orthogonal complement $a^\perp$. This makes it into an orthomodular lattice. Unlike the case of Boolean algebras, this complement is a structure, not a property (it depends on the inner product used, but the lattice structure only depends on the underlying vector space).
A state is a mapping $\phi : \mathcal{C} \rightarrow [0,1]$ such that $\phi(V) = 1$, and if $a,b \in \mathcal{C}$ are orthogonal ($a \subseteq b^\perp$, or vice versa), then $\phi(a \lor b) = \phi(a) + \phi(b)$.
We can also allow maps $\phi : \mathcal{C} \rightarrow \mathbb{R}_{\geq 0}$ if we like (then it is necessary to require $\phi(\{0\}) = 0$). Then the dimension is such a map. The dimension, scaled down so that $\phi(V) = 1$, is a state.
There is a satisfactory notion of integration as long as $\dim(V) \neq 2$. This is Gleason's theorem -- every state $\phi$ is the restriction of a positive unital map $\psi : L(V) \rightarrow \mathbb{C}$. To clarify, $L(V)$ is the space of linear operators $V \rightarrow V$, positive and unital means that $\psi$ maps positive semidefinite operators to nonnegative reals and the identity operator to $1$, and the elements of $\mathcal{C}$ can be identified with their corresponding self-adjoint projection operators.
If we take $\phi$ to be $\dim$, then $\psi$ is the trace.
The way things go wrong in 2 dimensions is that there are too many states on $\mathcal{C}(\mathbb{C}^2)$, additivity on orthogonal lines is not a strong enough condition to get a positive linear map $L(\mathbb{C}^2) \rightarrow \mathbb{C}$.
All of the above has a generalization to von Neumann algebras, where there is the interesting type $\mathrm{II}_1$ case, where $\dim$ takes on all the values in $[0,1]$.