Improved Ellipse Fitting and Isophotal Photometry in Crowded Fields
The basic ellipse fitting algorithm is described in Jarrett et al. 2000. The following figures demonstrate an improved method by which to derive the 3sig ellip parameters of a galaxy, thus improving the photometry.
Neighboring stars both confuse the desired isophote (3sig in this case) and systematically bump up the flux of a galaxy. The nominal galworks solution to this delemma is to mask all of the stars detected in the pipe, derive the ellipse parameters from the choppedup image and recover the lost flux using isophotal substitution (i.e., assume symmetry and use the ellip params to build a ellipsoid model of the galaxy).
The modifications are mostly subtle, but with one significant difference. Instead of masking the stars outright, the new method subtracts the stars. Before this subtraction can occur, however, the underlying galaxy itself must be subtracted. Hence, the method is to employ an iterative loop that searches for the ellipsoid model of the galaxy with star subtraction.
Method
Step 1. First guess at ellipse parameters of galaxy: axis ratio and position angle. Since nearby stars mess up the 3sigma isophote, the most reliable first guess is arrived at by using the inner 8" radius of the galaxy. Here we compute the axis ratio and position angle by using computing the optimal 2nd moment ratio (similar to what is already being used to derive the PSF elongation). The solution will be biased towards a more circular axis ratio due to the round PSF, but the axis ratio will be close to the correct answer. Keep in mind this is only a crude first guess.
Step 2. Using first guess axis ratio and position angle, subtract the galaxy from the image (use centroid position of galaxy). We do the subtraction by computing the lower quartile flux in the elliptical annulus and subtracting this value from the image (i.e., build an ellipsoid using the lower quartile in each annulus of width 1 pixel). The lower quartile is most robust against stars.
Step 3. Subtract stars from image (with galaxy in tact). Here we use the galaxysubtracted image to properly subtract the stars from the nominal image. The "subtraction" is carried as follows: compute the median local "sky" value using an annulus about the star to be subtracted. Then compute the difference between the untouchted image and the local median value. It is this difference that represents the flux of the star. Subtract the difference from the untouched image. The subtraction is performed on a circular area containing the star. The size of the area depends on the brightness of tthe star, where we employ the generalized exponential function, which nicely models the PSF. Here we need to know the "shape" or (alpha * beta) and beta. The "shape" comes from SEEMAN (and GALWORKS), computed for every coadd (hence, tracking the PSF seeing). The parameter beta also comes from GALWORKS, but for only the scan average.
 f(dr) = f0 * exp {dr/alpha)**(1/beta)]
The subtraction is not fully completed however. We use isophotal substitution (i.e., using the symmetric shape of the object;see step 4 below) as an additional component that is averaged with the resultant residual described above.
Step 4. We now derive the ellipse parameters for the 3sigma isophote of the starsubtracted image. We use the same method employed in GALWORKS.
Step 5. Redo steps 2 through 4, using the latest greatest ellipse model solution.
With the ellipse parameters optimally derived, we then can perform isophotal substitution to eliminate the stars from the photometry. Note: we could use the starsubtracted image; however, there will always be residual flux from the star since subtraction is not perfect, particularly for the central pixels of the star. Isophotal substitution is probably the most robust method for eliminating stars  but note, this only works if our galaxy is symmetric (usually the case).
Case 1:

11th mag galaxy at (ra,dec) = (241.9399, 59.92483), or
(glon,glat) = 325.3076 5.8810. The density is hefty, at 4.16
(log # sources per deg^2 brighter than 14th mag at K).

Galaxy at (glon,glat) = 325.3076 5.8810,
Kband image, 101X101 arcsec field
Step 1: Subtract Galaxy (symmetric ellipsoid model)
 New Method Galaxy Subtracted
Step 2: derive ellipse parameters (using 2nd moment):
 axis ratio = 0.778, p.a. = 160.0
Locate stars, Mask or Subtract, accordingly,
Nominal Masked; New Method Subtracted
Step 3: Derive ellipse parameters using traditional GALWORKS Method
 Nominal: axis ratio = 0.520, p.a. = 160.0:
RAW ISOPHOTE, and
Solution
New method: axis ratio = 0.360, p.a. = 165.0: RAW ISOPHOTE, and Solution
Step 4: Eliminate stars from original image using isophotal substitution
 Nominal: Stars Removed
New method: Stars Removed
Case 2:

K=10.8 mag galaxy at (ra,dec) = (241.82357, 60.68036), or
(glon,glat) = 324.7513 6.3989. The density is 4.1
(log # sources per deg^2 brighter than 14th mag at K).

Galaxy at (glon,glat) = 324.7513 6.3989,
Kband image, 101X101 arcsec field
Step 1: Subtract Galaxy (symmetric ellipsoid model)
 New Method Galaxy Subtracted
Step 2: derive ellipse parameters (using 2nd moment):
 axis ratio = 0.7650, p.a. = 94.0
Locate stars, Mask or Subtract, accordingly,
Nominal Masked; New Method Subtracted
Step 3: Derive ellipse parameters using traditional GALWORKS Method
 Nominal: axis ratio = 0.340, p.a. = 105.0:
RAW ISOPHOTE, and
Solution
New method: axis ratio = 0.360, p.a. = 108.0: RAW ISOPHOTE, and Solution
Step 4: Eliminate stars from original image using isophotal substitution
 Nominal: Stars Removed
New method: Stars Removed
Case 3: Faceon Latetype Spiral (worst case scenerio??)

K=10.3 mag galaxy at (ra,dec) = (284.901672 19.427221), or
(glon,glat) = 51.2129 6.9933. The density is 3.85
(log # sources per deg^2 brighter than 14th mag at K).

Galaxy at (glon,glat) = 51.2129 +6.9933,
Kband image, 101X101 arcsec field
Step 1: Subtract Galaxy (symmetric ellipsoid model)
 New Method Galaxy Subtracted
Step 2: derive ellipse parameters (using 2nd moment):
 axis ratio = 0.9843, p.a. = 6.0
Locate stars, Mask or Subtract, accordingly,
Nominal Masked; New Method Subtracted
Step 3: Derive ellipse parameters using traditional GALWORKS Method
 Nominal: axis ratio = 0.480, p.a. = 10.0:
RAW ISOPHOTE, and
Solution
New method: axis ratio = 0.540, p.a. = 10.0: RAW ISOPHOTE, and Solution
Step 4: Eliminate stars from original image using isophotal substitution
 Nominal: Stars Removed
New method: Stars Removed
[Last Updated: 2002 Jul 15; by Tom Jarrett]