Exporting annotation selection and have all of non-selection be transparant (=alpha channel)

Dear all, I was wondering if someone could provide a step by step analysis of the following please.

If I make a selection in QuPath and would like to export just this selection. However, instead of having the selection show and all else in the file be the color white , I would like it to export with an alpha channel into a container/file type which supports transparency. How would I go about this?

Thank you so much.


Hi @Lindis, can you be more specific about why you require this (e.g. to create an overlay for visualization, to use for further processing/analysis elsewhere) and also what ‘export just this selection’ means?

I ask because there are many ways to interpret this, e.g.

  • the selection should be filled or only shown as an outline (in which case, with what line thickness?)
  • the original pixel values of the image should be included within the selection, or the interior should be something else
  • the selection should retain the original RGB color, or give a binary mask (with transparent background)
  • the export should be at the full resolution or downsampled

A script that supports all of these would be very complex, therefore it would be helpful to be as specific as possible so that a script could be made more quickly. Note that some existing export options are described here.

Your post implies that you already have a method that almost does what you want, but gives a white background rather than transparency. If you could specify what this method is that would be a helpful starting point.