MDI_IMAGE_RECONSTRUCT(3)



NAME

     MDI_image_reconstruct,  MDI_image_deconstruct-   reconstruct
     two-dimensional images from MDI list data (and vice-versa).


Syntax

     #include <MDI.h>
     #include <soi_sds.h>

     int MDI_image_reconstruct (SDS *data);
     int MDI_image_deconstruct (SDS *data);


DESCRIPTION

     When called with a dataset argument data  representing  one-
     dimensional  list  data  from  MDI (e.g. cropped, masked, or
     arbitrarily binned data, dumps of mask  tables,  etc.),  the
     function  MDI_image_reconstruct()  replaces the data section
     of the dataset with  the  corresponding  reconstructed  two-
     dimensional  image.   MDI_image_reconstruct()  uses  the DPC
     attribute (the Data Product Code) in the dataset  to  deter-
     mine  the  correct reconstruction; the DPC attribute must be
     correctly set before it is called.  If the DPC is that of  a
     bin  list  itself  (a dump of a mask table for example), the
     reconstructed image is filled with ones and zeroes.

     MDI_image_deconstruct()  converts  a  full   two-dimensional
     1024*1024  pixel image to the list format appropriate to the
     DPC attribute.  Exception: if the data format is binned  and
     cropped  without  using a rectangular-weighted bin list, the
     input image is expected to correspond in size to that of the
     originally binned data.

     MDI_image_reconstruct() reconstructs the data to  the  smal-
     lest image that can represent the original data with no loss
     of accuracy; ordinarily this is  a  1024*1024  pixel  image.
     The  only exception is for rectangular bin lists with a con-
     stant bin size; for these the bins become the pixels on  the
     reconstructed image.

     MDI_image_reconstruct()  can  be  used  internally  so  that
     modules do not require data to be stored externally in image
     format.  This can result in savings of from  30%  for  full-
     disk  crops  to  500,000%  for LOI-mask data in both storage
     space and file read time.


FILES

     /home/CM/tables/cropXXXX.fits
     /home/CM/tables/limbXXXX.fits
     /home/CM/tables/rwbinXXXX.fits
     /home/CM/tables/irbinXXXX.fits
     /home/CM/tables/vwbinXXXX.fits



SEE ALSO

     imgrecon (1)


DIAGNOSTICS

     The functions return 0 on  successful  completion.   If  the
     data format cannot be converted for any reason, the data are
     returned unchanged  (except  for  some  attribute  modifica-
     tions),  and  a  non-zero  value  is placed in soi_errno and
     returned as follows:

     NOT_LIST_DATA
     DPC_NOT_FOUND
     DPC_IS_ZERO
     UNSUPPORTED_DPC
     MDI_DPC_TABLE_ERROR
     SDS_RANK_ERROR
     DIMENSION_MISMATCH


BUGS

     Both functions rely on tabulated bin  lists  appropriate  to
     the  DPC,  so they are not transportable.  The standard crop
     list is, however, built into the code, so for this case  the
     code is transportable.

     MDI_image_reconstruct() does  not  work  for  data  products
     corresponding to certain vector-weighted bins (6001, 6002, &
     6004).   It  has  not  been  verified  for   data   products
     corresponding  to  rectangular-weighted  (boxcar)  bins with
     multiple bin sizes and shapes, nor with irregular bin  lists
     other than the standard LOI list.

     MDI_image_deconstruct() does not work for  any  rectangular-
     weighted  binned  data  products, nor with unusual irregular
     bin lists.

     The functions require separately prepared bin lists in which
     the IP memory page numbers have been stripped.  Ideally they
     should work with the directly dumped IP bin lists.

     Because MDI_image_deconstruct in general requires  1024*1024
     input  images, the two functions are not inverses; it is not
     generally possible to recover data in the original format by
     running  it  first  through  one and then through the other,
     unless the format involves no binning.


AUTHOR

     Rick Bogart


HISTORY

     1998-03-06     SOI Version 2.9