Seems like you have answered your own question! Was there something more you were asking. I am happy to make a recipe file to do just as you need in our new software MIPAR (http://MIPAR.us) - quite powerful, I think you'd like it - but I am not clear on what your remaining question is?
You start by determining the dimension (rows and columns) of the ROI part of the original image in pixels. Then apply your edge detection operation on these limited range of pixels.