LSMS within a set (polygon) shape (not within a whole square-shaped tif)

Essentially I am trying to segment tif images (Sentinel-2 NDVI). I need these to segment within certain shapes (that I have a polygon of) as opposed to segmenting the entirety of each tif image, which is square/ rectangular. I need it so all segmenting takes place within the specified shape and no polygons are created outwith the shape.

Configuration setup:
Python 3.7.7

Description of my issue:
Note because I am a new user I could only add one embedded image in this post even though I think more will be helpful, I will try and comment these on my own post

I am trying to segment multiple separate tif images (Sentinel-2 2A NDVI). Each of these images was generated by clipping the extent of one or more larger Sentinel-2 2A NDVI images (so some are multi-band images), with a different polygon (.shp).

I need each image to be segmented within the bounds of their respective polygon but not outwith this (there is a no data area outside the polygon area for each image) e.g:

So in the example above I would need the segmentation to take place only in the area that overlaps with the polygon (the area where pixel values aren’t no data) and only based on pixel values within this region (so no polygons fully or partially outwith this area). I am happy to go into detail as to why I need to do this if necessary (as opposed to just segmenting a larger image or masking to the extent of my original bound-defining polygon). I won’t add this now as I don’t think it helps.

To reiterate I want the segmentation to take place entirely on the pixel values within the polygons bounds and no polygons to be created outwith this + no polygons to be partially within the original large polygon bounds and partially outwith this.

Does anyone know how I can do this (either with LSMS, another Orfeo Toolbox method, or another method entirely)?

Your help would be greatly appreciated (I’m pretty stuck on this issue)

Thanks a lot,

Here is the segmentation of this image (note that the whole tif is segmented including the surrounding no data areas)

Here is the polygon I have used to clip the original larger NDVI image (the bounds of this polygon are what I want to segment and I want everything outside this ignored)