def circTOcutout(wcs,ra,dec,rad):
    """Convert an RA/DEC/RADIUS to an imcopy cutout"""
    (x1,y1)=wcs.rd2xy((ra+rad/2.0,dec-rad/2.0))
    (x2,y2)=wcs.rd2xy((ra-rad/2.0,dec+rad/2.0))
    xl=min(x1,x2)
    xr=max(x1,x2)
    yl=min(y1,y2)
    yu=max(y1,y2)
    
    ### constrain the cutout to be inside the image
    x1=max(xl,1)
    x1=int(min(x1,wcs.naxis1))
    
    x2=max(xr,x1,1)
    x2=int(min(x2,wcs.naxis1))
    
    y1=max(yl,1)
    y1=int(min(y1,wcs.naxis2))
    y2=max(yu,y1,1)
    y2=int(min(y2,wcs.naxis2))

    area=(x2-x1)*(y2-y1)
    cutout="[%d:%d,%d:%d]" % ( x1,x2,y1,y2)

    if not y1<y2 or not x1<x2: cutout=None
    return (cutout, area)