Deriving the physical parameters of observed phenomena in the solar atmosphere has fundamental importance, as these parameters are then employed to constrain and validate models. Here we report the development of a new computational algorithm based on a magneto-hydro-static model that computes the magnetic field in the solar atmosphere and automatically matches individual magnetic-field lines with observed structures that appear with enhanced emission in extreme-ultraviolet (EUV) images. Presently, for the quiet-Sun regions, we can only measure the vertical photospheric magnetic field $B_{z}$
B
z
, as accurate horizontal magnetic field measurements are not available. Thus, vertical photospheric magnetic-field measurements are extrapolated into the upper atmosphere, from the photosphere to the corona, with a magneto-hydro-static model. Free model parameters are then optimized with a downhill-simplex method by comparing quantitatively magnetic-field lines with the enhanced emission of loop structures composing the so-called coronal bright points recorded in EUV images taken with the Atmospheric Imaging Assembly on-board the Solar Dynamics Observatory. The algorithm will be applicable to any solar image data where individual structures with an enhanced emission can be resolved. Most importantly, the algorithm can be employed to obtain the magnetic properties of these structures above the photosphere.