IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 22 years ago

Closed 22 years ago

Last modified 16 years ago

#201 closed defect (fixed)

Subtract Bias Module

Reported by: gusciora@… Owned by: eugene
Priority: high Milestone:
Component: IPP SDRS Version: unspecified
Severity: normal Keywords:
Cc:

Description (last modified by eugene)

What data types should the bias subtraction module be implemented for?

There are many requirements dependent on the values of the various
parameters to this functions. In several cases, these requirements are
contradictory. For example, what are we to do if the bias image is
non-Null, yet the overscans is non-NULL and overscanaxis is ROW or COL? If
we filled out a full binary truth table for all the options in the function
prototype and the requirements specified in the SDR, there will be many
contradictory actions.

The SDR states that multiple overscans may be specified. If so, how are we
to use them? Also, can I assume that they all have the same size?

What is a "prescan" region? How is it to be used?

What is the point of fitting a spline to this vector? A spline will
interpolate between the supplied data points, but does not change the
supplied data points. If I have an image with 512 rows, a bias vector with
512 elements, fit a spline to that vector, then subtract that vector, the
values subtracted will be no different then if the spline had not been fit.

"fitSpec" is to be interpreted as type psPolynomial1D or psSPline1D. Can I
assume you mean a pointer to one of those types?

The SDR states that a warning shall be generated if the overscanAxis is
PM_OVERSCAN_NONE or PM_OVERSCAN_ALL and the "fit" is PM_FIT_NONE. What then?
Return NULL, or return the original image, or maybe subtract the bias
readout?

This may be obvious to you. SDR states that if the overscan is not defined
for each row/column, then interpolate using the functional form specified in
"fit". Can I assume that this means:

1: Compute a overscan vector.
2: Create a new overscan vector with a size equal to the row/column of

the image..

3: For each element of the new overscan vector, use the specified type

of interpolation "fit" to determine what that value is in the
original overscan vector?

Also, can I assume this is to be performed before any binning?

The Modules SDR states that the bias image need not be the same size as the
input image. The function should use the offsets (in->x0 and in->y0) to
determine the correct pixel in the bias image.

Q1: There are no in->x0 and in->y0 members in the psImage data structure.

Do you mean the row0 and col0 members?

Q2: If so, how are the offsets to be used?

Does image[i][j] correspond to bias[i + in->x0][j + in->y0]?
Does image[i + in->x0][j + in->y0] correspond to bias[i][j]?

Robert had another suggestion:

image[i][j] corresponds to
bias[i+in->row0-bias->row0][j+in->col0-bias->col0]

Q3: "in" is of type psReadout, and has members row0 and col0. "in" also

has a member of type psImage which has members row0 and col0. Can
I assume that those row0/col0 members will be equal? If not, which
ones should I use?

Change History (7)

comment:1 by Paul Price, 22 years ago

Status: newassigned

The bias subtraction module shall be defined for at least S8, U16, F32 types.

I thought I covered all the bases with the NULLs and non-NULLs, but I may well
have missed one. If "bias" is non-NULL and "overscans" is non-NULL, then the
specified axis in "overscanaxis" is used to compress the overscan regions in the
specified dimension, the overscan is subtracted and the bias is subtracted.
That is, the "overscan" and the "bias" are not mutually exclusive.

Several overscans may be defined, for example on a 2k CCD, I might choose
overscan regions [1:20,1:1024] and [2069:2168,1:2048]. That is, for half the
chip, I have a "prescan", and the whole chip also has an overscan. Maybe I
don't trust the prescan on the upper part of the chip.
Then, the module should step through each row, and compress all the defined
overscan pixels for that row using the specified statistic. So, for rows on the
lower half of the chip, it performs the statistic on 1->20 and 2069->2168, and
for the upper half, it only does 2069->2168.

A "prescan" is an overscan that is before the real pixels, instead of after them.

If we have a vector with 512 points, we may want to fit a spline with only 10
spline pieces. That makes a difference.

Yes, "fitSpec" is a pointer to one of the two types psPolynomial1D or psSpline1D.

If the "overscanAxis" is PM_OVERSCAN_NONE or PM_OVERSCAN_ALL and the "fit" is
*not* PM_FIT_NONE, then it is clear that the user didn't want to do a fit, but
he specified a fit type --- it's contradictory, hence the warning. In this
case, the fit should be ignored, and the normal overscan should be performed.

If there are gaps in the overscan vector due to no overscan being defined for a
particular row (or column, as appropriate), e.g., specifying overscan regions
[2069:2168,1:512] and [1:20,1025:2048], then the missing rows are filled in by
fitting the rest. In the example, perhaps I don't trust either the prescan or
the overscan for rows 512->1024, and so I'll just interpolate it from what's
around it. The binning is specified to be done before the fit.

A1: psReadout should have x0,y0 members that specify the offset.

A2: Robert's is the correct one: you have to account for both the offset of the
bias frame and of the input frame.

A3: The offsets in psImage refer to the offset of a subimage from the parent
image, while the offsets in the psReadout refer to the offset of a readout from
the physical CCD. Which should you use? Both. If my psReadout contains as its
psImage member a *subimage*, then it would be important to know both the
physical offset and the subimage offset.

comment:2 by Paul Price, 22 years ago

See also bug #193 for information about the offsets.

comment:3 by gusciora@…, 22 years ago

Regarding the spline question: my current implementation of
psVectorFitSpline1D() requires that the numbe of splines equals the number of
data points (plus one). I implemented it that way because that was the only
algorithm for splines in Numerical Recipes. Do you have a spline fitting
algorithm which will work for the case you mentioned in which there are many
more data points than splines?

comment:4 by Paul Price, 22 years ago

Resolution: fixed
Status: assignedclosed

Ah, I hadn't appreciated that. I just updated the Modules SDRS so that nBin is
also interpreted as the number of spline pieces if spline fitting is specified:

If \code{nBin} is positive and less than the size of the vector, then
the vector shall subsequently be binned into bins that are a relative
size of \code{nBin} compared to the original pixels, again using the
specified statistic (\code{stat}). If \code{fit} is
\code{PM_FIT_SPLINE}, then \code{nBin} also serves as the number of
spline pieces.

[...]

If \code{fitSpec} is \code{NULL}, or \code{fit} is \code{PM_FIT_NONE},
then no fit shall be performed to the overscan. Otherwise,
\code{fitSpec} shall be interpreted to be a structure of the
appropriate type (\code{psPolynomial1D} for \code{PM_FIT_POLYNOMIAL},
and \code{psSpline1D} for \code{PM_FIT_SPLINE}), and the overscan
shall (after reduction of the vector and binning) be fit using the
specified functional form. Upon return, the \code{fitSpec} shall
contain the coefficients of the overscan fit. If \code{fit} is
\code{PM_FIT_SPLINE}, then the \code{fitSpec} may be \code{NULL},
in which case a new \code{psSpline} is allocated; in any case, the
number of spline pieces shall be set to \code{nBin}.

comment:5 by Paul Price, 22 years ago

Keywords: VERIFIED added

Closing subsequent to release of SDRS-08, ADD-07.

comment:6 by Paul Price, 22 years ago

Keywords: VERIFIED removed

comment:7 by eugene, 16 years ago

Component: Modules SDRSIPP SDRS
Description: modified (diff)
Note: See TracTickets for help on using tickets.