public software.sextractor

[/] [branches/] [multi/] [src/] [subimage.c] - Diff between revs 283 and 285

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 283 Rev 285
Line 20... Line 20...
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*       GNU General Public License for more details.
*       GNU General Public License for more details.
*       You should have received a copy of the GNU General Public License
*       You should have received a copy of the GNU General Public License
*       along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*       along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
*
*       Last modified:          02/04/2012
*       Last modified:          06/05/2012
*
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include        "config.h"
#include        "config.h"
Line 54... Line 54...
        pointer to obj2 "object",
        pointer to obj2 "object",
OUTPUT  Pointer to a new malloc'ed subimage structure.
OUTPUT  Pointer to a new malloc'ed subimage structure.
NOTES   Global preferences are used. Input fields must have been through
NOTES   Global preferences are used. Input fields must have been through
        frame_wcs() with detection field as a reference.
        frame_wcs() with detection field as a reference.
AUTHOR  E. Bertin (IAP)
AUTHOR  E. Bertin (IAP)
VERSION 02/04/2012
VERSION 02/05/2012
 ***/
 ***/
subimagestruct  *subimage_getall(fieldstruct **fields, fieldstruct **wfields,
subimagestruct  *subimage_getall(fieldstruct **fields, fieldstruct **wfields,
                        int nfield, obj2struct *obj2)
                        int nfield, obj2struct *obj2)
 
 
  {
  {
Line 102... Line 102...
      continue;
      continue;
    subimage_init(++subimage, field, wfield, obj2, obj2->subimage);
    subimage_init(++subimage, field, wfield, obj2, obj2->subimage);
    }
    }
 
 
  subimage = obj2->subimage;
  subimage = obj2->subimage;
  for (s=nsubimage; s--; subimage++)
  for (s=0; s<nsubimage; s++, subimage++)
    {
    {
    QMALLOC(subimage->image, PIXTYPE, subimage->imsize[0]*subimage->imsize[1]);
    QMALLOC(subimage->image, PIXTYPE, subimage->imsize[0]*subimage->imsize[1]);
    copyimage(subimage->field, subimage->image,
    copyimage(subimage->field, subimage->image,
        subimage->imsize[0],subimage->imsize[1],
        subimage->imsize[0],subimage->imsize[1],
        subimage->ipos[0],subimage->ipos[1]);
        subimage->ipos[0],subimage->ipos[1]);
Line 118... Line 118...
        subimage->imsize[0],subimage->imsize[1],
        subimage->imsize[0],subimage->imsize[1],
        subimage->ipos[0],subimage->ipos[1]);
        subimage->ipos[0],subimage->ipos[1]);
      }
      }
    else
    else
      subimage->weight = NULL;
      subimage->weight = NULL;
 
    subimage->bkg = obj2->bkg[s];
    }
    }
 
 
  return obj2->subimage;
  return obj2->subimage;
  }
  }
 
 
Line 137... Line 138...
        pointer to obj2 "object",
        pointer to obj2 "object",
        pointer to reference sub-image (or NULL to make one).
        pointer to reference sub-image (or NULL to make one).
OUTPUT  -.
OUTPUT  -.
NOTES   -.
NOTES   -.
AUTHOR  E. Bertin (IAP)
AUTHOR  E. Bertin (IAP)
VERSION 02/04/2012
VERSION 06/05/2012
 ***/
 ***/
void    subimage_init(subimagestruct *subimage,
void    subimage_init(subimagestruct *subimage,
                        fieldstruct *field, fieldstruct *wfield,
                        fieldstruct *field, fieldstruct *wfield,
                        obj2struct *obj2, subimagestruct *dsubimage)
                        obj2struct *obj2, subimagestruct *dsubimage)
 
 
Line 187... Line 188...
    subimage->dpos[0] = obj2->mx + 1.0;
    subimage->dpos[0] = obj2->mx + 1.0;
    subimage->dpos[1] = obj2->my + 1.0;
    subimage->dpos[1] = obj2->my + 1.0;
    subimage->ipos[0] = (int)(subimage->dpos[0]-0.50001); /* Integer coords */
    subimage->ipos[0] = (int)(subimage->dpos[0]-0.50001); /* Integer coords */
    subimage->ipos[1] = (int)(subimage->dpos[1]-0.50001); /* Integer coords */
    subimage->ipos[1] = (int)(subimage->dpos[1]-0.50001); /* Integer coords */
    subimage->djacob[0] = subimage->djacob[2]
    subimage->djacob[0] = subimage->djacob[2]
                = subimage->dinvjacob[0] = subimage->dinvjacob[2] = 1.0;
                = subimage->dinvjacob[0] = subimage->dinvjacob[3] = 1.0;
    subimage->djacob[1] = subimage->djacob[3]
    subimage->djacob[1] = subimage->djacob[2]
                = subimage->dinvjacob[1] = subimage->dinvjacob[3] = 0.0;
                = subimage->dinvjacob[1] = subimage->dinvjacob[2] = 0.0;
    subimage->imsize[0] = 2.0*(obj2->xmax-obj2->xmin)+1+2*field->stripmargin;
    subimage->imsize[0] = 2.0*(obj2->xmax-obj2->xmin)+1+2*field->stripmargin;
    subimage->imsize[1] = 2.0*(obj2->ymax-obj2->ymin)+1+2*field->stripmargin;
    subimage->imsize[1] = 2.0*(obj2->ymax-obj2->ymin)+1+2*field->stripmargin;
    subimage->immin[0] = subimage->ipos[0] - subimage->imsize[0]/2;
    subimage->immin[0] = subimage->ipos[0] - subimage->imsize[0]/2;
    subimage->immin[1] = subimage->ipos[1] - subimage->imsize[1]/2;
    subimage->immin[1] = subimage->ipos[1] - subimage->imsize[1]/2;
    subimage->immax[0] = subimage->immin[0] + subimage->imsize[0];
    subimage->immax[0] = subimage->immin[0] + subimage->imsize[0];