When using a MarkupsROI to restrict the region that Local Threshold is applied to, the actual restricted region is not the same as the ROI region. I have experienced the restricted region being larger than the ROI and smaller than the ROI. The bounds do seem to be related to the positions of corners of the ROI box, but the orientation of the faces of the restricted region are not parallel with the ROI faces. Here is a scene using sample data with an ROI and a segment created from the ROI using LocalThreshold https://drive.google.com/file/d/1SSXFrNzsM3GsBLR2XLWVuIxyAImUGjyE/view?usp=sharing
This is a difference case where the restricted region is smaller than the ROI region (the straight edges of the light blue segment show the edge of the restricted region).

It seems like there is probably some code which is perhaps based on the coordinates of corners of the ROI which makes incorrect assumptions about the orientation of the ROI (e.g. that it is RAS aligned).
This bug makes Local Threshold much less useful when trying to restrict to a local ROI.
When using a MarkupsROI to restrict the region that Local Threshold is applied to, the actual restricted region is not the same as the ROI region. I have experienced the restricted region being larger than the ROI and smaller than the ROI. The bounds do seem to be related to the positions of corners of the ROI box, but the orientation of the faces of the restricted region are not parallel with the ROI faces. Here is a scene using sample data with an ROI and a segment created from the ROI using LocalThreshold https://drive.google.com/file/d/1SSXFrNzsM3GsBLR2XLWVuIxyAImUGjyE/view?usp=sharing
This is a difference case where the restricted region is smaller than the ROI region (the straight edges of the light blue segment show the edge of the restricted region).

It seems like there is probably some code which is perhaps based on the coordinates of corners of the ROI which makes incorrect assumptions about the orientation of the ROI (e.g. that it is RAS aligned).
This bug makes Local Threshold much less useful when trying to restrict to a local ROI.