  We present a new method to infer the 3D dimensional luminosity distributions
of edge-on barred galaxies with boxy-peanut/X (BP/X) shaped structures from
their 2D surface brightness distributions. Our method relies on forward
modeling of newly introduced parametric 3D density distributions for the BP/X
bar, disc and other components using an existing image fitting software package
(IMFIT). We validate our method using an N-body simulation of a barred disc
galaxy with a moderately strong BP/X shape. For fixed orientation angles the
derived 3D BP/X shaped density distribution is shown to yield a gravitational
potential that is accurate to at least 5% and forces that are accurate to at
least 15%, with average errors being ~1.5% for both. When additional quantities
of interest, such as the orientation of the bar to the line-of-sight, its
pattern speed, and the stellar mass-to-light ratio are unknown they can be
recovered to high accuracy by providing the parametric density distribution to
the Schwarzschild modelling code FORSTAND. We also explore the ability of our
models to recover the mass of the central supermassive black hole. This method
is the first to be able to accurately recover both the orientation of the bar
to the line-of-sight and its pattern speed even when the disc is perfectly
edge-on.
