Read parameters: If mode=3 (command line) Read params RA/Dec/Inimage/shape if shape=ellipse, read semimajor/semiminor/rotang if shape=circle, read radius else if mode=2 (ASCII file) Read params Inimage/Inregion Open ASCII file Inregion Read rest of parameters from Inregion Open Outregion ASCII file else if mode=3 (FITS file) Read params Inimage/Inregion Open FITS file Inregion Read rest of parameters from Inregion Open Outregion FITS file (clone of Inregion) endif do i=1,numberOfRegions if (mode=1) call ecoordconv to convert X/Y to Ra/Dec call esky2det read esky2det output temp file, returning detx/dety calculate new: Detx/Dety/Radius/Rotang as necessary write SHAPE/DETX/DETY/RADIUS/ROTANG/MAJOR/MINOR as necessary [write to screen for all, ASCII if mode=2, FITS if mode=1] end do if mode=2, close ASCII file if mode=1, close FITS file End