# Projects:RegistrationImprovement:RecursiveScheme

Home < Projects:RegistrationImprovement:RecursiveScheme

Both multi-resolution and the sequence of calls with increasing DOF could be implemented as a single recursive scheme. The caller provides an array of DOF and a matching array of resolution levels, which is processed by recursive calls with the first/last element taken from the list.

This would avoid multiple instances of pipelines to anticipate all the combinations that may occur. While it is safe to assume that noone will call a lower DOF alignment after having run a higher one, skipping lower DOF initializations does commonly occur, e.g. when a previous alignment has been obtained elsewhere or in other runs.

This should also allow a single GUI for all instances. We can list the many combination as a single list of checkboxes for increasing DOF. The checked boxes then provide the input string for the recursive call. Example mockup shown here: Presets as discussed can still be used and individual GUI widgets hidden or disabled. For example an "affine robust" would use [6,9,12] DOF sequence with higher associated multi-resolution settings, whereas an "affine direct" would have only [12] in the sequence.

• A Matlab program simulating the recursive scheme is here: Media:DOFHierarchy.m
• Example call: the 256 symbolizes the image data size, [6,9,12] is the sequence of DOF, NoInit is the initial transform (if avail), and [4,3,2] are the multi-resolution levels for each of the DOF runs, respectively.
``` a = DOFHierarchy(256, [6,9,12],'NoInit',[4,3,2],0)

running registration for 32 image at 6 DOF with init NoInit
running registration for 64 image at 6 DOF with init result from 6 DOF run @ 32
running registration for 128 image at 6 DOF with init result from 6 DOF run @ 64
running registration for 256 image at 6 DOF with init result from 6 DOF run @ 128

running registration for 64 image at 9 DOF with init result from 6 DOF run @ 256
running registration for 128 image at 9 DOF with init result from 9 DOF run @ 64
running registration for 256 image at 9 DOF with init result from 9 DOF run @ 128

running registration for 128 image at 12 DOF with init result from 9 DOF run @ 256
running registration for 256 image at 12 DOF with init result from 12 DOF run @ 128

a =result from 12 DOF run @ 256

```
• Same example call with verbose flag set, showing the function calls:
``` a = DOFHierarchy(256, [6,9,12],'NoInit',[4,3,2],1)
>>RunAlignment(256, 6,NoInit,4)
input data size 256. smooth & subsample
>>RunAlignment(128, 6,NoInit,3)
input data size 128. smooth & subsample
>>RunAlignment(64, 6,NoInit,2)
input data size 64. smooth & subsample
>>RunAlignment(32, 6,NoInit,1)
running registration for 32 image at 6 DOF with init NoInit
running registration for 64 image at 6 DOF with init result from 6 DOF run @ 32
running registration for 128 image at 6 DOF with init result from 6 DOF run @ 64
running registration for 256 image at 6 DOF with init result from 6 DOF run @ 128
DOFHierarchy (256 , [6,9,12,], NoInit )
>>RunAlignment(256, 9,result from 6 DOF run @ 256,3)
input data size 256. smooth & subsample
>>RunAlignment(128, 9,result from 6 DOF run @ 256,2)
input data size 128. smooth & subsample
>>RunAlignment(64, 9,result from 6 DOF run @ 256,1)
running registration for 64 image at 9 DOF with init result from 6 DOF run @ 256
running registration for 128 image at 9 DOF with init result from 9 DOF run @ 64
running registration for 256 image at 9 DOF with init result from 9 DOF run @ 128
>>DOFHierarchy (256 , [9,12,], result from 6 DOF run @ 256 )
>>RunAlignment(256, 12,result from 9 DOF run @ 256,2)
input data size 256. smooth & subsample
>>RunAlignment(128, 12,result from 9 DOF run @ 256,1)
running registration for 128 image at 12 DOF with init result from 9 DOF run @ 256
running registration for 256 image at 12 DOF with init result from 12 DOF run @ 128

a =result from 12 DOF run @ 256
```