Please avoid use of this routine. It uses global variables (in the deepsearch common block) and hence yeilds code which is hard to maintain and difficult to reuse. Use freadimage2 instead.
Load image with freadimage2
Copy the returned imsum_struct into common block variable ims[a]
Copy the filename into common block variable imfilenames[a]
Copy the header into common block variable him[*,a]
If an absolute path is specified...
Else...
If /noimage not specified, call readfits to read the image into im and the header into head.
If /noimage was specified, read the header from the NetCDF file into /head if possible.
Set ims from the SQL record in the database.
If the image is not in the database, set from header:
Notes: it gets a lock on the NetCDF file, but it generally does not use the NetCDF file at all. All the ims information comes from the SQL database.