-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor pipeline to use grain crop dictionaries #1022
base: main
Are you sure you want to change the base?
Conversation
…ti class & subgrains
…mask required bool. Tested in debugger.
…2] >= 2, shape[1]==shape[2]
…rainCrops. Locally debugged working
Proposed solution to the data frame issue
|
Its that or split into separate files. I'm ambivalent as to the preferred solution as I don't use the output but consideration for end users should be given. Whilst data management, manipulation, summarisation and plotting are, in my view, core skills for researchers these days experience levels vary widely and I don't know what would be easiest. |
Are we aiming to include this refactoring in |
@@ -65,6 +65,7 @@ grainstats: | |||
extract_height_profile: true # Extract height profiles along maximum feret of molecules | |||
disordered_tracing: | |||
run: true # Options : true, false | |||
class_index: 1 # The class index to trace. This is the class index of the grains. | |||
min_skeleton_size: 10 # Minimum number of pixels in a skeleton for it to be retained. | |||
pad_width: 1 # Pixels to pad grains by when tracing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pad with could be added into grains? or (see later disordered tracing comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
cropped_images, cropped_masks, bboxs = prep_arrays(image, grains_mask, pad_width) | ||
n_grains = len(cropped_images) | ||
img_base = np.zeros_like(image) | ||
# cropped_images, cropped_masks, bboxs = prep_arrays(image, grains_mask, pad_width) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(continued from default config) or need to be padded here otherwise the 3x3 convolutions will not work
Co-authored-by: Neil Shephard <[email protected]>
I don't think so necessarily. If this comes before we do |
We will need to make grain padding an option in |
…ng non square bboxes
Notes for self for after the break: This PR focuses on using data classes to hold grains in a per-grain data structure rather than a per-processing-step, whole image + whole image tensor mask structure. This PR's scope takes it from grains initially generated, to disordered tracing and no further, to keep this PR more manageable. This PR will enable downstream processing of multi class grain tensor masks, and allow Max's code to trace them while also getting grain stats out for sub-grains, results stored neatly in disordered tracing, while avoiding any clashes of index in the grainstats csv. In subsequent PRs, it would be good to try to align the stats for the sub-grains with sections of the molecules identified by Max's tracing code, though they may produce vastly different structures in some circumstances. Use positions potentially to do the mapping (WIP proposal). Traditional height thresholding to produce multi class masks will also be required. This will produce "halos" but this is to be ignored / dealt with later and not worried about. Allows the lab members to at least check feasibility of their pipelines. Pixel to nanometre scaling and filenames should be kept in the grain crops too. |
Things to add to grain crop objects:
|
This is a draft PR and documentation / tests will be added before full PR is made
TopoStats Pull Requests
Please provide a descriptive summary of the changes your Pull Request introduces.
The Software Development section of
the Contributing Guidelines may be useful if you are unfamiliar with linting, pre-commit, docstrings and testing.
NB - This header should be replaced with the description but please complete the below checklist or a short
description of why a particular item is not relevant.
Before submitting a Pull Request please check the following.
docs/configuration.md
docs/usage.md
docs/data_dictionary.md
docs/advanced.md
and new pages it should link to.Optional
topostats/default_config.yaml
If adding options to
topostats/default_config.yaml
please ensure.topostats/validation.py
to ensure entries are valid.topostats/entry_point.py
.