def __init__(self, initializer={}):
     self.__types = OrderedDict(self.typemap())
     for t in self.__types.values():
         if t not in validators and not hasattr(t, 'validator'):
             raise RuntimeError('no validator for type %s' % (t, ))
     ## initialize all items defined by typemap
     complete_init = OrderedDict(initializer)
     for key, value in self.__types.items():
         if key not in initializer:
             complete_init[key] = None
     super(TypedDict, self).__init__(complete_init)
blobsm = commonsteps.ImageMarker('blobsm')
blobsm.setDependency('image', input)
blobsm.setDependency('points', blobs)

latfilt = commonsteps.LatticeFilter('lattice')
latfilt.setDependency('input', blobs)

latm = commonsteps.ImageMarker('latm')
latm.setDependency('image', input)
latm.setDependency('points', latfilt)

# first a list of steps
templatefinder = [
    input,
    template,
    tempcor,
    threshold,
    blobs,
    blobsm,
    latfilt,
    latm,
]

# then an ordered dict
templatefinder = OrderedDict([(step.name, step) for step in templatefinder])

if __name__ == '__main__':
    test = workflow.WorkflowCLI(templatefinder)
    test.loop()
Example #3
0
                return results

##############################################################
###  Create instances of those classes and build my workflow.
###  Also using the class InputImage from commonsteps.py
##############################################################

## The complete workflow will contain 4 steps.  I create the instances and
## give them each a unique name.
input = commonsteps.ImageInput('input')
rotate = RotN90('rotate')
maximum = MaximumPixel('maximum')
shift = Shifter('shift')

## connect them together properly:
rotate.setDependency('image', input)
maximum.setDependency('image', rotate)
shift.setDependency('points', maximum)

## Group them together into a container.  Use our OrderedDict class:
myworkflow = OrderedDict()
myworkflow['input'] = input
myworkflow['rotate'] = rotate
myworkflow['maximum'] = maximum
myworkflow['shift'] = shift

## Now we have a complete workflow.  We can plug it into Leginon (not yet)
## Or we can test it using our command line interface...
test = workflow.WorkflowCLI(myworkflow)
test.loop()
 def types(self):
     return OrderedDict(self.__types)