Esempio n. 1
0
    def shortrepr(self):
        return "Uniform / " + self.stepper.shortrepr()


registeredclass.Registration(
    'Uniform',
    StepDriver,
    UniformDriver,
    ordering=2,
    params=[
        parameter.RegisteredParameter('stepper',
                                      TimeStepper,
                                      tip='Time stepping method.'),
        parameter.PositiveFloatParameter('stepsize',
                                         1.0,
                                         tip='Time step size.')
    ],
    tip="Take fixed, uniform timesteps.",
    discussion=xmlmenudump.loadFile(
        'DISCUSSIONS/engine/reg/uniformdriver.xml'))

#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

# "Basic" versions of the drivers don't require users to choose a
# stepping method.  They just have to select Static, Uniform or
# Adaptive, and provide a tolerance and min step size for Adaptive.


class BasicStepDriver(registeredclass.RegisteredClass):
    registry = []
Esempio n. 2
0
    def reset(self, continuing):
        self.count = 0
    def next(self):
        t = self.time0 + self.delay + self.count*self.interval
        self.count += 1
        return t
        
registeredclass.Registration(
    'Periodic',
    Schedule,
    Periodic,
    ordering=0,
    params=[
        parameter.NonNegativeFloatParameter(
            'delay', 0.0, tip='Time before the first output.'),
        parameter.PositiveFloatParameter(
            'interval', 0.0, tip='Time between outputs.')
        ],
    tip="Produce evenly spaced periodic output.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/periodicsched.xml'))


class Geometric(UnconditionalSchedule):
    def __init__(self, timestep, factor):
        self.timestep = timestep
        self.factor = factor
        self.nextstep = timestep
        self.lasttime = None
        UnconditionalSchedule.__init__(self)
    def reset(self, continuing):
        if not continuing:
            self.nextstep = self.timestep
Esempio n. 3
0
        self.radius = radius
        self.sigma = sigma

    def __call__(self, image):
        image.blur(self.radius, self.sigma)


registeredclass.Registration(
    'Blur',
    ImageModifier,
    BlurImage,
    ordering=2.00,
    params=[
        parameter.PositiveFloatParameter(
            'radius',
            1.0,
            tip="Radius of the Gaussian kernel, in voxel units."
            "The convolution kernel is zero beyond this radius."),
        parameter.PositiveFloatParameter(
            'sigma',
            1.0,
            tip="Standard deviation of the Gaussian, in voxel units.")
    ],
    tip=
    "Blur an image by convolving it with a Gaussian operator of the given radius and standard deviation (sigma).",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/image/reg/blurimage.xml'))

if config.dimension() == 2:

    class ContrastImage(ImageModifier):
        def __init__(self, sharpen):