[Tutor] how to read and transmit/send only section of the image (sub-image)

Kent Johnson kent37 at tds.net
Fri Sep 4 15:56:35 CEST 2009


On Thu, Sep 3, 2009 at 6:01 PM, Jojo Mwebaze <jojo.mwebaze at gmail.com> wrote:
> thanks guys,
> Currently i am using pyfits, a bit slow cause loads the file in memory,
> creates a subimage and then saves the file then transmits
> the file over the network! My idea is,  if there is a way of creating a file
> pointer to the location on disk, where the subimage lies, reading a specific
> size, and  sending only the data read (like wayne had suggested)
> Do you think this possible?

Not by just reading a single portion of the file; even for an
uncompressed bare raster image this would only work if the sub-image
is the same width as the original. For a FITS file you also need to
create a new header.

It is technically possible to construct a subimage in memory without
reading the original into memory but you would have to understand the
details of the FITS format.

You may be able to transmit the image without saving it first. Or
perhaps one of the other FITS libs is faster.

Kent


More information about the Tutor mailing list