I was surprised to see that the linear fits are not the inverse of each other.
This is the expected general behavior. To understand why this happens, let's describe the LinearFit task. For a set of N data points {xi,yi} for i = {0,...,N-1}, LinearFit finds the parameters a, b of the straight line function:
y = a*x + b
that minimizes absolute deviation:
[1]Sum( |yi - b - axi| ) for i = {0,...,N-1}
If the data points are exactly related by a linear function, then the resulting absolute deviation will be zero and what you are expecting will happen, that is, if we apply LinearFit to the reverse set {yi,xi} in this
unique case, we'll obtain:
x = y/a - b/a
However, if the data are not related by a linear function, then the residual absolute deviation will be greater than zero and the preceding equation will not hold. This is what happens with real world images, where a linear function can only be an approximation to the set of differences between pairs of pixel values at the same coordinates.
Of course, we can carry out a controlled experiment to verify that this works as described. Open an image (any image will work, not necessarily a linear image) and duplicate it. For simplicity, let's rename them as "A" and "B". Now apply the following PixelMath expression to B:
$T*0.75 + 0.0025
Open LinearFit, select B as reference, and apply the tool to A. As expected, you'll get the following console output:
y0 = +0.002500 + 0.750000·x0
s0 = +0.000000
The resulting absolute deviation is zero because we know that both images are strictly related by a linear function. Hence, the third equation above must hold. Undo the LinearFit process on A and Apply LinearFit to B using A as reference:
y0 = -0.003333 + 1.333333·x0
s0 = +0.000000
where, as expected, we have -0.003333... = -0.0025/0.75 and 1.333333... = 1/0.75.
Now undo everything, including the PixelMath instance that you applied to B, and apply the following expression:
$T*$T + $T*0.75 + 0.0025
This time we are forcing a nonlinear function between both images. If you apply LinearFit to A using B as reference, this is the result:
y0 = +0.001956 + 0.803880·x0
s0 = +0.000083
The resulting average absolute deviation is greater than zero, denoting that the linear fit is approximate. The inverse application (undo A, apply LinearFit to B with reference=A) yields:
y0 = -0.002215 + 1.226951·x0
s0 = +0.000102
Note that this time, since we have introduced a term on the square of the image, the fitted function is an approximation and hence not invertible. If it was, we'd get:
-b/a = -0.001956/0.803880 = -0.002433
1/a = 1/0.803880 = 1.243967
instead of -0.002215 and 1.226951, respectively. In the example that you put in your post you get average absolute deviations around 0.002, which is one order of magnitude larger than the deviations we are getting in this synthetic example, so the differences in the fitted function parameters have to be much larger.
In fact I am also surprised that none is even near the scaling/offset calculated by II
The scale factors and zero offsets computed by ImageIntegration have nothing to do with the LinearFit process that I have described. It is a completely different algorithm, which is described in detail in the
reference documentation of ImageIntegration. In this case the normalization parameters are computed from estimates of statistical scale (dispersion, or variability) and location (central value) with respect to the reference image. See Equation 33 in the documentation.
References[1] W. H. Press et al. (2007),
Numerical Recipes: The Art of Scientific Computing, Third Edition, Cambridge University Press, Sect. 15.7.3.