Esempio n. 1
0
def convolveDisk(bimage, radius, convolve_t, testlog):
    #make  disk binaray image
    disk = makeDisk(radius)
    diskshape = numpy.shape(disk)

    # convolve
    c = convolver.Convolver()
    intimage = bimage.astype(numpy.int8)
    c.setKernel(disk)
    cmask = c.convolve(image=intimage)

    # convolve two disks to get maximum correlation
    c = convolver.Convolver()
    c.setKernel(disk)
    cref = c.convolve(image=disk)
    testlog = outputTestImage(cmask, 'maskc', 'Convolved filled edge mask',
                              testlog)

    # Thresholding to binary mask
    cmax = cref.max() * convolve_t
    masked_cmask = ma.masked_greater(cmask, cmax)
    mask = ma.getmask(masked_cmask)
    testlog = outputTestImage(mask, 'maskct', 'Thresholded Convolved mask',
                              testlog)
    return mask, testlog
 def __init__(self, node):
     self.node = node
     ## if tilts are below these thresholds, no need to correct
     self.alpha_threshold = 0.02
     self.bt_threshold = 0.000001
     gauss = convolver.gaussian_kernel(2.0)
     self.filter = convolver.Convolver(kernel=gauss)
    def __init__(self):
        ## These are the results that are maintained by this
        ## object for external use through the __getitem__ method.
        self.__results = {
            'original': None,
            'template': None,
            'correlation': None,
            'threshold': None,
            'blobs': None,
            'vector': None,
            'lattice': None,
            'holes': None,
            'markedholes': None,
            'holes2': None,
            'markedholes2': None,
        }

        ## This defines which dependent results should be cleared
        ## when a particular result is updated.
        ## Read this as:
        ##  If you update key, clear everything in the dependent tuple
        self.__dependents = {
            'original': ('correlation', ),
            'template': ('correlation', ),
            'correlation': ('threshold', 'blobs'),
            'threshold': ('blobs', 'vector'),
            'blobs': ('lattice', ),
            'vector': ('lattice', ),
            'lattice': ('holes', ),
            'holes': ('holes2', 'markedholes'),
            'markedholes': (),
            'holes2': ('markedholes2', ),
            'markedholes2': (),
        }

        ## other necessary components
        self.convolver = convolver.Convolver()
        self.peakfinder = peakfinder.PeakFinder()
        self.circle = CircleMaskCreator()
        self.icecalc = ice.IceCalculator()

        ## some default configuration parameters
        self.save_mrc = False
        self.template_config = {'ring_list': [(25, 30)]}
        self.correlation_config = {'cortype': 'cross', 'corfilt': (1.0, )}
        self.threshold = 3.0
        self.threshold_method = "Threshold = mean + A * stdev"
        self.blobs_config = {'border': 20, 'maxblobsize': 50, 'maxblobs': 100}
        self.lattice_config = {
            'tolerance': 0.1,
            'vector': 100.0,
            'minspace': 20,
            'extend': 'off'
        }
        self.holestats_config = {'radius': 20}
        self.ice_config = {'i0': None, 'min': 0.0, 'max': 0.1, 'std': 0.05}
    def __init__(self):
        ## These are the results that are maintained by this
        ## object for external use through the __getitem__ method.
        self.__results = {
            'original': None,
            'edges': None,
            'template': None,
            'correlation': None,
            'threshold': None,
            'blobs': None,
            'holes': None,
            'markedholes': None,
        }

        ## This defines which dependent results should be cleared
        ## when a particular result is updated.
        ## Read this as:
        ##  If you update key, clear everything in the dependent tuple
        self.__dependents = {
            'original': ('edges', ),
            'edges': ('correlation', ),
            'template': ('correlation', ),
            'correlation': ('threshold', ),
            'threshold': ('blobs', ),
            'blobs': (),
            'holes': ('markedholes', ),
            'markedholes': (),
        }

        ## other necessary components
        self.edgefinder = convolver.Convolver()
        self.peakfinder = peakfinder.PeakFinder()
        self.circle = CircleMaskCreator()
        self.oval = OvalMaskCreator()
        self.icecalc = ice.IceCalculator()

        ## some default configuration parameters
        self.save_mrc = False
        self.edges_config = {
            'filter': 'sobel',
            'size': 9,
            'sigma': 1.4,
            'abs': False,
            'lp': True,
            'lpsig': 1.0,
            'thresh': 100.0,
            'edges': True
        }
        self.template_config = {'ring_list': [(25, 30)], 'tilt_axis': 0.0}
        self.correlation_config = {'cortype': 'cross', 'corfilt': (1.0, )}
        self.threshold = 3.0
        self.blobs_config = {'border': 20, 'maxblobsize': 50, 'maxblobs': 100}
        self.makeblobs_config = {'center_list': [(100, 100)]}
        self.dist_config = {'binned_pixel': 2e-10}
        self.pickhole_config = {'center_list': [(100, 100)]}
        self.holestats_config = {'radius': 20}
Esempio n. 5
0
def filterImg(img, apix, bin, rad):
    # low pass filter image to res resolution
    if rad == 0:
        print " ... skipping low pass filter"
        return (img)
    else:
        print " ... performing low pass filter"
        sigma = float(rad) / apix / 3.0 / float(bin)
        kernel = convolver.gaussian_kernel(sigma)
    c = convolver.Convolver()
    return (c.convolve(image=img, kernel=kernel))
Esempio n. 6
0
    def __init__(self, id, session, managerlocation, **kwargs):
        self.mosaicselectionmapping = {}
        targetfinder.ClickTargetFinder.__init__(self, id, session,
                                                managerlocation, **kwargs)
        self.calclients = {
            'image shift':
            calibrationclient.ImageShiftCalibrationClient(self),
            'stage position':
            calibrationclient.StageCalibrationClient(self),
            'modeled stage position':
            calibrationclient.ModeledStageCalibrationClient(self)
        }
        self.images = {
            'Original': None,
            'Extra Crispy': None,
            'Filtered': None,
            'Thresholded': None
        }
        parameter = self.settings['calibration parameter']
        self.mosaic = mosaic.EMMosaic(self.calclients[parameter])
        self.mosaicimagelist = None
        self.mosaicimage = None
        self.mosaicimagescale = None
        self.mosaicimagedata = None
        self.convolver = convolver.Convolver()
        self.currentposition = []
        self.mosaiccreated = threading.Event()
        self.presetsclient = presets.PresetsClient(self)

        self.mosaic.setCalibrationClient(self.calclients[parameter])

        self.existing_targets = {}
        self.clearTiles()

        self.reference_target = None

        if self.__class__ == MosaicClickTargetFinder:
            self.start()
 def __init__(self):
         self.peakfinder = peakfinder.PeakFinder()
         self.conv = convolver.Convolver()
Esempio n. 8
0
 def __init__(self):
     Plugin.__init__(self)
     self.convolver = convolver.Convolver()