Package omero.grid

Class Param

  • All Implemented Interfaces:
    Ice.Object, java.io.Serializable, java.lang.Cloneable

    public class Param
    extends Ice.ObjectImpl
    A single parameter to a Job. For example, used by ScriptJobs to define what the input and output environment variables should be. Helper classes are available in the Python omero.scripts module, so that the following are equivalent:
    # 1
     a = omero.grid.Params()
     a.optional = True
     a.prototype = omero.rtypes.rstring("")
     a.description = "An optional string which will be ignored by the script"
     omero.scripts.client(inputs = {"a":a})
     
    # 2
     a = omero.scripts.String("a", optional=True, description=         * "An optional string which will be ignored by the script")
     omero.scripts.client(a)
     
    For advanced setters not available on the Type classes (like omero.script.String) use the getter type.param() and then set values directly.
     a = omero.scripts.String("a")
     a.param().values = \["hi", "bye"]
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] __ids  
      java.lang.String description
      Usage documentation of this param for script users.
      java.lang.String grouping
      Defines the grouping strategy for this Param.
      RType max
      Maximum value which an input may contain.
      RType min
      Minimum value which an input may contain.
      java.util.List<java.lang.String> namespaces
      Defines machine readable interpretations for this parameter.
      boolean optional
      Whether or not a script will require this value to be present in the input or output.
      RType prototype
      RType which represents what the input or output value should look like.
      static long serialVersionUID  
      boolean useDefault
      Whether or not the prototype should be used as a default.
      RList values
      An enumeration of acceptable values which can be used for this parameter.
      • Fields inherited from interface Ice.Object

        ice_staticId
    • Constructor Summary

      Constructors 
      Constructor Description
      Param()  
      Param​(java.lang.String description, boolean optional, boolean useDefault, RType prototype, RType min, RType max, RList values, java.lang.String grouping, java.util.List<java.lang.String> namespaces)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void __readImpl​(IceInternal.BasicStream __is)  
      protected void __writeImpl​(IceInternal.BasicStream __os)  
      Param clone()  
      static Ice.ObjectFactory ice_factory()  
      java.lang.String ice_id()  
      java.lang.String ice_id​(Ice.Current __current)  
      java.lang.String[] ice_ids()  
      java.lang.String[] ice_ids​(Ice.Current __current)  
      boolean ice_isA​(java.lang.String s)  
      boolean ice_isA​(java.lang.String s, Ice.Current __current)  
      static java.lang.String ice_staticId()  
      • Methods inherited from class Ice.ObjectImpl

        ___ice_id, ___ice_ids, ___ice_isA, ___ice_ping, __checkMode, __dispatch, __read, __read, __readImpl, __write, __write, __writeImpl, ice_dispatch, ice_dispatch, ice_operationAttributes, ice_ping, ice_ping, ice_postUnmarshal, ice_preMarshal
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • __ids

        public static final java.lang.String[] __ids
      • description

        public java.lang.String description
        Usage documentation of this param for script users. Example of a bad description: ""a long value"" Example of a good description: ""long representing the number of bins to be used by . A sensible value would be between 16 and 32""
      • optional

        public boolean optional
        Whether or not a script will require this value to be present in the input or output. If an input is missing or None when non-optional, then a ValidationException will be thrown on processJob. A missing output param will be marked after execution.
      • useDefault

        public boolean useDefault
        Whether or not the prototype should be used as a default. If true, then if the value is missing from the input OR output values, the prototype will be substituted.
         param = ...;
         inputs = ...;
         if name in inputs:
         value = inputs\[name]
         elif param.inputs\[name].useDefault:
         value = param.inputs\[name].prototype
         
      • prototype

        public RType prototype
        RType which represents what the input or output value should look like. If this is a collection type (i.e. RCollection or RMap or their subclasses), then the first contents of the collection will be used (recursively).
         param.prototype = rlist(rlist(rstring)))
         
        requires that a list of list of strings be passed.
      • min

        public RType min
        Minimum value which an input may contain. If the prototype is a collection type, then the min type must match the type of the innermost non-collection instance. For example,
         param.prototype = rlong(0)
         param.min = rlong(-5)
         
        but
         param.prototype = rlist(rlong(0))
         param.min = rlong(-5)
         
      • max

        public RType max
        Maximum value which an input may contain. If the prototype is a collection type, then the max type must match the type of the innermost non-collection instance. For example,
         param.prototype = rlong(0)
         param.max = rlong(5)
         
        but
         param.prototype = rlist(rlong(0))
         param.max = rlong(5)
         
      • values

        public RList values
        An enumeration of acceptable values which can be used for this parameter. If min and max are set, this value will be ignored. If prototype is an RCollection or RMap instance, then the values in this RList will be of the member types of the collection or map, and not a collection or map instance.
      • grouping

        public java.lang.String grouping
        Defines the grouping strategy for this Param.

        A set of Param objects in a single JobParams can use dot notation to specify that they belong together, and in which order they should be presented to the user.

         inputs = {"a" : Param(..., grouping = "1.1"),
         "b" : Param(..., grouping = "1.2"),
         "c" : Param(..., grouping = "2.2"),
         "d" : Param(..., grouping = "2.1")}
         
        defines two groups of parameters which might be display to the user so:
         Group 1:                  Group 2:
         +-----------------------+ +-----------------------+
         | a:                    | | d:                    |
         +-----------------------+ +-----------------------+
         | b:                    | | c:                    |
         +-----------------------+ +-----------------------+
         

        Further dots (e.g. "1.2.3.5") can be used to specify deeper trees of parameters.

        By most clients, Params missing grouping values (e.g. "") will be ordered after params with grouping values.

        A group which has a boolean as the top-level object can be thought of as a checkbox which turns on or off all of the other group members. For example,

         inputs = {"Image_Ids" : Param(prototype=rlist(), grouping = "1"),
         "Scale_Bar" : Param(prototype=rbool(), grouping = "2"),
         "Color"     : Param(prototype=rinternal(Color()), grouping = "2.1"),
         "Size"      : Param(prototype=rlong(), grouping = "2.2")}
         

        might be displayed as:

        
         Scale Bar: \[ on/off ]
         ======================
         Color:  \[rgb]
         Size:   \[ 10]
        
         
      • namespaces

        public java.util.List<java.lang.String> namespaces
        Defines machine readable interpretations for this parameter.

        Where the description field should provide information for users, the assigned namespaces can define how clients may interpret the param.

        omero.constants.namespaces.NSDOWNLOAD, for example, indicates that users may want to download the resulting file. The prototype of the Param should be one of: OriginalFile, FileAnnotation, or an annotation link (like ImageAnnotationLink) which points to a file annotation.

    • Constructor Detail

      • Param

        public Param()
      • Param

        public Param​(java.lang.String description,
                     boolean optional,
                     boolean useDefault,
                     RType prototype,
                     RType min,
                     RType max,
                     RList values,
                     java.lang.String grouping,
                     java.util.List<java.lang.String> namespaces)
    • Method Detail

      • ice_factory

        public static Ice.ObjectFactory ice_factory()
      • ice_isA

        public boolean ice_isA​(java.lang.String s)
        Specified by:
        ice_isA in interface Ice.Object
        Overrides:
        ice_isA in class Ice.ObjectImpl
      • ice_isA

        public boolean ice_isA​(java.lang.String s,
                               Ice.Current __current)
        Specified by:
        ice_isA in interface Ice.Object
        Overrides:
        ice_isA in class Ice.ObjectImpl
      • ice_ids

        public java.lang.String[] ice_ids()
        Specified by:
        ice_ids in interface Ice.Object
        Overrides:
        ice_ids in class Ice.ObjectImpl
      • ice_ids

        public java.lang.String[] ice_ids​(Ice.Current __current)
        Specified by:
        ice_ids in interface Ice.Object
        Overrides:
        ice_ids in class Ice.ObjectImpl
      • ice_id

        public java.lang.String ice_id()
        Specified by:
        ice_id in interface Ice.Object
        Overrides:
        ice_id in class Ice.ObjectImpl
      • ice_id

        public java.lang.String ice_id​(Ice.Current __current)
        Specified by:
        ice_id in interface Ice.Object
        Overrides:
        ice_id in class Ice.ObjectImpl
      • ice_staticId

        public static java.lang.String ice_staticId()
      • __writeImpl

        protected void __writeImpl​(IceInternal.BasicStream __os)
        Overrides:
        __writeImpl in class Ice.ObjectImpl
      • __readImpl

        protected void __readImpl​(IceInternal.BasicStream __is)
        Overrides:
        __readImpl in class Ice.ObjectImpl
      • clone

        public Param clone()
        Specified by:
        clone in interface Ice.Object
        Overrides:
        clone in class Ice.ObjectImpl