qupath / qupath

QuPath - Open-source bioimage analysis for research
https://qupath.github.io
GNU General Public License v3.0
1.04k stars 280 forks source link

Subcellular detection for all 3 BF channels #304

Closed Svidro closed 4 years ago

Svidro commented 5 years ago

Requesting access to all 3 channels for subcellular detections, useful when handling non-standard stains (Brightfield Other). It would be much easier than juggling around the detections and color vectors and re-inserting them into the project. image

:)

petebankhead commented 5 years ago

I haven't been able to replicate this issue. If I set the stains with the following script

setImageType('BRIGHTFIELD_OTHER');
setColorDeconvolutionStains('{"Name" : "My strange stains", "Stain 1" : "Orange", "Values 1" : "0.012 0.276 0.961", "Stain 2" : "Black", "Values 2" : "0.631 0.631 0.451 ", "Stain 3" : "Purple", "Values 3" : "0.304 0.922 0.239", "Background" : " 255 255 255 "}');

Then all three turn up under Subcellular spot detection as options.

There is some logic for identifying which stains to show/hide: https://github.com/qupath/qupath/blob/b4a442535b2bd8169aacf16ecf6aac61004971b0/qupath-core-processing/src/main/java/qupath/imagej/detect/cells/SubcellularDetection.java#L673-L681 But I don't see why black is failing in your case, unless it has wrongly been identified as a 'residual' stain (i.e. there are only two stains, and it represents what is left over).

Svidro commented 5 years ago

Would it be possible to allow all 3 stain vectors in Brightfield Other regardless of what they are named? Occasionally I have wanted to detect Hematoxylin within more complex samples as well, though I can get away with renaming it Htx. The logic isn't listed anywhere other than the code, so anyone else trying to get Hematoxylin subcellular detections in a 3-4 color brightfield image could struggle.

Also, I think black was actually the residual channel (there was a large amount of silver stain in the image), I renamed it thinking that I might get around ignoring the residual channel that way. If the program can somehow tell that was the residual channel without the name Residual or being in the 3rd position, that might have been it.

petebankhead commented 5 years ago

Yes, it would be possible. I'm somewhat on the fence as to whether it's desirable... it should be easy to change the code and just allow all three images when applying color deconvolution (including the residual).

Putting yourself in the position of a less experienced user, do you think that would be better/worse/much the same?

Svidro commented 5 years ago

Oof, only a couple years since I started all this, but I'm not sure I would trust myself to do that at this point. I feel like it is one of those situations where it would either best be hidden as a preference or "Advanced" option, or, with a single line of text at the top of the dialog stating something along the lines of "Only change the values for the stains you are interested in, leave the rest at -1."

For simplicity's sake I would opt for the single line of text, but I think that would help a lot of users looking at that dialog for the first time, without being too much of a pain to code or bothersome to more experienced users.

petebankhead commented 4 years ago

Closing this as it has gone quiet... and because I think the days of subcellular detection are/should be numbered.

There will be no further changes for v0.2.0, and in future versions I think the command ought to be replaced rather than incrementally improved.

From v0.2.0-m12 it should also now be possible to add object measurements based upon pixel classifications to cells. This has the aim of reducing the frequency with which subcellular detections are required.