How to change the LUTs in a brightfield image?

Hi, I have some brightfield images (RNAscope 2.5 HD Duplex) taken on a Leica microscope and exported in .lifext. For some reason, the images were saved as composite images with the colors in a weird order. I can open them fine in QuPath but the colors are wrong - for some reason they are BGR instead of the standard RGB. When I open the images in ImageJ, I see the same issue but I can manually change the LUTs in each channel to BGR to fix the issue. How can I do this in QuPath?

Thanks!

Left: wrong colors when first opening in ImageJ (RBG)
Right: correct colors when re-assigning LUTs

to BGR

I’m just re-upping this thread, because I’d also like to know how to do it. I have a fluorescent .mrxs file (not my choice to use this format!) that is being read as an RGB with the colors in the incorrect order.

I have no idea about the QuPath part, but if the files can be opened in FIJI (or exported from QuPath as OME-TIFF and then opened in FIJI), I think it should be possible to write a macro that splits the R G and B channels into individual grayscale images, then recombines them in the right order as an RGB image.

The exact code would depend on how the split files ended up being named.

I’m afraid there’s currently no way: QuPath uses optimizations specifically for RGB images that mean channels can’t be changed (although for non-RGB images it’s possible to change them).

Would BGR → RGB fix this?

I’m thinking of ways to add an option specifically to handle switching the red & blue channels, but I’m not sure if more is needed.

Weirdly it seems to be the green and red channels that are switched in this example. But, since I can’t open the original, I can’t guarantee what order they were saved in. I just know that the colors don’t match the screen shots that my collaborator sent me.

Ideally, I’d like an option to switch RGB to any of the permutations of those three colors. But, BGR will handle the majority of the cases, and if I’m having an mrxs-specific issue, it’s not worth putting in too much effort to fix.

Caseviewer should have a free version available, but I never was a big fan.

If it is an issue, I am wondering if the ImageOps could be used with an “RGB” image to write out a multichannel OME-TIFF? I know it is possible to write out deconvolved channels as an OME-TIFF, so if your deconvolution was 1,0,0 0,1,0 and 0,0,1 - I would think that it could work.

I’m working on a solution. Seems promising, but not sure what else I’ll have broken along the way.

1 Like

Proposed solution is at Optional args on import, Bio-Formats dimension swapping by petebankhead · Pull Request #725 · qupath/qupath · GitHub

Use at your peril on duplicate projects (since if the arguments change before release, projects created using old ones might not open properly), but if you’ve a chance to test it I’d appreciate any feedback.

2 Likes