Export Mask - Graph creator

I am trying to run a simple operation within SNAP in order to extract pixel values for Landsat 8 imagery.
I am trying to calculate the % of clear pixels within a 10km square.
I am importing the pixel_qa band from the landsat 8 folder.
I have then imported a shapefile called ROI_10km.
Using Bandmaths, I have then created a new band called ROI using the expression "1$ROI_10km
The second new layer i create is pixels_ROI I then assign the pixel values from the pixel_qa layer to the ROI band using the equation
ROI == 255 then pixel_q or 0
How can I then just export the pixels of pixels_ROI within the mask as I am unable to run the export mask tool using the graph creator.
I want to use the graph creator as I am eventually planning on batch processing Landsat imagery.

Thanks, Harry

could you please provide a screenshot which helps us understand what you want to achieve?

Hi, for the selected region I would like to extract the pixel values into a csv sheet.
Normally for a single image I would right click on the image and use the Export mask pixels tool to extract these pixels.
However, I cannot find this tool within the graph builder and was wondering how what alternative method there is to do this process.

now I see. Haven’t found it in the Graph Builder as well but maybe you can just use the Land-Sea Mask tool with the vector as a boundary and change the writer output to CSV?

Hi, I have tried what you have suggested but on the drop down menu when i select Use Vector as Mask there is no options available for selection.

too bad…

You could import the vector once, save the product and close it, re-open it again. Then you should have it as a binary mask in your product which you could use then to subset your product using the band maths . Just a thought… Didn’t fully figure out if this all works within a graph as well.

You can try it like this:

I can see the imported shapefile countries_1.

However, in general, there is currently no good way to extract masks from products in batch mode.
It could be done by a python script.