Difference: DpHipeTools (63 vs. 64)

Revision 642011-03-22 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="WritingTasks"

Adding Tools to HIPE

Line: 58 to 58
  toolRegistry.register(compute, [Category.IMAGE, Category.PACS]))
Deleted:
<
<
Your task is now enabled whenever the users selects a session variable of the same type as the first input parameter of your task.
 To define the prime parameter, modify your task constructor as follows:
    class ComputeTask extends Task {

Line: 72 to 70
  }
Added:
>
>
For your task to appear in the Applicable category whenever the user selects a suitable variable, you still need to define a Validator. See Validating prime input below.
 

Tasks Naming Conventions

Tasks registered in HIPE should follow the naming conventions shown in this example:

Line: 84 to 84
 

Validating prime input

Changed:
<
<
If you followed the instructions in the previous section, your task now appears in the Applicable category of the Tasks view whenever a variable of the same type as the prime input is selected.
>
>
In most cases, the type of the prime input is not enough to determine whether a task is applicable to a variable. Your task may only run on a SpecificProduct if it contains certain contents: a typical example is a SPIRE task operating on an ObservationContext: clearly, such task should not be listed when a HIFI observation is selected.
 
Changed:
<
<
Sometimes this may not be enough. Your task may only run on a SpecificProduct if it contains certain contents: a typical example is a SPIRE task operating on an ObservationContext: clearly, such task should not be listed when a HIFI observation is selected.

To restrict a task to certain product contents, write a ParameterValidator:

>
>
This is why you must write a ParameterValidator to restrict a task to certain product contents:
 
    prime = new TaskParameter("spectrum", SpecificProduct.class)
    prime.setParameterValidator(new ParameterValidatorAdapter() {

Line: 102 to 100
 

Note how the validation logic is now within the parameter validation block, rather than in the preamble or execution block of your task. One advantage is that the execution block of your task can concentrate on the core algorithm.

Added:
>
>
A validator is mandatory for the task to appear in the Applicable category of the Tasks view. If your task really is very general and applies to a given variable type with no exceptions, write a dummy validator that always accepts input values.
 

Task dialogue windows

 
This site is powered by the TWiki collaboration platform Powered by Perl