Module ctsimu.processing.median
Expand source code
import os # File and path handling
import numpy
from ..image import *
from ..helpers import *
from .pipeline import Pipeline
from .step import Step
class Step_Median(Step):
""" Binning operation for the processing pipeline. """
def __init__(self, medianSize=3):
Step.__init__(self, "Median")
self.size = medianSize
def set_size(self, medianSize=3):
self.setPrepared(False)
self.size = medianSize
def getSize(self):
return self.size
def prepare(self):
""" Nothing to prepare for the binning module. """
if isinstance(self.pipe, Pipeline):
self.prepared = True
return
self.prepared = False
raise Exception("Step must be part of a processing pipeline before it can prepare.")
def run(self, image):
""" Bin given image. """
self.prepare()
image.applyMedian(kernelSize=self.size)
return image
Classes
class Step_Median (medianSize=3)
-
Binning operation for the processing pipeline.
Expand source code
class Step_Median(Step): """ Binning operation for the processing pipeline. """ def __init__(self, medianSize=3): Step.__init__(self, "Median") self.size = medianSize def set_size(self, medianSize=3): self.setPrepared(False) self.size = medianSize def getSize(self): return self.size def prepare(self): """ Nothing to prepare for the binning module. """ if isinstance(self.pipe, Pipeline): self.prepared = True return self.prepared = False raise Exception("Step must be part of a processing pipeline before it can prepare.") def run(self, image): """ Bin given image. """ self.prepare() image.applyMedian(kernelSize=self.size) return image
Ancestors
Methods
def getSize(self)
-
Expand source code
def getSize(self): return self.size
def prepare(self)
-
Nothing to prepare for the binning module.
Expand source code
def prepare(self): """ Nothing to prepare for the binning module. """ if isinstance(self.pipe, Pipeline): self.prepared = True return self.prepared = False raise Exception("Step must be part of a processing pipeline before it can prepare.")
def run(self, image)
-
Bin given image.
Expand source code
def run(self, image): """ Bin given image. """ self.prepare() image.applyMedian(kernelSize=self.size) return image
def set_size(self, medianSize=3)
-
Expand source code
def set_size(self, medianSize=3): self.setPrepared(False) self.size = medianSize
Inherited members