Oh, right, you did mention TMAs. That could be a lot easier.
I used this for a fluorescence TMA using the “Num Immune cells” TMA measurement. You would want to switch the text sections to H-score based stuff. You can also duplicate this script within a script, such that you run it once before using the setIntensityClassifications, and once after. You would need to change the first text entry (where it puts the new measurement, in this case “Immune cell count”) between copies so that it doesn’t overwrite itself.
More explicitly, one copy of the script below would use “H-Score: Cytoplasm” and one copy would use “H-Score: Nucleus” or similar wording. Both would use the input of “Tumor: H-score” in place of “Num Immune cells”
hierarchy = getCurrentHierarchy()
cores = hierarchy.getTMAGrid().getTMACoreList()
def ob = new ObservableMeasurementTableData();
// This line creates all the measurements
print "before cores"
it.getMeasurementList().putMeasurement("Immune cell count", ob.getNumericValue(it, "Num Immune cells"))
For your 4 i), the annotation was looking to get an entry that doesn’t exist. You could use that exact script to print a measurement after you had already made it (for example if you used the original H-score text instead of with the cytoplasm).
ii) I normally use annotations for pretty much everything, especially in TMAs so that I can get cell density. Force of habit. Usually there is damage to some TMA cores, and assuming all tissue areas are equal is… wildly incorrect. If you are only using H-scores, either should be fine.
iii) It doesn’t exist until you create it, which you should be able to do with the script above. At that point it should show up in the TMA measurement table.
I admit I kind of skimmed through and wasn’t paying a lot of attention with the first answer, so one other concern upon reviewing is to make sure that you understand that the Tumor H-score is ignoring all of the stroma cells. That means it would be artificially inflated compared to normal H-scores, which take all cells into account.
The 0 cells generally include the stromal cells. Not that you couldn’t try and use the H-score to mean something else, I guess, but it would definitely be a non-standard usage. @petebankhead has more experience with brightfield TMAs and might be able to chip in here.
Standard usage might be to annotate the Tumor area to separate it from the stroma, or perform some other type of general classifier along with smoothing. If you are both detecting your tumor cells using the E-cadherin stain, and generating a tumor H-score based off of the E-cadherin stain… I’m not sure that is good, since how would you end up with many 0 class cells?
Anyway, just checking since I don’t actually know how exactly you generated the initial Tumor and Stroma cells (you describe a trained classifier, but I don’t know what went into it )