After loading the DEM, you can use the Raster | Raster calculator menu option to modify values.
For example, here the raster 'Tsavo.dem' was loaded (it appears as band Tsavo@1), and the calculator will produce a new TIF called tsavoMinus30.tif using the calculation "Tsavo@1" - 30
In your case, richdem use osgeo.gdal to open the raster and the result is a numpy array with the elevations values.
shasta_dem = rd.LoadGDAL('mydem.tiff')
[[170.52 170.74 170.81 ... 195.55 195.72 195.93]
[169.09 169.09 168.69 ... 196.58 196.61 196.73]
[166.79 166.75 165.95 ... 197. 197.29 197.66]
Don't wish for your imaginary line, make it real. As in, digitize a line whereever you need it.
Then run lineintersections for your alignment-line and the contourlines, then join attributes by location so your newly produced pointlayer knows the elevation of the contourline it is on.
For your desired output then make your points invisible, and tell them ...
Let me share my home-brewed method for those like me who are not skilled enough for GRASS or Python scripts:
duplicate the contour layer, you will use one layer for the unlabeled intermediate contours (eg. 50m, 150m, 250m and so on) which you will call "intermediate contours", and the other, new layer for the most important lines that you would like to ...
If you have a elevation surface as a raster, and some point data you can use the Point Sampling Tool (install as a Plugin). The Point Sampling Plugin tool will create a new point dataset with a new column populated with the pixel value of the raster. Best to have the vector and raster data share a coordinate reference system to avoid errors in the tool. ...