-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadialSymmetry.py
88 lines (58 loc) · 2.52 KB
/
RadialSymmetry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from enum import Enum
from computeGradient import GradientOnDemand
import RadialSymParams
class RadialSymmetry :
class Ransac(Enum) :
NONE = 1
SIMPLE = 2
MULTICONSENSU = 3
bsNumIterations = 500 # not a parameter, can be changed through Beanshell
numIterations = 250 # not a parameter, can be changed through Beanshell
peaks = None
spots = None
derivative = None
ng = None
img = None
params = None
globalInterval = None # we need to know where to cut off gradients at image borders
computeInterval = None
def __init__(self, img, globalInterval, computeInterval, params) :
self.img = img
self.params = params
self.globalInterval = globalInterval
self.computeInterval = computeInterval
def compute(rs, pImg, globalInterval, computeInterval, p) :
# perform DOG
print( "Computing DoG..." )
rs.peaks = RadialSymmetry.computeDog(pImg, computeInterval, p.sigma, p.threshold, p.anisotropyCoefficient, p.useAnisotropyForDoG) # p.numThreads는 일단 생략
print( "DoG pre-detected spots : " + str(len(rs.peaks)) )
# calculate (normalized) derivatives
rs.derivative = GradientOnDemand(pImg)
rs.ng = RadialSymmetry.calculateNormalizedGradient(rs.derivative, RadialSymParams.bsMethods[p.bsMethod])
print( "Computing Radial Symmetry..." )
rs.spots = computeRadialSymmetry(
globalInterval,
rs.ng,
rs.derivative,
rs.peaks,
[p.supportRadius, pImg.ndim],
p.inlierRatio,
p.maxError,
p.anisotropyCoefficient,
p.RANSAC(),
p.minNumInliers,
p.nTimesStDev1,
p.nTimesStDev2)
##########################################
def computeDog(pImg, interval, pSigma, pThreshold, anisotropy, useAnisotropy, numThreads) :
pSigma2 = pSigma * ( pow(2, 1 / RadialSymParams.defaultSensitivity) )
calibration = [0] * pImg.ndim
calibration[0] = 1.0
calibration[1] = 1.0
if len(calibration) == 3 :
calibration[2] = 1.0 / anisotropy if useAnisotropy else 1.0
##########################################333
def calculateNormalizedGradient() :
pass
def computeRadialSymmetry() :
pass