[ImageJ-devel] loading imageJ instance with full Services
Johannes Schindelin
Johannes.Schindelin at gmx.de
Thu Jul 4 10:34:09 CDT 2013
Hi Mohamed,
On Thu, 4 Jul 2013, Mohamed Tleis wrote:
> public class launchij2 {
> launchij2()
> {
> ImageJ ij = new ImageJ();
> ij = imagej.Main.launch();
> }
Please note that it is definitely *not* recommended coding style to do
this in a constructor. A constructor is intended to initialize the object
for computation, not to perform computation (or in this case, show the
UI).
I'm just saying this so forcefully because I have a hunch that I'll help
you more in the future, and I'd rather see elegant code in the process ;-)
Also, please note that the first line (ImageJ ij = new ImageJ()) creates
an ImageJ context, but never uses it! So you might just as well skip that
instantiation because the next line (ij = imagej.Main.launch()) creates
*another* context and uses that to show the UI.
Ciao,
Johannes
More information about the ImageJ-devel
mailing list