Ticket #1334 (closed defect: fixed)

Opened 9 years ago

Last modified 8 years ago

Refine xy0 handling

Reported by: rowen Owned by: rhl
Priority: normal Milestone:
Component: afw Keywords:
Cc: becker, rhl, rowen, bick, fergal Blocked By:
Blocking: Project: LSST
Version Number: 3.5.2
How to repeat:

not applicable

Description

There are a few instances where xy0 is not handled gracefully, leading to pitfalls for the unwary. These include:

1) convolve does not set xy0 of the output image.

This is simply a bug or misfeature. I believe we can fix it without breaking existing code.

2) there is no way to create a blank image that matches another image's size and xy0, which makes functions such as warpImage easy to misuse (by forgetting to set xy0 of the output image).

RHL suggests modifying exposure/image's Factory function by replacing bool deep with

enum { SHALLOW, DEEP, CLEAR, UNINITIALIZED }

and I heartily endorse this suggestion, but it is an API change.

3) Andy Becker wants a way to handle the following

   for fp in footprints:
       bbox = fp.getBBox()
       xC   = 0.5 * ( bbox.getX0() + bbox.getX1() )
       yC   = 0.5 * ( bbox.getY0() + bbox.getY1() )
       bbox.shift(-maskedImageToConvolve.getX0(),
                  -maskedImageToConvolve.getY0())
       tmi  = afwImage.MaskedImageF(maskedImageToConvolve, bbox)

Change History

comment:1 Changed 9 years ago by DefaultCC Plugin

  • Cc rhl, rowen, bick, fergal added

comment:2 Changed 9 years ago by rowen

To say more about Andy Becker's case: the problem occurs when running detection on a subimage. The resulting footprints have pixel position (which is good), but there is no convenient way to obtain views of the subimage that correspond to the regions covered by the footprints.

This could be solved by adding an Image view/copy constructor that works in regions described by pixel position (instead of pixel index) -- i.e. afwGeom::BoxD -- and adding a means to get such a box from a footprint. (An alternative solution that is less general is to add an Image view/copy constructor that gets its region from a Footprint).

comment:3 Changed 8 years ago by rowen

The problem with convolve not setting xy0 was fixed in rev15957.

comment:4 Changed 8 years ago by jbosch

  • Status changed from new to closed
  • Resolution set to fixed

Superseded by fixes in #1556.

Note: See TracTickets for help on using tickets.