choosehappy / HistoQC

HistoQC is an open-source quality control tool for digital pathology slides
BSD 3-Clause Clear License
253 stars 100 forks source link

# of pieces of tissue - feature #276

Open choosehappy opened 6 months ago

choosehappy commented 6 months ago

from mask to use count + report # of unique pieces of tissue

should help identify e.g. TMAs and number of spots on the TMA

CielAl commented 5 months ago

Seems like a simple regionprop + minimum area thresholding can work. Just return the length of skimage.measure.regionprops output list and that's it.

CielAl commented 5 months ago

Question would be - should that be in the final processing stage, or that the # of tissue pieces should be traced at the end of each module (as post processing). IMO reporting in the final processing is sufficient.

choosehappy commented 5 months ago

agree, final post processing is likely going to be sufficient

as well, I'm not sure that we have to make a hard decision

if we define the module, users can stick the module where they want in the pipeline, and even use it multiple times if they give it an associated tag via a prefix like this one:

https://github.com/choosehappy/HistoQC/blob/72d1093f748e6a0bf55cd9212eefcaa936183e0f/histoqc/config/config_v2.1.ini#L163

jacksonjacobs1 commented 1 month ago

@nanli-emory , can you add this to your list?

HistoTools project item: https://github.com/users/jacksonjacobs1/projects/2/views/1?pane=issue&itemId=62031151&sortedBy%5Bdirection%5D=desc&sortedBy%5BcolumnId%5D=Status

We will basically just need a function called count_tissue_pieces() which gets the count as @CielAl described and records the count in the results tsv.

The question is, do we need a new module for this function or can we stick it in e.g, MorphologyModule.py and add it to the end of the v2.1 pipeline?

CielAl commented 1 month ago

@jacksonjacobs1 @nanli-emory I think a standalone module might be overkilling. A few facts here helping us wrapping it into existing modules: (1) Multiple modules involve collecting regionprops and corresponding stats (e.g., max/min of areas) and this piece of code is duplicated a lot. The # of tissue area is in fact also implicated in this computation. (2) regionprops is pickleable.

Therefore it might helpful to wrap regionprop-related statistics into a helper function wherein all modules can use it directly: e.g., given a mask (or regionprops, if already computed) and returns the # of connected tissue area, the summary statistics of these areas, etc. The resulted regionprops can be saved into the BaseImage as it's pickleable.

The advantage is that it reduces the amount of duplicated codes involving regionprops, and it also provides flexibility to report # of connected tissue areas after any arbitrary module (e.g., how many tissue pieces left after module1 and how many after module2, etc.).