Region of interest (ROI)

Hello everybody,

I have an image with multiple bands. I am wondering if it is possible to define ROIs and collect the values for all the bands and export them in csv files.

Thanks

Carlo

1 Like

Hi Carlo,

right-click in the view and select “Export Mask Pixels” The mask severs as a ROI.
You can create masks by many different ways. You can load a shapefile, draw polygon or use Band Maths.

Marco

1 Like

Thank Marpet for your quick answer! When I draw my ROIs “Export Mask Pixels” is the only option among the others i cannot execute (the option is unavailable and in grey text)… Just to be sure I’m following the right procedure: I draw a polygon and then i double click to “close” it. then right click in the view. As matter of fact the “export transect pixels” is working. I have also noticed after your post that by closing and reopening (or opening another band) then i can export the mask by clicking on “Export Mask Pixels” and obtain what i need.

Thanks!

Carlo

Probably there is something wrong with the selection or the detection of the masks.
I’ll have a look.

I’ve created an issue for this: SNAP-296 - Export Mask Pixels not correctly enabled

Thanks! There is definitely something wrong… now I keep getting an error message: pixels cannot be export: pos < flushedPos! No idea why this is happening…

Are you working with a Sentinel-2 product? Or maybe any other product which has bands with multiple resolutions?

Ahh it can be… Actually I’am working with a stack of radar and optical images. They have been stacked together with the same resolution and projection but maybe something is still not align (??)

Hard to say without having the data at hand. Actually images should be of same size if you have collocated them. However, you can try another way. Create a subset of you data which contains only the ROI and then export this subset product. Use Export/CSV from the menu. Make sure to select the subset product in the product explorer before exporting it.

Hi marpet, thank you again for your answer. It is actually working making a subset. Just to describe better the situation: I derived the stack from gdal and saved it in envi format (the stack has 93 bands). If I try to export a the pixels of a mask (after doing the workaround of opening another view) I get the error message: pixels cannot be export: pos < flushedPos! If I do a subset and then export I still get the same error unless I reboot snap I do the subset and then the export of the mask (still with the workaround)… Hope it can help!

Hi @marpet
I am working on a sentinel 1 product, I have a subset of the displacement (After doing interferometry) and now want to export pixels values of my ROI (a polygon), the process is working fine but it takes hours to write the exported pixels to a .txt file. like the current operation is running for almost 4 hours.
I have a multi core work station, is there any way to allocate more processing resources to this operation to increase the speed.

Unfortunately it is not possible to enhance this operation.
How much data are you exporting? How many bands and how many pixels (roughly)?

When I run the “Export Mask Pixels” utility it shows me roughly 5.7 million pixels, please see attached sample file with 20 pixels. I am interested to export a single band i.e. “20150213_Select_pxl_disp” in the attached, but I am also getting the “displacement” band values as well.

Thanks and Regards20150213 - Copy.txt (1.4 KB)

Ar you doing the export directly after doing the interferometry without saving the result first?
Maybe it is the interferometry what takes so long and not the pixel export.

hii…
i have a training data file of a region which i want to clip from a pixel. how should i procees?

In which format is your training data file? Can you already open it?
You just want to extract a single pixel?

Right-click on the specific pixel and select Copy Pixel-Info to Clipboard.

Or use the PixEx tool from the menu: Raster / Export / Extract Pixel Values

the training file is in csv format

sir, actually i am new to snap.i have downloaded the image and i cant open it it in the xml format.
so i dragged down the complete zip folder
i wanted to apply the basic corrections but i couldnt do that as well due to the error
secondly i couldnt clipp the required area off from the single image. kindly help me

So maybe you can use: (File / Import / Vector Data / Vector from CSV)
Please see also the corresponding section in the help.

it isnt working here