Converting ROI files into vector format, ESRI shapefiles or ENVI .roi format


Does anyone here familiar with Geographical Information System (GIS) files format shapefiles (.shp) by ESRI software or .roi by ENVI remote sensing software. ENVI also support .roi as vector file format, but when i try to open the roi files ImageJ it says it does not supported. I need to get the segmented watershed (.roi) as polygon vector. I appreciate if anyone has knowledge in GIS and remote sensing background could assist me in this.

Thanks very much

Do you mean to convert a ImageJ ROI to a shapefile?

I have written a special ROI exporter in Bio7 which uses R to convert ImageJ ROI’s to SpatialPolygons(Dataframe), SpatialPoints(DataFrame), etc.

With this functions you can extract easily image selection data (ROI’s from particle analysis data, classification data, thresholded areas, multiple selections) with ImageJ and transfer it to R.

The extracted polygons can be georeferenced again with the original image (see video tutorial).

Then the polygon can be saved to a *.shp file, etc., with the help of R, see:

See also (using the R packages sp, maptools and rgdal):

(lines can be replaced with polygons. Same action.)

For an overview using R as a GIS, see:


This is exactly what i’m looking for! And im sooo glad it’s written with R which i am more familiar with. Thanks sooo much for your answer and sharing this. You just save my day and time!


my image requires bioformats plugin to open the image. How to load the image using this plugin in bio7?

You have to download and put the Bioformats library (bioformats_package.jar) in the embedded ImageJ plugins folder, location:


Then you have to make an windowless import (The AWT GUI will not work. This is fixed in the current ImageJ plugin release and will be available in the next Bio7 release):

Plugins->Import->Bioformats (Windowless)

But I wonder which file format do you use that you are in need of the Bioformats library?


Sorry for the late reply. My raster file format is tiff file format. Even directly using ImageJ also requires bio-formats to import the image. Managed to import the roi to shapefiles format using your roi exporter in bio7. It works just fine.

Please note that the *.tiff (Geotiff) image data (without the georeference) can be opened directly with ImageJ without the bioformats library (e.g., just drag it on the ImageJ view panel).

Apropos if you need a visualization in 3D (a kind of nice plot with your data on a virtual globe) note that Bio7 also includes the gdal library (which also can be used from within Bio7 programmatically).

If you open your raster file in the WorldWind perspective it can be visualized georeferenced on the globe,

1 Like

Hi there
I am at the stage where I can create the polygons (and export them), and I am very familiar with ImageJ.
What I cant do though, is georeference the resulting polygons, even though I have both a world file from the existing geoTiff, and access to self-made GCP’s in mapinfo or google earth.

I am not that familiar with R, so is there an easy tutorial on how to georeference the resulting polygons, using known coordinates?

Kind regards

btw imageJ cant open a geotiff/tif as it is. The error description is: ImageJ cant open tiled tiffs.

The bioformats plugin doesnt work either as it says it requires java 1.7 and states that the computer only has 1.6 (even though its not the case).

Do you speak about Bio7 ( or ImageJ? Please note that Bio7 comes bundled with Java 1.8.x. Which OS are you using?

Maybee you confuse ImageJ with Bio7 which this thread is about.

OK, you have a tiled .tif. ImageJ can’t open tiled.tif files but general *.geotiffs.

Bioformats won’t work either because it’s not a library for special GIS files. Couldn’t you convert the tiled *.tif to a single image *.tif?

If you can post an example it makes things easier to analyze.

To georeference a polygon in R see (coordinates):

The video posted earlier shows how to export ImageJ ROI’s in Bio7 georeferenced with the help of a (single) geotiff.

Useful packages in R to read geotiffs are raster and rgdal, for an example, see:

Another useful package is gdalutils which embeds the gdalwarp function for conversion of files: