IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#604 closed defect (fixed)

psRegionForImage incompletely implemented

Reported by: eugene Owned by: David.Robbins@…
Priority: high Milestone:
Component: mathtypes Version: 0.8.0
Severity: normal Keywords:
Cc:

Description

the SDRS was not very clear about how to handle sub-images. The implementation
of psRegionForImage was inconsistent between subimage pixels and parent image
pixels. It also returned an error in too many conditions which should have
resulted in a valid psRegion.

I've reimplemented this function in the eam_rel8_b2 branch


set actual region based on image parameters:
- compensate for negative upper limits
- force range to be on this image
- saturate on upper and lower limits of image
- flip x0,x1 if x0>x1
- flip y0,y1 if y0>y1
psRegion in refers to coordinates in the
psRegion psRegionForImage(psImage *image,

psRegion in)

{

if (image == NULL) {

return in;

}

convert non-positive upper-limits
in.x1 = (in.x1 <= 0) ? (image->numCols + in.x1) : in.x1;
in.y1 = (in.y1 <= 0) ? (image->numRows + in.y1) : in.y1;

force the upper-limits to be on the image
in.x1 = PS_MIN(image->numCols, in.x1);
in.y1 = PS_MIN(image->numRows, in.y1);

force the lower-limits to be on the image
in.x0 = PS_MAX(0, in.x0);
in.y0 = PS_MAX(0, in.y0);
in.x0 = PS_MIN(image->numCols, in.x0);
in.y0 = PS_MIN(image->numRows, in.y0);

flip start and end if out of order
if (in.x0 > in.x1) {

PS_SWAP (in.x0, in.x1);

}
if (in.y0 > in.y1) {

PS_SWAP (in.y0, in.y1);

}

return (in);

}
---

Change History (2)

comment:1 by robert.desonia@…, 21 years ago

Owner: changed from robert.desonia@… to David.Robbins@…

comment:2 by David.Robbins@…, 21 years ago

Resolution: fixed
Status: newclosed

branch joined with cvs trunk

Note: See TracTickets for help on using tickets.