Closed oskooi closed 7 months ago
This example is showing a ≈ 50% error when the separation is a little under 3 pixels, about a 1.5-pixel error bar. This seems pretty good to me?
Recall that we only count "interior" pixels when looking at the difference of morphological transforms, in order exclude discretization artifacts. This seems like it could give error bars of up to 2 pixels, since an interior pixel needs to have one pixel on either side of it. Maybe there is a different way to define "interior" so that something 2 pixels wide is counted as having 1 "interior pixel", that would lower the error bar.
Note also that just in your construction of the image you could have an error of about 1 pixel in the separation just from the discretization process. (e.g. you could have a separation that is supposed to be 1.99 pixels, but the boundaries fall just past the centers of two adjacent pixels so it gets increased to 3 pixels.) So you really have 2 sources of error here, and they are additive.
cc @mawc2019
Recall that we only count "interior" pixels when looking at the difference of morphological transforms, in order exclude discretization artifacts. This seems like it could give error bars of up to 2 pixels, since an interior pixel needs to have one pixel on either side of it.
Yes. Consider we strip off the interface solid pixels from a solid pattern. After this operation, if there is still at least one pixel left, the original solid pattern should span at least 3 pixels in both x and y directions. Therefore, if the difference between opening and closing is a thin pattern (at most 2-pixel wide), such difference will not be counted as a sign of lengthscale violation.
…… down to about 5.0 below which the measured value is a constant. In the output, the relative error actually starts to become larger than expected when the separation distance is 6.7.
At small lengthscale, the difference between opening and closing can be a thin pattern even if violation attains. Therefore, the lengthscale tends to be overestimated in this regime.
This could suggest some room for improvement to imageruler's algorithm.
Yes. For example, we might introduce another violation criterion without stripping off interface pixels: if a 2×2 solid pattern is formed after image subtraction, i.e., $\rho-\mathcal{O}(\rho)$, $\mathcal{C}(\rho) - \rho$, and $\mathcal{C}(\rho)-\mathcal{O}(\rho)$ , lengthscale violation is counted. I do not know if this criterion can replace the current one. If the answer is no, we might need use the two criteria together, which increases the computational cost.
Note also that just in your construction of the image you could have an error of about 1 pixel in the separation just from the discretization process.
Yes, but this issue cannot be resolved by introducing a new criterion. Perhaps we can improve the construction accuracy a little bit by specifying whether the 2d input array is defined at pixel centers of pixel vertices.
The needed improvement here likely relates to the manner in which "ignored violations" are calculated. Currently, the algorithm ignores all border features, even if the feature is one or two pixels wide. It is probably better in general to only ignore borders for large features.
I have a version of this implemented here: https://github.com/mfschubert/topology/blob/main/src/tometrics/metrics.py#L371
Closed by #30
As an experiment to investigate the accuracy of
imageruler
, we can measure the separation distance between two circles which contain no sharp features or small artifacts. In this example, there are two circles of diameters 80 and 60 and the separation distance (void region) is varied from 1.0 to 20.0 in increments of 1.9. The resolution is 1 pixel per unit length. Given this configuration, we would expect to resolve separation distances down to about 2.0 based mainly on the resolution of the image.A plot of the measured vs. actual value of the separation distance is shown below. This plot is almost exactly linear for separation distances down to about 5.0 below which the measured value is a constant. In the output, the relative error actually starts to become larger than expected when the separation distance is 6.7.
This could suggest some room for improvement to
imageruler
's algorithm.notebook