Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 655ddae

Browse files
committed
2 parents 9b229bc + d2a6f05 commit 655ddae

File tree

4 files changed

+114
-35
lines changed

4 files changed

+114
-35
lines changed

‎.ipynb_checkpoints/ActiveShapeModel-checkpoint.ipynb

Lines changed: 30 additions & 11 deletions
Large diffs are not rendered by default.

‎ActiveShapeModel.ipynb

Lines changed: 30 additions & 11 deletions
Large diffs are not rendered by default.

‎ActiveShapeModel.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# coding: utf-8
33

4-
# In[5]:
4+
# In[46]:
55

66

77
import MatchingModelPoints as match
@@ -12,6 +12,7 @@
1212
import Image_preperation as prep
1313
import PCA_analysis as PCA
1414
import ActiveFitContour as af
15+
import time
1516

1617
def active_shape_scale_n_times(img, tooth_points, pca_tooth, length, scale, n_times):
1718

@@ -37,14 +38,22 @@ def active_shape_scale(img, tooth_points, pca_tooth, length, scale):
3738

3839
return new_scaled_points
3940

40-
def active_shape(edge_img, tooth_points, pca_tooth, length, alfa):
41+
def active_shape(edge_img, tooth_points, pca_tooth, length, alfa, activeFitON, MatchingON=True):
4142

42-
new_points, error = fit.fit_measure(tooth_points, length, edge_img)
43-
# new_points = af.active_contour(tooth_points, edge_img, length, alfa)
44-
b, pose_param = match.match_model_points(new_points, pca_tooth)
43+
if(activeFitON):
44+
new_points = af.active_contour(tooth_points, edge_img, length, alfa)
45+
else:
46+
new_points, error = fit.fit_measure(tooth_points, length, edge_img)
47+
48+
if(MatchingON):
49+
b, pose_param = match.match_model_points(new_points, pca_tooth)
50+
x = match.generate_model_point(b, pca_tooth)
51+
y = match.inv_transform(x.reshape(40,2),pose_param)
52+
else:
53+
y = new_points
54+
55+
return y
4556

46-
x = match.generate_model_point(b, pca_tooth)
47-
return match.inv_transform(x.reshape(40,2),pose_param)
4857

4958
def active_shape_n_times(edge_img, tooth_points, pca_tooth, length,alfa, n_times):
5059

@@ -116,6 +125,13 @@ def testings():
116125
points_array = active_shape_n_times(edge_img, tooth, pca_tooth, 10, 20 ,9)
117126

118127
show_evolution(img, points_array)
128+
129+
130+
def show_with_points(img, points):
131+
fig, ax = plt.subplots(figsize=(15, 15))
132+
plt.imshow(img)
133+
plt.plot(points[:,0], points[:,1], 'ro', markersize=1)
134+
plt.show()
119135

120136

121137
# In[2]:
@@ -140,5 +156,9 @@ def testings():
140156
plt.plot(tooth[:,0], tooth[:,1], 'ro', markersize=1)
141157
plt.show()
142158

143-
points = active_shape_n_times(edge_img, tooth, pca_tooth, 10, 1,1)
159+
points_list = active_shape_n_times(edge_img, tooth, pca_tooth, 10, 1,1)
160+
161+
#show_evolution(radiograph,points_list)
162+
for points in points_list:
163+
show_with_points(radiograph, points)
144164

‎Image_preperation.ipynb

Lines changed: 26 additions & 5 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /