alan-turing-institute / pixelflow

BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Set scale for measurements in features table #35

Closed evangeline-corcoran closed 10 months ago

evangeline-corcoran commented 11 months ago

It would be great to enable the user to provide a scale (e.g. 1 pixel in image = ?mm) that can be used to recalculate the values given in the features in real world terms.

Potentially as an argument when calling pixelflow? e.g.

pixel_mm = 27 
features = pixelflow(
        mask,
        image,
        scale = pixel_mm,
        #custom=(custom_func,))
IFenton commented 10 months ago

There is currently a way to do this in regionprops, by adding an argument 'spacing = (x,y)' with x and y being the size of a single pixel in your unit fors those two dimensions.

This does work with pixelflow, but only for 2D measurements (as regionprops_3D doesn't have the relevant argument). If you try using it for 3D data, then it will, unhelpfully, return scaled measurements for those calculated through regionprops (e.g. centroid) and unscaled measurements for those using regionprops_3D.

So I'm currently working on fixing this for the 3D version