Login  Register

Suggestion: Should ImagePlus implement

Posted by Michael P Ellis on Dec 27, 2020; 11:55am
URL: http://imagej.273.s1.nabble.com/Notification-of-File-Save-tp5024300p5024321.html

Now that ImageJ is Java8 savvy would it be a good idea to make ImagePlus implement the AutoCloseable interface?

This would allow try with resources to be used e.g.


   try (ImagePlus imp = IJ.openImage(itemPath.toString())) {
     .
     .
     .
     << do lots of stuff with imp that may or may not throw exceptions>>
     .
   } // Autoclose imp

Same applies to any other ImageJ resources that have some close functionality.

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