Go up one levelGo to Previous Go to Next

Image Servers in C++

The AstroCatalog class is also used to retrieve images from an image server 1 . The open method is used in the same way as for other catalogs:

 
AstroCatalog* cat = AstroCatalog::open(serverName); 
if (!cat)  
    error(...);

The return value from AstroCatalog::open is a pointer to an AstroCatalog object created for the given image server. To retrieve an image from the image server, you typically need to specify a position (or object name) and a width and height for the image (This is the default, however it depends on the config entry for the image server.):

 
WorldCoords pos(3, 19, 48, 41, 30, 39); 
AstroQuery q; 
q.pos(pos); 
q.width(2.0); 
q.height(3.5); 
if (cat->getImage(q) == 0) { 
    displayImage(cat->tmpfile()); 
}

Here the position is given as 3:19:48 +41:30:39, and the returned image should be 2.0 x 3.5 arcmins in size (centered at the position). The return value is the status (0 is OK, 1 for errors). The name of the temporary file containing the requested FITS image can be accessed by calling the method AstroCatalog::tmpfile() . The file should be copied if necessary, since it will be rewritten in the next call to getImage .


1. The AstroImage class, which was previously used for image servers, is now obsolete. Please use the AstroCatalog class for this now.


Go up one levelGo to Previous Go to Next

Please send questions or comments to abrighto@eso.org@eso.org.
Copyright © 1998 ESO - European Southern Observatory