3D line segment to 2D pixel height?

Let’s say I have a 3D line segment between two vertices. How do I work out the vertical extent of this line segment (i.e. its height in pixels or some other unit of measure) on my screen?

Can’t you just:
v1 = vertex1
v2 = vertex2

Multiply v1 and v2 by the modelview matrix then multiply by the projection matrix to get into screen space. Then do the “w” divide on both and then get the difference in “y” coordinates. (This will get you coordinates in normalized screen space with 0,0 in the center of the screen. To get to pixels, add 1 and divide by two (x+1)/2 then multiply by the viewport pixel size. You may also have to flip the y coordinate first (1-y) to get 0,0 at the top of the viewport (if necessary))