The #@ decorator in Jython

Hello, I am av avid Python programmer and I have thus far successfully stayed mostly ignorant of Java. While checking out some of the example Jython code in FIJI I noticed a new kind of “decorator” at the top of the the Jython code. For instance the first lines of the Templates->ImageJ2->Apply DOG

#@ Dataset data
#@ Float(label="Sigma 1 (pixel)", required=true, value=4.2, stepSize=0.1) sigma1
#@ Float(label="Sigma 2 (pixel)", required=true, value=1.25, stepSize=0.1) sigma2
#@OUTPUT Dataset output
#@ OpService ops
#@ DatasetService ds

Last time I developed a Jython plugin I don’t think I ran in to this #@-type of “shebang line”. I kind of understand what it does and it’s super convenient that you don’t have to create a user input dialogue to get user input. However, it kind of bugs me that I don’t truly understand whats going on. There must be documentation for this feature, but since I don’t know what it’s called I’m a little stuck. Could someone point me towards some resource where I can read up on the #@-jython decorator thingy?


Hi @Oftakofta

What might make things tricky for you is that the underlying implementation of that functionality is in java, not python. The details implementation are in the scijava-common repo. And as you’ll see, this decorator is not jython specific.

Likely relevant source code:

If you havn’t seen it already, this wiki page has a description at the level appropriate for someone who will script using those features, but not work on the underlying features (i.e. for me).



Thanks @bogovicj. I second the suggestion to check out the Script Parameters page of

Just in case it’s not already clear: this feature is part of the SciJava script framework—not part of regular Jython. It is a preprocessing step where SciJava does input harvesting and variable injection into your script context, prior to actually running that script. Scripts with #@ and/or other SciJava preprocessing directives will not work as written when executed with standard Jython—only when executed through a SciJava application such as ImageJ/Fiji.



This was exactly what I was looking for, I had a feeling it was a Java-thingy.

1 Like