[ImageJ-devel] how to get current ImageJ context in ImageJ 2

Lee Kamentsky leek at broadinstitute.org
Tue Apr 10 14:43:43 CDT 2012


I think having a script-accessible ImageJ context variable is the 
cleanest. It's kind of neat that you can get two going at once and maybe 
we could even have a method to make a headless context? There have got 
to be cases where people want to script up a gigantic mess and let all 
of it except an output dataset fall on the floor by scoping it within a 
disposable context.

Also, the context is quickly becoming ubiquitously available (you can 
get it from any display or any event) so the static calls are quickly 
disappearing from the code and the appropriate thing to do when coding 
is to use the objects in the local scope to get the services.

On 4/10/2012 3:35 PM, Johannes Schindelin wrote:
> Hi,
>
> On Tue, 10 Apr 2012, Curtis Rueden wrote:
>
>> Hi Albert,
>>
>>> Does this mean that a scripting interpreter will have to declare,
>>> internally, a variable that points to the ImageJ context?
>> Yeah, the idea is that when you run a script, the context will be injected
>> somehow. The scripts themselves will not need to care, of course. Probably
>> the scripting framework will provide a setContext(ImageJ) method for such a
>> purpose, and its logic will fail (with an informative exception) if the
>> current context is null.
> FWIW I am thinking more like injecting a script-global variable called
> 'context'.
>
> Ciao,
> Dscho
>
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagej.net
> http://imagej.net/mailman/listinfo/imagej-devel




More information about the ImageJ-devel mailing list