Imglib2 rois status


I would like to inquire on the status of imglib2-roi:

  • Are they useable already?
  • Are there wrapper functions converting IJ1 Roi to the new ones?

Yes, and yes.

Until the documentation in imagej-tutorials is updated, please refer to the material of the ImageJ Scripting workshop at the I2K Conference in Heidelberg, in particular the code highlighted below:

Hope that helps.


Hi @imagejan, coming back to this, is there also something where one could draw such a ROI in BigDataViewer, in 2D? Doesn’t have to be production ready and stable code, just something that I could hack it into my own application.

1 Like

All the examples in @maarzt’s imagej-roi-course are using #bigdataviewer to show the results.

Displaying the new ImgLib2 ROIs in BDV is actually much easier than having to convert them back to display in the ImageJ 1.x user interface.


Didn’t seem to include something for drawing an ROI in BDV…

What do you mean by “drawing”?

For displaying:

For drawing/filling pixels covered by the ROI in an existing image, that’s unrelated to BigDataViewer, no?


As far as I know nothing change much within the last 2 years. The rois in imglib2 roi support:

  • Conversion to and from IJ1 Rois.
  • Combination by logic operations.
  • Geometrically shaped like rectangle, ellipsoid… rois.
  • Querying the bounding box.
  • Asking if a pixel is contained by the Roi.
  • Conversion to RandomAccesibleInterval (The RAI can then be displayed in BDV)

What I still miss, is the ability to interactively edit rois when displayed in BDV. But editing a roi in 3D is a complex task… just think of 3D CAD software, or 3D modeling software like Blender.


Drawing with my mouse…

1 Like

For me, currently 2D would be enough :slight_smile: But I guess that’s also quite some work already.

I would for now just use the IJ1 Rois.

Having BDV Rois would be amazing though :wink: But quite some infrastructure would have to be written for that. This 3D box which @tpietzsch implemented is the closest we have so far.


I don’t know the BDV internals well enough, but I guess it should be possible to implement a new mode, e.g. “edit mode”, listen to mouse click events, and relate the click coordinates to world coordinates (knowing the current view/transformation of the BDV panel). That should give you valid coordinates that are within the current view plane and are sufficient for a 2D ROI arbitrarily oriented in 3D space.

This surely is possible, but some work :slight_smile:

1 Like