Project

General

Profile

Refine Refactor documentation » History » Version 13

Amber Herold, 08/02/2011 05:47 PM

1 11 Amber Herold
h1. Refinement Web User Interface documentation
2 2 Amber Herold
3 5 Amber Herold
4
h2. Class Diagram
5
6
The following class diagram shows the BasicForm class with it's extended classes as well as the FormParameter class and it's extended classes.
7 1 Amber Herold
It also shows associations among the classes.
8
Notice that the specific refine parameter classes use polymorphism to override the validate() function. This allows the extended classes to provide more complex validations than a typical form requires.
9
Other forms, such as RunParameters and stack prep, just use the base FormParameters class that their parent, BasicForm, uses.
10
11
!refineClassDiagram.png!
12 10 Amber Herold
13
h2. Sequence Diagram
14
15
The following sequence diagram shows how the Form and Parameter classes work together to display a form, validate the user input, and create a command string.
16
17
!refine_sequence_diagram.png!
18 6 Amber Herold
19
h2. Steps to add a new refinement method to the pipeline
20
21
# Create a new class which extends BasicRefineForm
22
# Create a new class which extends RefineFormParameters. This is optional, but recommended.
23
# Decide what information you need to collect from the user and add a form parameter for each item.
24
## example: adding parameters to a new parameter class
25
### note that the parent constuctor is called first, passing any default values along. The RefineFormParameters base class defines parameters that are common to most refinement methods. You only need to add parameters that are not already defined in the base class.
26
### use the addParam(name, value, label) method to add parameters specific to your refine method to your form.
27
### if you find that the base class includes a parameter that your method does not need, you can remove the parameter from the form with the hideParam(name) method.
28
<pre>
29
class XmippParams extends RefineFormParameters
30
{
31
	function __construct( $id='', $label='', $outerMaskRadius='', $innerMaskRadius='', $outerAlignRadius='', 
32
							$innerAlignRadius='', $symmetry='', $numIters='', $angSampRate='', $percentDiscard='',  
33
							$filterEstimated='', $filterResolution='', $filterComputed='', $filterConstant='',
34
							$mask='', $maxAngularChange='', $maxChangeOffset='', $search5DShift='', $search5DStep='',
35
							$reconMethod='', $ARTLambda='', $doComputeResolution='', $fourierMaxFrequencyOfInterest='' ) 
36
	{
37
		parent::__construct($id, $label, $outerMaskRadius, $innerMaskRadius, $outerAlignRadius, 
38
							$innerAlignRadius, $symmetry, $numIters, $angSampRate, $percentDiscard,  
39
							$filterEstimated, $filterResolution, $filterComputed, $filterConstant );
40
									
41
		$this->addParam( "mask", $mask, "Mask filename" );
42
		$this->addParam( "maxAngularChange", $maxAngularChange, "Max. Angular change " );		
43
		$this->addParam( "maxChangeOffset", $maxChangeOffset, "Maximum change offset " );
44
		$this->addParam( "search5DShift", $search5DShift, "Search range for 5D translational search " );
45
		$this->addParam( "search5DStep", $search5DStep, "Step size for 5D translational search " );
46
		$this->addParam( "reconMethod", $reconMethod, "Reconstruction method " );
47
		$this->addParam( "ARTLambda", $ARTLambda, "Values of lambda for ART " );
48
		$this->addParam( "doComputeResolution", $doComputeResolution, "Compute resolution? " );
49
		$this->addParam( "fourierMaxFrequencyOfInterest", $fourierMaxFrequencyOfInterest, "Initial maximum frequency used by reconstruct fourier " );
50
		
51
		// disable any general params that do not apply to this method
52
		$this->hideParam("innerMaskRadius");		
53
	}
54
	
55
	function validate() 
56
	{
57
		$msg = parent::validate();
58
59
		if ( !empty($this->params["mask"]["value"]) && !empty($this->params["outerMaskRadius"]["value"]) )
60
			$msg .= "<b>Error:</b> You may not define both the outer mask raduis and a mask file.";
61
				
62
		return $msg;
63
	}
64
}
65
</pre>
66 7 Amber Herold
## example: adding parameters to the form constructor method
67
# define any restrictions that should be applied to the parameters.
68 9 Amber Herold
# Override the advancedParamForm() function to add a user input field for each one.
69
# Override the buildCommand() function. There is a default implementation available which adds all form parameters as --<name>=<value>.
70 12 Amber Herold
# create your new form type in selectPreparedRecon.php
71
<pre>
72
// based on the type of refinement the user has selected,
73
// create the proper form type here. If a new type is added to
74
// Appion, it's form class should be included in this file
75
// and it should be added to this function. No other modifications
76
// to this file should be necessary.
77
function createSelectedRefineForm( $method, $stacks='', $models='' )
78
{
79
	switch ( $method ) {
80
		case emanrecon:
81
			$selectedRefineForm = new EmanRefineForm( $method, $stacks, $models );
82
			break;
83
		case frealignrecon:
84
			$selectedRefineForm = new FrealignRefineForm( $method, $stacks, $models );
85
			break;
86
		case xmipprecon:
87
			$selectedRefineForm = new XmippRefineForm( $method, $stacks, $models );
88
			break;
89
		case xmippml3drecon:
90
			$selectedRefineForm = new XmippML3DRefineForm( $method, $stacks, $models );
91
			break;
92
		default:
93
			Throw new Exception("Error: Not Implemented - There is no RefineForm class avaialable for method: $method"); 
94
	}		
95
	
96
	return $selectedRefineForm;
97
}
98
</pre>
99 13 Amber Herold
# Add an entry to selectRefinementType.php for the new method.