[Qgis-user] Limit a raster processing to a subset/region/mask area?

celati Laurent laurent.celati at gmail.com
Fri Jun 13 09:04:34 PDT 2025


Thanks so much Mr. Kirk for sharing your advice/guidance.
I confirm to you : No data values are well written to the header (-999).
Unfortunatly, for the raster segmentation step, the process is performed
for the no data values area.

Thanks for sharing your alternative proposal/option : "using the raster
calculator to reset these pixels to -999", no data values.
If i well understood your idea, you suggest to add an additional step on
the first segmentation output raster. To enforce the no data value on this
existing segmentation raster, before to
do the merge whole raster segmentation. Yes, i can try this method. But, i
must confess that i never do this task : "Set no data values for a raster,
only for a subset/area of the raster" : "Set/Define
No data values for pixels that (not) overloap with an input mask vector/or
input mask raster" (set condition).
Thanks so much.

Le ven. 13 juin 2025 à 13:12, celati Laurent <laurent.celati at gmail.com> a
écrit :

> Hello again,
> Following to my previous own post I'm taking the liberty to do a first
> reaction/addition. I tried clipping my multispectral SPOT6 image with my
> BD FORET mask (clip a raster with a masking extent coverage) by setting the
> value -999 (16-bit signed output) for the no data values during clipping.
> This worked. But when I try segmentation with the OTB GRM tool on this
> image, the process isn't ignored in the areas for which I had assigned no
> data values. The tool segmented the entire image. I sharean additional
> screenshot showing the pixel values in an area of no data values. The
> values are indeed set on no data values for the multispectral SPOT6 input
> image. And you can clearly see that it assigned a value to my
> segmentation result. The process has been done for no data values also :
> [image: SS_raster_segmentation_spot6_nodatavalues.jpg]
> Thanks.
>
> Le ven. 13 juin 2025 à 11:58, celati Laurent <laurent.celati at gmail.com> a
> écrit :
>
>> Dear all,
>> I'm working in a QGIS environment (graphical interface). Specifically,
>> I'm using a QGIS modeler. Thanks to the processing toolbar provides, i have
>> access to QGIS, Grass, Saga, and Orfeo toolbox tools algo. My goal is to
>> generate a segmentation for geographic area. For the segmentation, I use
>> the OTB tool via QGIS "Generic region merging":
>> https://www.orfeo-toolbox.org/CookBook-7.0/Applications/app_GenericRegionMerging.html
>>
>> The complexity comes from the fact that I want to
>> contextualize/differentiate the parameters and input data required for the
>> segmentation step,within my study area based on a land use layer/mask
>> layer. So i want to define specific parameters/input data for the
>> segmentation generated on forest areas. And other input data/segmentation
>> parameters generated for non-forest areas (urban, agricultural). I
>> therefore have a vector data set, "Forest DB mask," which allows me to
>> locate/mask forest areas.
>>
>> I therefore want to :
>>
>>    1. Generate an initial "raster segmentation" from an aerial/satellite
>>    image with specific parameters for forest areas (segmentation calculation
>>    only for raster pixels that overlap my forest DB mask). Therefore, the
>>    calculation must NOT be performed/ be ignored for pixels not covered by
>>    this mask layer (agricultural, urban, etc.).
>>    2. Then generate a second "raster segmentation" for the rest of the
>>    study area that was ignored/skiped during the first segmentation
>>    (segmentation calculation only for raster pixels that do not overlap my
>>    forest DB mask: agricultural, urban, etc.).
>>    3. Then, once these two raster segmentations are complete, the idea
>>    is to merge them into a single raster. Then, generate a polygonization
>>    (raster to vector).
>>
>> This little workflow isn't really complicated. But I'm wondering if it's
>> possible to do it in a QGIS modeling/graphical interface environment. I'd
>> be interested in advice/ideas. Do I must to  clip input rasters with the
>> forest DB masking layer? With a management/assignment of "no data values"
>> to ignore the segmentation processing on areas not covered by the mask
>> layer?
>>
>> I've attached below a screenshot that allows you to display an input
>> raster image (here a multispectral Spot6/7 satellite image) and the mask
>> layer (vector forest DB mask) to better visualize the context.
>>
>> [image: SS_MS_masque_bd_foret.jpg]
>>
>> Thanks so much.
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20250613/885ddac8/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SS_MS_masque_bd_foret.jpg
Type: image/jpeg
Size: 178897 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20250613/885ddac8/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SS_raster_segmentation_spot6_nodatavalues.jpg
Type: image/jpeg
Size: 26058 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20250613/885ddac8/attachment-0003.jpg>


More information about the QGIS-User mailing list