alan-turing-institute / pixelflow

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

Include regionprops_3D metrics in default features #8

Closed evangeline-corcoran closed 1 year ago

evangeline-corcoran commented 1 year ago

It would be helpful to add PoreSpy regionprops_3D metrics (https://porespy.org/modules/generated/generated/porespy.metrics.regionprops_3D.html) to the list of callable features when running pixelflow, to allow generic measurements to be gathered from 3D masks.

Additionally a method of detecting the shape of img and mask so that scikit image regionprops are used by default for 2D inputs, and regionprops_3D for 3D inputs. An argument for image dimensions that would allow users to manually specify the dimensions of there image would also be helpful other n-dimensional information i.e. RGB values, geodata, time series.

evangeline-corcoran commented 1 year ago

Need location features from sci-kit image regionprops (bbox, centroid) to be added to 3D metrics in features table.

IFenton commented 1 year ago

Working on this in IFenton-8-3Dmetrics

quantumjot commented 1 year ago

Just to add a note here, we need to be careful about defining what 3D is. In some instances the third dimension is time rather than a spatial dimension, so I would argue that we need some kind of input that assigns semantic labels to the dimensions to help with this, e.g.:

features = pixelflow(mask, image, dim_labels="ZYX")

to designate a 3D image volume, or:

features = pixelflow(mask, image, dim_labels="TYXC")

to designate 2D images over time, with C channels, etc...

The default should just be "YX".

IFenton commented 1 year ago

Thanks for the comments - I've added dim_labels functionality, currently based on the mask.

At the moment, the dim_labels default is an empty string, and if it isn't specified I use the number of dimensions of the mask to guess between YX and ZYX, with a print statement to indicate which is chosen. I also have a check that the dim_labels matches the number of dimensions. My reason for not using "YX" as the default at the moment is that regionprops_table (the 2D default) runs with a 3D image, but the several of the outputs are not meaningful.