Mike,
This bug has been fixed in the new versions of the Geometry and ImageRegistration modules, which I have released today. Thank you for detecting this problem.
However, there's something that may seem weird at first sight, so I prefer to comment it in advance.
The PI/PCL implementation of nearest neighbor uses now arithmetic rounding of coordinates:
Round( 0.5 ) = 1
Round( 1.5 ) = 2
Round( 2.5 ) = 3
and so on. When nearest neighbor is used to upsample an image, inverse mapping inevitably causes an odd effect on the borders of the resulting image. Consider the first row of your 128x128 image, being upsampled 4:1 to 512x512:
Result pixel coordinate : 0 1 2 3 4 5 6 ... 505 506 507 508 509 510 511
Source pixel coordinate : 0.00 0.25 0.50 0.75 1.00 1.25 1.75 ... 126.25 126.50 126.75 127.00 127.25 127.5 127.75
Rounded source coordinate : 0 0 1 1 1 1 2 ... 126 127 127 127 127 127 127
Due to the biased interpolation, the first two columns are atypical. After columns 0 and 1, we have sequences of four duplicates of the same original pixel. However, since we cannot interpolate outside the source image, the last two rows must necessarily be duplicates of the last pixel in the source row, at column index 127. The rounded coordinate would be 128, which doesn't exist. The same happens vertically.
The obvious way to avoid these atypical border rows and columns is to truncate coordinates (e.g. by the floor operation) instead of rounding. If we truncate, the first four columns map to zero, and the last four ones map to 127, which is equivalent to pixel replication. However, truncating coordinates is incorrect in my opinion. These border effects are IMO statistically irrelevant; they are just the result of a strictly correct implementation.