Details
-
Type:
Bug
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: afw
-
Labels:
-
Story Points:3
-
Epic Link:
-
Sprint:AP S18-6
-
Team:Alert Production
Description
warpExposure and warpImage are supposed to throw an exception if destImage = srcImage. However, the unit test for this is mis-written, due to checking for Exception being raised, instead of a more specific exception, hiding other problems. The test case in question is testWarpIntoSelf.
Worse, on my Mac, when I correct the test I find that it is possible to warp one image or exposure into itself, even though this results in altering the supposedly const input image and produces an incorrect destination image. Thus the C++ code that attempts to check for dest == src is not working.
That does look nicer, so it's worth switching to end pointers that are one past the last element. Here is my final code:
template <typename T1, typename T2>
bool imagesOverlap(ImageBase<T1> const& image1, ImageBase<T2> const& image2) {
auto arr1 = image1.getArray();
auto beg1Addr = reinterpret_cast<void const *>(arr1.front().begin());
auto end1Addr = reinterpret_cast<void const *>(arr1.back().end());
auto arr2 = image2.getArray();
auto beg2Addr = reinterpret_cast<void const *>(arr2.front().begin());
auto end2Addr = reinterpret_cast<void const *>(arr2.back().end());
return beg1Addr < end2Addr && beg2Addr < end1Addr;
}
with an overload that works on masked images by calling the version above on the image, mask and variance planes.