During the course of creating mass models (1, 2), we developed a decomposition routine that can account for 3 galaxy components; an infinitesimally thin, axisymmetric disk, a Sersic profile bulge, and a bar with elliptical isophotes. As in Barnes & Sellwood (2003, AJ, 125, 1164), the disk is described by two geometry parameters (the ellipticity of the "isophotes" and position angle of the major axis of the projected disk) as well as a set of "isophotal" intensities. The Sersic bulge has 3 parameters; a central intensity, a scale-length, and an index which controls the shape of the bulge profile. The bar is described by parameters that mirror those of the disk. However, by definition, the ellipticity and position angle of the bar must be different than those for the disk. The values of these various parameters are found by minimizing the value of chi-squared, using simple photon counting noise as the estimate of measurement uncertainty.
The code follows the following path, given an image of a galaxy. First, the image is fitted using the disk component alone. The chi-squared value is saved along with the model parameters. Then, a fit with a bulge component is performed, and it's values are saved. Third, a disk+bar model is fitted and it's values are retained. Finally, a full 3 component fit is done and again, it's values are saved. With these model fits, we can use statistical testing (specifically the F-test) to determine which of the models is the best description of the data. That model is then adopted as the decomposition.
For all of the models, we further calculate the relative amounts of light in each component. In the case of a barred galaxy, we can estimate the semi-major axis length of the bar by finding where the bar intensity goes to zero. Either this bar length or the bar-to-total light fraction can be used to place galaxies in a classification scheme (as in Abraham & Merrifield 2000, AJ, 120, 2835).