Skip to content
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

get num tissues #296

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

nanli-emory
Copy link
Collaborator

feature added: # of pieces of tissue #276

  1. add helper function BaseImage.getMaskReginsStats to get the based statistics for tissue areas
  2. Use BasicModule.countTissuePieces to get # tissues in the current mask
  3. change the ./histoqc/config/config_v2.1.ini files to save #pieces_of_tissue



def countTissuePieces(s, params):
area_thresh = int(params.get("area_threshold", "1000"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think applying an area threshold here is redundant. Ideally small objects etc. will already be filtered out and the countTissuePieces method will just report what's there.

# area_mean = areas.mean()
# else:
# nobj = area_max = area_mean = 0
stat_rs = getMaskReginsStats(mask)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like none of the stats are being added to the printList?

@@ -341,3 +342,22 @@ def getDimensionsByOneDim(s: BaseImage, dim: int) -> Tuple[int, int]:
else:
w = int(dim * width / height)
return w, dim


def getMaskReginsStats(img, area_threshold: int = 0)-> dict:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regions misspelled

@@ -206,6 +206,9 @@ def getImgThumb(self, size: str):
self[key] = getBestThumb(self, bx, by, target_dims, target_sampling_factor)
return self[key]

'''
the followings are helper functions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"following" not "followings"

@jacksonjacobs1
Copy link
Collaborator

Thanks Nan,

Just a few small comments above.

@nanli-emory
Copy link
Collaborator Author

Thanks Nan,

Just a few small comments above.

Hi @jacksonjacobs1, please review and confirm the changes.

Copy link
Collaborator

@jacksonjacobs1 jacksonjacobs1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Ready to merge in.

@jacksonjacobs1
Copy link
Collaborator

@choosehappy one quick question before I merge this in....

This PR adds a line to config v2.1 to count # of tissue pieces.

I do not think we should modify config files while keeping the same filename. Conceptually, histoqc should always produce the same output if the user uses config v2.1. Do you agree?

@choosehappy
Copy link
Owner

that is a very good, even philosophical, question

at minimum I would say the same config file should produce the same numerical results, and in this case, simply counting the pieces of tissue isn't actually impacting the metrics

on the other hand, the output file itself now changes - which is less than ideal ,but may be tolerable

how do you want to address this? i think we need config files to be "fully featureD" so that folks can see how to use the different things. on the other hand, "2.1" was for the 2.1 release --- are we still on the 2.1 release if we keep adding things?

at some point we should officially release (tag + code) e,g. 2.2, 2.3 etc - maybe having a config name based on the version is a bit chaotic and unsustainable? maybe it should all go into just config.ini and have the versioning "do its thing"?

what do you think?

@jacksonjacobs1
Copy link
Collaborator

I agree that the config file v2.1 naming convention is a bit chaotic.

However, pushing changes into the config.ini kind of defeats the purpose of nan's unit tests:
https://github.com/choosehappy/HistoQC/blob/master/histoqc/tests/test_images_tsv_results.py

The unit tests were written specifically for a configuration file (in this case v2.1) which we assume does not change between commits.

If we change config files in commits, we will also need to update the unit tests before each commit.

@choosehappy
Copy link
Owner

If we change config files in commits, we will also need to update the unit tests before each commit.

I don't immediately know that this is a bad thing? if we're adding new features, we should be adding new unit tests to cover those features?

so it somehow seems like this is the intended outcome?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants