Include node count in grain_statistics.csv#1382
Conversation
ubdbra001
left a comment
There was a problem hiding this comment.
Not super happy with the nested loops, but it looks like the usual way of doing things, so I can give it a pass.
I'd recommend adding test cases for highlight_node_centres at least. There is a stub already, but now would be a good time to complete it.
|
Calculated by count of labels, this doesn’t do what was done before where we counted simply the number of pixels in the node mask, which returned an erroneously high number of nodes for a given image. |
|
I've added a test for I've also added |
ubdbra001
left a comment
There was a problem hiding this comment.
It would be good if you could include tests for no nodes and multiple nodes if possible, just so the behaviour of the function is explicit and tested for these cases too.
Though that's more of a should than a must, so if it's not something that could be added in (max) an afternoon then just add a note to the test that these cases need to be added later.
Once either of the above is done then this looks good to go.
ubdbra001
left a comment
There was a problem hiding this comment.
Great, ready to merge!
Thanks!
If disordered tracing runs but one/ some of the grains fail (meaning they have no disordered trace) this will now be checked before attempting to access this information
Add node count to grain stats
Closes #1379
After nodestats has run the total number of nodes can be collected and added to the grain's stats dictionary (called
num_nodes)The most appropriate
.csvto save to isgrain_statistics.csv, but there was an issue with how we'd do this as nodestats are collected on a graincrop level butGrainCrop.stats(therefore alsograin_statistics.csv) is further divided intoclassandsubgrain. For now I have just duplicated thenum_nodesvalue across all rows related to a grain - not a perfect solution but better than having empty cells that could cause confusion.A small bug has also been fixed related to the missing disordered tracing stats that were recently re-added where not running disordered tracing would cause a
KeyError. This has been rectified with a quick check before attempting to access.docs/usage/data_dictionary.md