manipulating saved ROIs in a text editor?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

manipulating saved ROIs in a text editor?

Bill Christens-Barry
Here's what I want to do, either by macro or plugin:

while (something is true) {
    create a rectangular ROI;
    rename it;
    perhaps make something false;
}
save the ROIs in a file;
open and work with the ROI file in a text editor, recovering
coordinates, width, height, and name for each ROI;

The list archive didn't clue me to doing this, and I'm hunting for
hints. Can anyone offer suggestions?

Thanks.

Bill Christens-Barry
Reply | Threaded
Open this post in threaded view
|

Re: manipulating saved ROIs in a text editor?

Wayne Rasband
> Here's what I want to do, either by macro or plugin:
>
> while (something is true) {
>    create a rectangular ROI;
>    rename it;
>    perhaps make something false;
> }
> save the ROIs in a file;
> open and work with the ROI file in a text editor, recovering
> coordinates, width, height, and name for each ROI;
>
> The list archive didn't clue me to doing this, and I'm hunting for
> hints. Can anyone offer suggestions?

Here is an example macro that creates 10 rectangular ROIs and saves
them in a text file.

   f = File.open("");
   w=getWidth; h=getHeight;
   for (i=0; i<10; i++) {
       makeRectangle(random*w, random*h, random*w/4, random*h/4);
       getSelectionBounds(x, y, width, height);
       print(f, "roi"+i+": "+x+", "+y+", "+width+", "+height);
   }

This is what the text file looks like:

roi0: 208, 126, 53, 1
roi1: 247, 146, 31, 60
roi2: 61, 182, 11, 49
roi3: 118, 204, 35, 34
roi4: 84, 118, 36, 55
roi5: 100, 82, 11, 25
roi6: 161, 248, 39, 3
roi7: 120, 18, 39, 15
roi8: 83, 109, 11, 18
roi9: 161, 221, 35, 1

-wayne