IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 6, 2006, 4:53:15 PM (20 years ago)
Author:
Paul Price
Message:

Reworking API for bias subtraction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/modules/ModulesSDRS.tex

    r5709 r5937  
    1 %%% $Id: ModulesSDRS.tex,v 1.68 2005-12-06 19:48:26 eugene Exp $
     1%%% $Id: ModulesSDRS.tex,v 1.69 2006-01-07 02:53:15 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    860860
    861861Given an input image and various other parameters,
    862 \code{pmSubtractBias} shall subtract the bias from the image.
    863 The API shall be the following:
    864 \begin{prototype}
    865 pmReadout *pmSubtractBias(pmReadout *in, void *fitSpec, pmFit fit, bool overscan,
    866                           const psStats *stat, int nBin,
     862\code{pmSubtractBias} shall subtract the bias from the image:
     863
     864\begin{prototype}
     865pmReadout *pmSubtractBias(pmReadout *in, pmOverscanOptions *overscanOpts,
     866                          psRegion imageRegion, psList *overscanRegions,
    867867                          const pmReadout *bias, const pmReadout *dark);
    868868\end{prototype}
     
    876876
    877877The input image, \code{in}, shall have the bias subtracted in-place.
    878 The input image may be of type U16, S32, or F32.
    879 
    880 Overscan subtraction is controlled by the \code{overscan} boolean.  If
    881 it is \code{true}, then overscan subtraction is performed.  The
    882 prescan and/or overscan regions to be used are specified in by
    883 \code{CELL.BIASSEC} (accessed via the parent of the \code{pmReadout};
    884 a linked list of \code{psRegion}s).  These shall be reduced to a
    885 single vector (in the dimension specified by \code{CELL.READDIR},
    886 which is accessed via the parent of the \code{pmReadout}).
    887 
    888 If the overscan is not defined for each row/column, then the function
    889 shall generate a warning and then interpolate using the provided
    890 functional form if \code{fit} is not \code{PM_FIT_NONE} (see below);
    891 otherwise, the function shall generate an error.
    892 
    893 The statistic to use in combining multiple pixels in the
    894 prescan/overscan regions is specified by \code{stat}.  \code{stat} is
    895 of type \code{psStats} instead of simply \code{psStatsOptions} so that
    896 clipping levels may be specified, if desired.  In the event that
    897 multiple options are specified by \code{stats}, a warning shall be
    898 generated, and the option with the highest priority shall be used,
    899 according to the following priority order: \code{PS_STAT_SAMPLE_MEAN},
    900 \code{PS_STAT_SAMPLE_MEDIAN}, \code{PS_STAT_CLIPPED_MEAN},
    901 \code{PS_STAT_ROBUST_MEAN}, \code{PS_STAT_ROBUST_MEDIAN},
    902 \code{PS_STAT_ROBUST_MODE}.
    903 
    904 If \code{nBin} is positive and less than the size of the vector, then
    905 the vector shall subsequently be binned into \code{nBin} bins, using
    906 the specified statistic (\code{stat}).  For example, the whole
    907 overscan region can be taken as a unity if \code{nBin=1}.  If
    908 \code{fit} is \code{PM_FIT_SPLINE}, then \code{nBin} also serves as
    909 the number of spline pieces.
    910 
    911 \code{fit} is an enumerated type which specifies the type of fit to
    912 employed on the overscan vector (and hence the type of \code{fitSpec}):
    913 \begin{datatype}
    914 typedef enum {
    915     PM_FIT_NONE,                        ///< No fit
    916     PM_FIT_POLYNOMIAL,                  ///< Fit polynomial
    917     PM_FIT_SPLINE                       ///< Fit cubic splines
    918 } pmFit;
    919 \end{datatype}
    920 
    921 If \code{fit} is \code{PM_FIT_POLYNOMIAL} or \code{PM_FIT_SPLINE},
    922 then \code{fitSpec} shall be interpreted to be a structure of the
    923 appropriate type (\code{psPolynomial1D} for \code{PM_FIT_POLYNOMIAL},
    924 and \code{psSpline1D} for \code{PM_FIT_SPLINE}), and the overscan
    925 vector shall be fit using the specified functional form.
    926 
    927 In cases where \code{fitSpec} is \code{NULL} and \code{fit} is not
    928 \code{PM_FIT_NONE} or \code{overscan} is \code{true}, the function
    929 shall generate an error.  If \code{overscan} is \code{false} and
    930 \code{fit} is not \code{PM_FIT_NONE}, then the function shall generate
    931 a warning, and no overscan subtraction shall be performed.  Upon
    932 return, the \code{fitSpec} shall contain the coefficients of the
    933 overscan fit.
    934 
    935 If \code{fitSpec} is \code{NULL}, or \code{fit} is \code{PM_FIT_NONE},
    936 then no fit shall be performed to the overscan.
     878The input image may be of type U16, S32, or F32.  The region of the
     879input image that shall have the overscan or full-frame subtractions
     880applied is specified by \code{imageRegion}.
     881
     882Overscan subtraction is performed if \code{overscanOpts} is
     883non-\code{NULL} (see \S\ref{sec:overscan}).  \code{overscanRegions}
     884shall be a list of \code{psRegion}s that specify the regions that
     885comprise the overscans.
    937886
    938887A \code{bias} frame shall be subtracted pixel-by-pixel from the input
     
    952901\code{dark} shall also be masked in the output.  The bias and dark
    953902images may be copied to the same type as the input image if required.
     903
     904
     905\subsubsection{Overscan subtraction}
     906\label{sec:overscan}
     907
     908The options for performing the overscan subtraction are bundled in a
     909\code{pmOverscanOptions}:
     910
     911\begin{datatype}
     912typedef struct {
     913    // Inputs
     914    bool single;                // Reduce all overscan regions to a single value?
     915    bool scanRows;              // Scan direction was rows? (otherwise columns)
     916    pmFit fitType;              // Type of fit to overscan
     917    unsigned int order;         // Order of polynomial, or number of spline pieces
     918    psStats *stat;              // Statistic to use when reducing the minor direction
     919    // Outputs
     920    psPolynomial1D *poly;       // Result of polynomial fit
     921    psSpline1D *spline;         // Result of spline fit
     922} pmOverscanOptions;
     923\end{datatype}
     924
     925The mode in which the overscan is subtracted is specified by the
     926\code{single} boolean.  If \code{single} is \code{true}, then the
     927entire overscan region is reduced to a single value using the
     928\code{stat}.  If \code{single} is \code{false}, the overscan shall be
     929reduced along the dimension specified by \code{scanRows} (rows if
     930\code{scanRows} is true; otherwise columns).
     931
     932If the overscan is not defined for each row/column,
     933\code{pmSubtractBias} shall generate an error if \code{fitType} is
     934\code{PM_FIT_NONE}; otherwise, the function shall shall generate a
     935warning and the undefined values shall be interpolated using the
     936provided functional form.
     937
     938The statistic to use in combining multiple pixels in the
     939prescan/overscan regions is specified by \code{stat}.  \code{stat} is
     940of type \code{psStats} instead of simply \code{psStatsOptions} so that
     941clipping levels may be specified, if desired.  In the event that
     942multiple options are specified by \code{stats}, a warning shall be
     943generated, and the option with the highest priority shall be used,
     944according to the following priority order: \code{PS_STAT_SAMPLE_MEAN},
     945\code{PS_STAT_SAMPLE_MEDIAN}, \code{PS_STAT_CLIPPED_MEAN},
     946\code{PS_STAT_ROBUST_MEAN}, \code{PS_STAT_ROBUST_MEDIAN},
     947\code{PS_STAT_ROBUST_MODE}.
     948
     949\code{fitType} is an enumerated type which specifies the type of fit
     950to employed on the overscan vector:
     951\begin{datatype}
     952typedef enum {
     953    PM_FIT_NONE,                        ///< No fit
     954    PM_FIT_POLY_ORD,                    ///< Fit ordinary polynomial
     955    PM_FIT_POLY_CHEBY,                  ///< Fit Chebyshev polynomial
     956    PM_FIT_SPLINE                       ///< Fit cubic splines
     957} pmFit;
     958\end{datatype}
     959
     960If \code{fitType} is \code{PM_FIT_NONE}, then the overscan vector is
     961subtracted from the image without fitting.  Otherwise, the overscan
     962vector is fit using the specified functional form, the fit is
     963subtracted from the image, and the \code{poly} or \code{spline} is
     964allocated and updated with the results of the fit.
     965
     966The allocator for a \code{pmOverscanOptions} shall be:
     967\begin{prototype}
     968pmOverscanOptions *pmOverscanOptionsAlloc(bool single, bool scanRows,
     969                                          pmFit fitType, unsigned int order,
     970                                          psStats *stat);
     971\end{prototype}
    954972
    955973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset for help on using the changeset viewer.