#31 closed enhancement (fixed)
psImageReadSection maybe better served as two functions
| Reported by: | Owned by: | eugene | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | minor | Keywords: | |
| Cc: |
Description
psImageReadSection was designed so that if the x,y parameters are exactly the
magical location of (-1,-1), it reads in the whole file instead of a subsection
(and ignoring parameters like nx,ny).
Using such "magical numbers" to significantly alter a function's behavior makes
things harder to use, as it is easy to forget these caveats for functions.
It may be better to have a psImageRead as well as a psImageReadSection, where
psImageRead reads whole images while psImageReadSection is just for reading
subsections of images.
Change History (2)
comment:1 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 by , 22 years ago
Thanks for the clarification. I would not have gotten that from the old SDRS
description.
-rdd

The SDRS wording is somewhat unclear. The 'magic numbers' refer to the value of
(nx,ny) not (x,y), and they should be independent as well. Since values less
than 1 are invalid, the idea is to use non-positive numbers to read all but the
last nx pixels. IE, if you have an image of dimensions Nx,Ny, setting the nx
argument to -5 means the true value of nx would be nx = Nx - x - 5. Or, to be
more complete: nx = (nx > 0) ? nx : Nx - x + nx; repeat for ny. Thus, if I
want to read in a full array, I would use the values for x,y,nx,ny of 0,0,0,0.
If i want to read all of the array except the last 32 columns, I would use
0,0,-32,0. Nothing is lost by having a second function to read the full array,
which would put in the default values, but we want this functionality as well.