Re: print Roi?

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/print-Roi-tp5024487p5024490.html

Hi Kenneth,

the format of a .roi file is rather complex. I suspect that the
RoiDecoder [1] and RoiEncoder sources are the only documentation of the
.roi file format. You should better examine the RoiDecoder, which also
reads .roi files created by previous versions of ImageJ, while the
RoiEncoder only tells you the format of .roi files written by the
current version of ImageJ.

You can modify the ImageJ RoiDecoder class [1] to read a .roi file, but
it will a bit of work to get a stand-alone version.
The RoiDecoder class obviously refers to the Roi class (and its
subclasses) in many places, and with all the dependencies you would
essentially need all of ImageJ. So you will need quite a few modifications.

By the way, if this helps, you can also zip a collection of .roi files
and drag&drop it onto ImageJ, you will then get them in the Roi Manager.
Then do with the Rois in the RoiManager whatever you like.

[1] https://github.com/imagej/imagej1/blob/master/ij/io/RoiDecoder.java

Michael
________________________________________________________________
On 03.03.21 18:02, Kenneth Sloan wrote:

> Thank you for the reply.
>
> Answering my own question - I eventually found a demonstration macro, from which I extracted this:
>
> ================
> Roi.getCoordinates(x,y);
> print("ROI coordinates");
> for (i=0;i<x.length; i++)
>    print(i,x[i],y[i]);
> ================
>
> I would have preferred a stand-alone (preferably Java) program to read the .roi file and print the coordinates, but for my current purposes it was acceptable to drag&drop the .roi files onto a running FIJI and then run the above  macro.  I only had 10 files to process, so doing this manually was acceptable.
>
> Actually, I was trying to montage several data files, where the raw  data  consisted of:
>
> a) a .csv file giving coordinates for points to be plotted
> b) an .roi file giving the location and boundary of the sampled area
>
> Where the points in a) were expressed in local coordinate systems, relative to the top, left corner of the Roi.
>
> Alas, I had no control over the data collection.
>
> I would have preferred to write a stand-along Java program to read a collection of these raw data file pairs, but could not find information on the file format for an .roi file.
>
> Is there  documentation on the format of an .roi file?
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
>
>
>
>
>> On Mar 2, 2021, at 22:52, Fred Damen <[hidden email]> wrote:
>>
>> Greeting Kenneth,
>>
>> Analyze>Tools>ROI Manager::More>>open...
>> ::Properties::List Coordinates then OK
>> Note: On a Oval ROI the listed coordinates are an interpolated version of
>> the displayed vertices.
>> FloatPolygon fp = Roi.getFloatPolygon();
>> If you want to read the actual .roi file and list the contents, there are
>> MATLAB scripts out there that do this, i.e., easy to read.
>>
>> ::More>>::List
>> This answers one of my previous bonus questions, i.e., GUI display of
>> bounding box in voxel/pixel coordinates.
>>
>> Fred
>>
>> Produces the definition of the
>> On Tue, March 2, 2021 4:04 pm, Kenneth Sloan wrote:
>>> I have many (polygon) ROIs stored as .roi files.
>>>
>>> How can I print the coordinates of the vertices of the ROI?
>>>
>>> --
>>> Kenneth Sloan
>>> [hidden email]
>>> Vision is the art of seeing what is invisible to others.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html