About seedvalue in ImageBoundaryToMask function

Hello all,
I am trying to use the `ImageBoundaryToMask` function to generate a ROI in an image. In order to fill the ROI with 1, the usage of seedValue is suggested. This value is provided by a coordinate provided by  (xpnt, ypnt) of the image.

Make/O/N=(100,200) src=gnoise(5)        // create a test image
SetScale/P x 500,1,"", src;DelayUpdate    // give it some funny scaling
SetScale/P y 600,1,"", src
Display; AppendImage src
Make/O/N=201 xxx,yyy        // create boundary waves    
xxx=550+25*sin(p*pi/100)        // representing a close ellipse
yyy=700+35*cos(p*pi/100)
AppendToGraph yyy vs xxx

//To generate an ROI masked filled with 1 in a region defined by a seed value and the boundary curves:
ImageBoundaryToMask ywave=yyy, xwave=xxx,width=100,height=200,scalingwave=src,seedx=550,seedy=700

 

Question is that the seed value should be picked from a point within the ROI area or outside ?

Also, the error of BadSeedValue comes up if the (0,0) point is within ROI, but this runs fine if ROI does not include (0,0).

 

 

The example you posted answers your first question. The seed value is inside the ROI and this gives a binarised result. 1 is in the ROI and 0 is outside. It might be possible to specify the seed value outside the ROI and the invert the result to find the ROI (e.g. 580,610) but this can give unexpected results depending on the ROI and image boundary.

For the second part of your question. We get BadSeedValue if we use 0 for seedx and seedy (it is outside the image, due to the scaling). However, if we do:

SetScale/P x -50,1,"", src;DelayUpdate    // give it some funny scaling
SetScale/P y -100,1,"", src
Make/O/N=201 xxx,yyy        // create boundary waves    
•xxx=0+25*sin(p*pi/100)        // representing a close ellipse
•yyy=0+35*cos(p*pi/100)
ImageBoundaryToMask ywave=yyy, xwave=xxx,width=100,height=200,scalingwave=src,seedx=0,seedy=0

It works as before. Note that the ROI contains 0,0 in this modified version. The seedx and seedy values use the scaling of `src`.

Thank you for the response. I found that the seed value must not be a point value but the data value. After this, the operation runs correctly. :-)