napari-plot-profile
napari-plot-profile copied to clipboard
Interpolation
It would be cool to have some interpolation for the measurements. It might also make sense to take the thickness of the annotated line into account and average over a small region. For that, we should figure out, how exactly this is done in other tools such as ImageJ
I think the option of using a wider line (so a line that has pixels (just a few) in the transverse direction, relative to length) and then, for example, averaging the transverse pixels to get a value for that given length step is a good one. Could help with noisy images. However (and I sort of refer to that in #11 ) I think that if the user wants upscaling or smoothing or whatever, it's best to let the user apply filters whatnot to their image, get a new layer, and then use the tool to view that, rather than using the plot tool. Or, use the plot tool to get their data and then further process using other tools. Because manipulating the plot connected to the image without altering the image kind of abstracts and masks the processing being done.
it's best to let the user apply filters whatnot to their image, get a new layer
That's a very interesting suggestion. I wished I had thought about that years ago in ImageJ.
Or, use the plot tool to get their data and then further process using other tools.
To be honest, exporting a line profile with nearest-neighbor rounding-artifacts cannot be fixed with post-processing. We really need to support interpolation.
That's a very interesting suggestion. I wished I had thought about that years ago in ImageJ.
I only thought of it because this is what napari-pyclesperanto-assistant does so brilliantly!
Regarding interpolation I think we may have crossed streams here. I was thinking you were referring to the NumPlotPoints > LineLength, thus interpolating the in between the measured values, so to speak. Meanwhile, based on your previous post in the other issue, I think you're referring to cases where the overlay line lies on multiple pixels due to being at an angle.
So if we read out every pixel overlaid by the line, then I can see how
At this point it may be useful to look at skimage.measure.profile_line() https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.profile_line It does a lot of nice things:
- it has interpolation options, but note the length of the array returned is the ceiling of the line length, so it's interpolation to transform the values to fit the line length.
- it includes the option to use a wider line—as in your OP—with user option to reduce the transverse pixels to the line values, as well as interpolation options.
At this point it may be useful to look at skimage.measure.profile_line()
Would like to take this task over? I have zero experience with that function but would love to see our custom implementation here replaced with something more sophisticated. :-)