annotate ReConstructor.py @ 19:f3d9bb18110a draft default tip

Uploaded
author mb2013
date Tue, 20 May 2014 03:30:07 -0400
parents fc4bc4ab91b7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
1 # Reconstruction of faces of a .ply file,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
2 # based on the symmetry plane
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
3 # MB
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
4 import math
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
5 from math import *
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
6 import sys
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
7 import numpy
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
8 from time import gmtime, strftime
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
9
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
10 # Function main,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
11 def main():
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
12 var_col = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
13 name_file_ply = sys.argv[1]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
14 output = open('new_coordinates2.ply', 'w')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
15 file_ply = open(name_file_ply)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
16 out_log = open(str(sys.argv[15]), 'w')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
17
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
18 out_log.write('Start time: %s\n\nInput user:\n'%(time()))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
19 x_1 = sys.argv[9]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
20 x_2 = sys.argv[10]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
21 y_1 = sys.argv[11]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
22 y_2 = sys.argv[12]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
23 z_1 = sys.argv[13]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
24 z_2 = sys.argv[14]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
25 # to function 'user input side'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
26 side = user_input_side(out_log)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
27 # to function 'user input sections'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
28 number_of_boxes_hor,number_of_boxes_ver,number_of_boxes_z = user_input_sections(out_log)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
29 # to function 'user input factor stdev'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
30 factor = user_input_factor_stdev(out_log)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
31 # to function user input colors
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
32 col_r, col_g, col_b = user_input_colors(out_log)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
33 # to function 'extracting header'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
34 var_header, var_vertex_nm,var_face_nm = extracting_header(file_ply)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
35 # to funtion 'array coordinates'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
36 matrix, matrix2,matrix3 = array_coordinates(name_file_ply, var_vertex_nm, var_header, var_face_nm)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
37 # to function 'calc min max'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
38 amin,amax = calc_min_max(out_log, matrix, x_1,x_2,y_1,y_2,z_1,z_2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
39
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
40 # to function 'range sections'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
41 steps_x,steps_y,steps_z,x_window_min_x,x_window_max_x = range_sections(amin,amax,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
42 number_of_boxes_hor, number_of_boxes_ver,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
43 number_of_boxes_z)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
44 # to function 'create list ranges'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
45 newlist = create_list_ranges(amin,amax,number_of_boxes_hor, number_of_boxes_ver,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
46 number_of_boxes_z, x_window_min_x, x_window_max_x,steps_x,steps_y,steps_z)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
47 # to function 'create list coordinates'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
48 newlist2, indexlist = create_list_coordinates(newlist)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
49 # to function 'fill sections coordinates'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
50 newlist, indexlist = fill_sections_coordinates(newlist, newlist2, matrix, indexlist)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
51 # to function 'calc sections'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
52 difference, differencemean = calc_sections(number_of_boxes_ver,number_of_boxes_hor,number_of_boxes_z,newlist)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
53 # to function 'calc mean stdev'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
54 mean_percentage, std_percentage = calc_mean_stdev(differencemean,factor)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
55 # to function 'calc range'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
56 left_range, right_range = calc_range(mean_percentage,std_percentage)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
57 # to function 'collect mirror values'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
58 total, listindexcount, listindex, listindextotalcount, totalcount = collect_mirror_values(out_log, side, output,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
59 right_range, left_range,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
60 mean_percentage, std_percentage,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
61 newlist, indexlist, difference,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
62 number_of_boxes_hor,number_of_boxes_ver,number_of_boxes_z,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
63 col_r, col_g, col_b)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
64
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
65 # to function 'find original faces'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
66 m_face,m_face_square = find_original_faces(matrix2,matrix3, listindex)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
67
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
68 # to function 'replace index values'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
69 out_faces = replace_index_values(m_face,listindex,listindextotalcount)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
70 out_faces_2 = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
71 # if there are square faces, do function replace index values again
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
72 if len(m_face_square)!= 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
73 out_faces_2 = replace_index_values(m_face_square,listindex,listindextotalcount)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
74 output.close()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
75
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
76 # to function 'write output'
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
77 write_output(name_file_ply, out_log, totalcount, var_header, var_vertex_nm, var_face_nm,out_faces, out_faces_2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
78 #a = strftime("%a, %d %b %Y %H:%M:%S", gmtime())
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
79
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
80 out_log.write('End time: %s'%(time()))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
81 out_log.close() # close log
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
82
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
83 # Function time
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
84 def time():
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
85 a = strftime("%a, %d %b %Y %H:%M:%S", gmtime())
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
86 return a
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
87
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
88 # Function user input side
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
89 def user_input_side(out_log): # user input side
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
90 side = int(sys.argv[3])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
91 if side == 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
92 out_log.write('Left side of object is correct')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
93 else:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
94 out_log.write('Right side of object is correct')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
95 return side
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
96
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
97 # Function user input sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
98 def user_input_sections(out_log):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
99 # number of boxes on x axis, this will be multiplied.
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
100 number_of_boxes_hor = int(sys.argv[4])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
101 # number of boxes on y axis
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
102 number_of_boxes_ver = int(sys.argv[5])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
103 # number of boxes on z axis
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
104 number_of_boxes_z = int(sys.argv[6])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
105 out_log.write("number of boxes x axis:\t%s\nnumber of boxes y axis:\t%s\nnumber of boxes z axis:\t%s\n\n"%
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
106 ((number_of_boxes_hor *2),(number_of_boxes_ver), (number_of_boxes_z)))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
107
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
108 return number_of_boxes_hor, number_of_boxes_ver, number_of_boxes_z
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
109
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
110 # Function user input colors of reconstructed surface
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
111 def user_input_colors(out_log):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
112 col = sys.argv[8]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
113 # four colors can be chosen
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
114 if int(col) == 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
115 out_log.write('color is pink\n')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
116 col_r = 236
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
117 col_g = 149
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
118 col_b = 221
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
119 elif int(col) == 1:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
120 out_log.write('color is blue\n')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
121 col_r = 192
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
122 col_g = 245
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
123 col_b = 250
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
124 elif int(col) == 2:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
125 out_log.write('color is green\n')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
126 col_r = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
127 col_g = 255
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
128 col_b = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
129 else:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
130 out_log.write('color is red\n')
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
131 col_r = 255
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
132 col_g = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
133 col_b = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
134
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
135 return col_r, col_g, col_b
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
136
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
137 # Function user input factor standard deviation
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
138 def user_input_factor_stdev(out_log):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
139 factor = int(sys.argv[7])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
140 out_log.write("Factor standard deviation:\t%s\n\n"%(factor))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
141
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
142 return factor
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
143
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
144 # Function extracting values of header ply file
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
145 def extracting_header(file_ply):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
146 for x in range(0, 20):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
147 readheader = file_ply.readline().strip().split()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
148 if readheader[0] == 'end_header': # when the words 'end_header' are found
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
149 var_header = x # var_header is line number
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
150 if readheader[0] == "element" and readheader[1] == "vertex": # when 'element vertex' found
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
151 var_vertex_nm = readheader[2] # amount of vertexen
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
152 if readheader[0] == "element" and readheader[1] == "face": # when 'element face' found
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
153 var_face_nm = readheader[2] # amount of faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
154 file_ply.close()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
155
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
156 return var_header, var_vertex_nm,var_face_nm
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
157
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
158 # Function extracting coordintates of ply file
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
159 def array_coordinates(name_file_ply, var_vertex_nm, var_header,var_face_nm):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
160 file1 = open(name_file_ply)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
161 matrix = numpy.zeros((int(var_vertex_nm),3)) # creating empty numpy array of amount of vertexen
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
162 matrix2 = numpy.empty((int(var_face_nm),3)) # creating empty numpy array of amount of triangle faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
163 matrix3 = numpy.empty((int(var_face_nm),4)) # creating empty numpy array of amounf of square faces 4
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
164 count = 0 # counter for vertexen
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
165 count2 = 0 # counter for faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
166 # Putting all the vertexen and faces in a matrix
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
167 for a in range(0, (int(var_header) + int(var_vertex_nm) + int(var_face_nm) + 1)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
168 line = file1.readline().strip().split() # reading every line
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
169 if int(var_header) < a < (int(var_vertex_nm)+ int(var_header)+1): #vertexen
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
170 matrix[count][0] = float(line[0]) # x coordinate
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
171 matrix[count][1] = float(line[1]) # y coordinate
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
172 matrix[count][2] = float(line[2]) # z coordinate
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
173 count += 1 # counter + 1 for next line in matrix
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
174 if a > (int(var_vertex_nm)+ int(var_header)): # faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
175 if len(line) == 4: # if triangle faces exists
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
176 matrix2[count2][0] = int(line[1]) # first coordinate for face
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
177 matrix2[count2][1] = int(line[2]) # second coordinate for face
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
178 matrix2[count2][2] = int(line[3]) # third coordinate for face
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
179 #check1 = True
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
180
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
181
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
182 if len(line) == 5: # if square faces exists
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
183 matrix3[count2][0] = int(line[1]) # first coordinate for face
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
184 matrix3[count2][1] = int(line[2]) # second coordinate for face
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
185 matrix3[count2][2] = int(line[3]) # third coordinate for face
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
186 matrix3[count2][3] = int(line[4]) # fourth coordinate for face
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
187 #check2 = True
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
188 count2 += 1 # counter + 1 for next line in matrix
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
189 file1.close()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
190
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
191 # to function calc_histogram
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
192 calc_histogram(matrix)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
193
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
194 return matrix,matrix2,matrix3
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
195
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
196 # Function histogram
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
197 def calc_histogram(matrix): # histogram of x,y, z coordinates
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
198 out_histo = open(str(sys.argv[16]), 'w') # open output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
199 x_co = numpy.array(matrix[:,0])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
200 histo_x = numpy.histogram(x_co, bins = 50) # calculate x coordinate distribution
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
201 y_co = numpy.array(matrix[:,1])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
202 histo_y = numpy.histogram(y_co, bins = 50) # calculate y coordinate distribution
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
203 z_co = numpy.array(matrix[:,2])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
204 histo_z = numpy.histogram(z_co, bins = 50) # calculate z coordinate distribution
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
205
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
206 # write histogram output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
207 out_histo.write("x nm point\tx coordinate\ty nm point\ty coordinate\tz nm point\tz coordinate\n")
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
208 for item in range(0,len(histo_x[0])):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
209 out_histo.write("%s\t%s\t\t%s\t%s\t\t%s\t%s\n"%(histo_x[0][item], histo_x[1][item],
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
210 histo_y[0][item], histo_y[1][item],
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
211 histo_z[0][item], histo_z[1][item], ))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
212
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
213
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
214 out_histo.close() #close histogram output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
215
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
216 # Function calculation minimum and maximum of x,y and z
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
217 def calc_min_max(out_log, matrix, x_1,x_2,y_1,y_2,z_1,z_2):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
218 amin = numpy.amin(matrix, axis = 0) #minima of x y and z
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
219 amax = numpy.amax(matrix, axis = 0) #maxima of x y and z
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
220 # if user input max and min values, change the min and max
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
221 if x_1 != 'standard':
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
222 amin[0] = int(x_1)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
223 if x_2 != 'standard':
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
224 amax[0] = int(x_2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
225 if y_1 != 'standard':
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
226 amin[1] = int(y_1)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
227 if y_2 != 'standard':
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
228 amax[1] = int(y_2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
229 if z_1 != 'standard':
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
230 amin[2] = int(z_1)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
231 if z_2 != 'standard':
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
232 amax[2] = int(z_2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
233
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
234
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
235 # write to log
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
236 out_log.write("lowest x:\t%s\nhighest x:\t%s\nlowest y:\t%s\nhighest y:\t%s\nlowest z:\t%s\nhighest z:\t%s\n\n"
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
237 %(amin[0],amax[0],amin[1],amax[1],amin[2],amax[2]))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
238
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
239 return amin, amax
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
240
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
241 # Function calculating range for sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
242 def range_sections(amin,amax,number_of_boxes_hor, number_of_boxes_ver,number_of_boxes_z):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
243 # Find the highest absolute x because the boxes on the x axis has to be mirrored in the symmetry plane
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
244 if abs(amax[0]) < abs(amin[0]): # if the highest x is absolute smaller than the lowest x:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
245 x_window_min_x = amin[0] # lowest x is lowest windows x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
246 x_window_max_x= amin[0] *-1 # lowest x * -1 is highest windows x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
247 steps_x = abs(amin[0]) / number_of_boxes_hor # length of x boxes
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
248 else:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
249 x_window_min_x = amax[0] *-1 # highest x *-1 is lowest windows x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
250 x_window_max_x = amin[0] # highest x is highest window x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
251 steps_x = abs(amax[0]) / number_of_boxes_hor # length of x boxes
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
252
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
253 #Calculating range of y boxes
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
254 steps_y = (abs(amax[1]) + abs(amin[1])) / number_of_boxes_ver
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
255
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
256 #Calculating range of z boxes
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
257 steps_z = (abs(amax[2]) + abs(amin[2])) / number_of_boxes_z
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
258
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
259 return steps_x, steps_y, steps_z, x_window_min_x,x_window_max_x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
260
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
261 # Function create list ranges of each section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
262 def create_list_ranges(amin,amax,number_of_boxes_hor, number_of_boxes_ver,number_of_boxes_z,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
263 x_window_min_x, x_window_max_x,steps_x,steps_y,steps_z): # creat list with ranges of each section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
264 #creating the list with the ranges for every section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
265 y_window_min = amin[1]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
266 y_window_max = amin[1]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
267 z_window_min = amin[2]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
268 newlist = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
269 sublist = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
270 y_window_min2 = y_window_min
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
271 z_window_min2 = z_window_min
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
272
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
273 # From front to back, from floor to ceiling
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
274 for a in range(0,int(number_of_boxes_ver)): #number of rows
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
275 x_window_min = x_window_min_x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
276 x_window_min2 = x_window_min_x + steps_x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
277 y_window_min = y_window_min2
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
278 y_window_min2+= steps_y
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
279 z_window_min = amin[2]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
280 z_window_min2 = z_window_min
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
281 for c in range(0,int(number_of_boxes_z)): # in z direction
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
282 z_window_min = z_window_min2
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
283 z_window_min2 += steps_z
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
284 x_window_min = x_window_min_x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
285 x_window_min2 = x_window_min_x + steps_x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
286 for b in range(0, int((2*number_of_boxes_hor))): #number of columns
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
287 sublist.append(x_window_min)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
288 sublist.append(x_window_min2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
289 sublist.append(y_window_min)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
290 sublist.append(y_window_min2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
291 sublist.append(z_window_min)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
292 sublist.append(z_window_min2)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
293 newlist.append(sublist)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
294 sublist = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
295 x_window_min = x_window_min2
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
296 x_window_min2 += steps_x
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
297
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
298 return newlist
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
299
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
300 # Function create list coordinates in sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
301 def create_list_coordinates(newlist): # create list coordinates in sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
302 #empty the list but maintaining the structure
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
303 newlist2=[]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
304 newlist2sub = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
305 newlistsub = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
306 for x in range(0,len(newlist)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
307 for y in range(5,-1,-1):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
308 newlist2sub.append(newlist[x].pop(y))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
309 newlist2.append(newlist2sub)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
310 newlist2sub = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
311
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
312 # creating empty index list for storing line index of coordinates
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
313 indexlist = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
314 for x in range(0,len(newlist)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
315 indexlist.append([])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
316
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
317 return newlist2, indexlist
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
318
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
319 # Function fill list sections with coordinates
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
320 def fill_sections_coordinates(newlist,newlist2,matrix,indexlist): # fill list sections with coordinates
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
321 #Filling the sections with the coordinates
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
322 for y in range(0,len(newlist2)): #notice the ranges are in reverse order of each section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
323 rows_vertex = (numpy.where((matrix[:,0]>= float(newlist2[y][5]))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
324 & (matrix[:,0] < float(newlist2[y][4]))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
325 & (matrix[:,1] >= float(newlist2[y][3]))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
326 & (matrix[:,1] < float(newlist2[y][2]))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
327 & (matrix[:,2] >= float(newlist2[y][1]))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
328 & (matrix[:,2] < float(newlist2[y][0]))))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
329
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
330 vertex_new = matrix[list(rows_vertex)]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
331 newlist[y].append((vertex_new))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
332 indexlist[y].append((rows_vertex))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
333
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
334 return newlist, indexlist
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
335
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
336 # Function calculate mean and number of coordinates sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
337 def calc_sections(number_of_boxes_ver,number_of_boxes_hor,number_of_boxes_z,newlist):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
338 #Selecting the sections on the symmetry axis and calculating the mean of every section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
339 counter = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
340 counter2 = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
341 counter3 = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
342 row_count = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
343 difference = [] #whit sections which are empty
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
344 differencemean = [] #without sections which are empty
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
345 total = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
346 for x in range(0, (int(number_of_boxes_ver)*int(number_of_boxes_hor) * int(number_of_boxes_z))): # through all the lists/sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
347 if counter % (int (number_of_boxes_hor)*2) == 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
348 counter = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
349 if counter3 == (int(number_of_boxes_hor)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
350 counter2 += (int(number_of_boxes_hor))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
351 counter3 = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
352
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
353 first_pos = (newlist[counter2][0]) # coordinates of left section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
354 last_pos = (newlist[counter2 + (int(number_of_boxes_hor)*2 -1)- counter][0]) # coordinates of right section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
355 if len(first_pos) == 0: # If there are no coordinates in a section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
356 number_coordinates_box1 = len(first_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
357 mean1 = 2000
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
358 mean3 = ''
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
359
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
360 else:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
361 number_coordinates_box1 = len(first_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
362 for e in range(0,len(first_pos)): # If there are coordinates in a section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
363 total += float(first_pos[e][0])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
364 mean1 = total/len(first_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
365 mean3 = mean1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
366 total = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
367
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
368 if len(last_pos) == 0: # If there are no coordinates in a section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
369 number_coordinates_box2 = len(last_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
370 mean2 = 1000
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
371 mean4 = ''
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
372
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
373 else:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
374 number_coordinates_box2 = len(last_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
375
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
376 for e in range(0,len(last_pos)): # If there are coordinates in a section
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
377 total += float(last_pos[e][0])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
378 mean2 = total/len(last_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
379 mean4 = mean2
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
380 total = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
381 number_coordinates_box1 = len(first_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
382 number_coordinates_box2 = len(last_pos)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
383
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
384 # if number of coordinates in sections deviate to much,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
385 if (abs(number_coordinates_box1 - number_coordinates_box2) > (number_coordinates_box1 / 2.0)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
386 ) and(abs(number_coordinates_box1 - number_coordinates_box2) > (number_coordinates_box2 / 2.0)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
387 mean1 = 3000
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
388 mean2 = 4000
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
389
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
390 difference.append(float(abs(mean2 + mean1))) #the means of every sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
391 counter += 2
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
392 counter2 += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
393 counter3 += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
394
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
395 try:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
396 differencemean.append(abs(mean4 + mean3)) # the mean without empty sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
397 except:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
398 continue
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
399
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
400 return difference, differencemean
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
401
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
402 # Function calculating the mean and the standard deviation
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
403 def calc_mean_stdev(differencemean, factor):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
404 mean_percentage = numpy.mean(differencemean) #calculating the mean without empty sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
405 std_percentage = numpy.std(differencemean) # calculating the standard deviation of the list without the empty sections
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
406 std_percentage = std_percentage * factor
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
407
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
408 return mean_percentage, std_percentage
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
409
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
410 # Function calculating range of accepted differences
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
411 def calc_range(mean_percentage,std_percentage):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
412 left_range = float(mean_percentage) - float(std_percentage) #left range mean minus one standard deviation
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
413 right_range = float(mean_percentage) + (float(std_percentage) )# right range mean plus one standard deviation
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
414 if left_range > 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
415 left_range = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
416 return left_range, right_range
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
417
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
418 # Function collecting incorrect coordinates
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
419 def collect_mirror_values(out_log, side, output, right_range, left_range,mean_percentage,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
420 std_percentage, newlist, indexlist,difference,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
421 number_of_boxes_hor,number_of_boxes_ver,number_of_boxes_z,
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
422 col_r, col_g, col_b):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
423
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
424 # Collecting the values of the sections which have to be mirrored
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
425 out_log.write('mean x difference:\t%s\nstandarddeviation mean x difference:\t%s\nrange:\t%s - %s\n\n'%
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
426 ((mean_percentage),(std_percentage),(left_range),(right_range)))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
427 y = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
428 counter = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
429 counter2 = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
430 sub = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
431 total = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
432 left_range = "%.10f"%(left_range)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
433 indexcount = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
434 facecount = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
435 totalcount = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
436 listindex = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
437 listindexsub = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
438 listindexcount = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
439 listindextotalcount = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
440
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
441 for x in range(0, len(difference)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
442 difference_x = "%.10f"%(difference[x])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
443 if counter %(int(number_of_boxes_hor)) == 0 and x != 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
444 counter = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
445 counter2 += (int(number_of_boxes_hor))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
446 counter += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
447 counter2 += 1 #left side counter
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
448
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
449 # if left side of the object is correct
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
450 if side == 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
451 if (float(difference_x) < float(left_range)) or (float(difference_x) > float(right_range)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
452 if len(newlist[counter2 -1][0]) != 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
453 sub = (newlist[counter2 -1][0]) #coordinates in list
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
454 for y in range(0, len(sub)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
455 i = sub[y]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
456 index_a = indexlist[counter2 -1][0][0][y]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
457 try:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
458 listindex.append(int(index_a)) # index number
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
459 listindextotalcount.append(int(totalcount))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
460 listindexsub.append(int(index_a)) # index number
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
461 listindexsub.append(totalcount) # index number of new coordinate
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
462
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
463 except:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
464 continue
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
465 listindexcount.append(listindexsub) # index number original
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
466 listindexsub = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
467 number= float(sub[y][0]) * -1 # x coordinate * -1 for mirroring at symmetry plane
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
468 sub[y][0] = number
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
469 total.append(sub[y])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
470 totalcount += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
471 # writing new coordinates to output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
472 output.write('%s %s %s %s %s %s\n'%(sub[y][0], float(sub[y][1]), float(sub[y][2]),(col_r), (col_g), (col_b)))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
473
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
474
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
475 # if right side of the object is correct
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
476 if side == 1:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
477 dif = (int(number_of_boxes_hor)) - counter
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
478 counter3 = counter2 + (dif*2) + 1 # right side counter
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
479
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
480 if (float(difference[x] )> float(right_range)) or (float(difference[x]) < float(left_range)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
481 if len(newlist[counter3 -1][0]) != 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
482 sub = (newlist[counter3 -1][0]) # coordinates in list
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
483 for y in range(0, len(sub)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
484 i = sub[y]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
485 index_a = indexlist[counter3 -1][0][0][y]
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
486 try:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
487 listindex.append(int(index_a))# index number
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
488 listindextotalcount.append(int(totalcount))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
489 listindexsub.append(int(index_a)) # index number
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
490 listindexsub.append(totalcount)# index number of new coordinate
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
491 except:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
492 continue
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
493 listindexcount.append(listindexsub)# index number original
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
494 listindexsub = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
495 number= float(sub[y][0]) * -1 # x coordinate * -1 for mirroring at symmetry plane
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
496 sub[y][0] = number
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
497 total.append(sub[y])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
498 totalcount += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
499 # writing new coordinates to output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
500 output.write('%s %s %s %s %s %s\n'%(sub[y][0], float(sub[y][1]), float(sub[y][2]),(col_r), (col_g), (col_b)))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
501
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
502 return total, listindexcount, listindex, listindextotalcount,totalcount
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
503
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
504 # Function extract original faces for corrected coordinates
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
505 def find_original_faces(matrix2, matrix3, listindex):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
506 # finding the original faces of kopied points
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
507 ix = numpy.in1d(matrix2.ravel(),listindex).reshape(matrix2.shape) # finding where the listindex is the same as the matrix
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
508 rows, cols = numpy.where(ix) # finding index of the faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
509 m_face = matrix2[list(set(rows))] # extracting the rows with those faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
510 m_face_square = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
511 # if square faces present
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
512 if matrix3[-1][0] != 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
513 ix_square = numpy.in1d(matrix3.ravel(),listindex).reshape(matrix3.shape) # finding where the listindex is the same as the matrix
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
514 rows_square, cols3 = numpy.where(ix_square) # finding index of the faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
515 m_face_square = matrix3[list(set(rows_square))] # extracting the rows with those faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
516 return m_face, m_face_square
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
517
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
518 # Function replacing index values
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
519 def replace_index_values(m_face,listindex,listindextotalcount):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
520 c = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
521 array_oi = numpy.array(m_face)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
522 maxn = numpy.amax(array_oi)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
523 palette = list(range(int(maxn)))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
524 palette = numpy.array(palette)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
525 key = numpy.array(listindex)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
526 listindextotalcount = numpy.array(listindextotalcount)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
527
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
528 # sorting the lists which have to be replaced
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
529 order= numpy.argsort(key) # sorting of the array key
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
530 litc_sorted = listindextotalcount[order] # sorting the palette
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
531 key_sorted = key[order] # sorting the key
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
532
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
533 palette2 = list(range(int(maxn))) # creating list with all possible values in it with max the highest number in the faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
534 key2 = []
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
535
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
536 counter = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
537 for item in range(0,int(maxn)): # make array containing what have to be changed
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
538 if (counter < len(key_sorted)) and item == (key_sorted[counter]):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
539 key2.append(litc_sorted[counter])
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
540 counter += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
541 else:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
542 key2.append(numpy.nan)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
543
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
544 key2 = numpy.array(key2) # converten of list to array
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
545 index_f = numpy.digitize(array_oi.reshape(-1,), palette2)-1 # indexing which numbers has to be changed
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
546 out_sub =(key2[index_f].reshape(array_oi.shape)) # new array creating with changed values
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
547 out_faces = out_sub[~numpy.isnan(out_sub).any(axis=1)] # extracting the faces with not changed values, (nan)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
548
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
549 return out_faces
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
550
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
551 # Function write output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
552 def write_output(name_file_ply, out_log, totalcount, var_header, var_vertex_nm, var_face_nm,out_faces,out_faces_2): # write output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
553 outfile2 = open(str(sys.argv[2]), 'w')#writing the output file
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
554 file1 = open(name_file_ply)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
555 g = 0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
556 for d in range(0,(int(var_header) + int(var_vertex_nm) + int(var_face_nm) + 1)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
557 line2 = file1.readline().strip()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
558 readline2 = line2.strip().split()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
559 if readline2[0] == "element" and readline2[1] == "vertex":
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
560 outfile2.write("element vertex %s\n"%(int(var_vertex_nm) + totalcount)) #number of vertexen changing
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
561
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
562 elif readline2[0] == "element" and readline2[1] == "face":
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
563 outfile2.write("element face %s\n"%(int(var_face_nm) + len(out_faces) + len(out_faces_2)))#number of faces changing
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
564
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
565 elif (int(var_header) < d < (int(var_header) + int(var_vertex_nm))): #rotated vertexen, with original color code
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
566 outfile2.write('%s\n'%(line2))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
567 g += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
568
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
569 elif (int(var_header) + int(var_vertex_nm)) == d: #for new vertexen, with color code 0,0,0
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
570 outfile2.write('%s\n'%(line2)) #the last original vertex
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
571 g += 1
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
572 with open('new_coordinates2.ply') as infile:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
573 for line in infile:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
574 outfile2.write(line)
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
575
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
576 else: #everything left
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
577 outfile2.write('%s\n'%(line2))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
578
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
579 #writing new faces to output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
580 for z in range(0,len(out_faces)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
581 outfile2.write("3 %s %s %s\n"%((int(out_faces[z][0])+ int(var_vertex_nm)),
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
582 (int(out_faces[z][1])+ int(var_vertex_nm)), (int(out_faces[z][2])+ int(var_vertex_nm))))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
583 #writing new square faces to output
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
584 if len(out_faces_2) != 0:
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
585 for x in range(0,len(out_faces_2)):
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
586 outfile2.write("4 %s %s %s %s\n"%((int(out_faces_2[z][0])+ int(var_vertex_nm)),
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
587 (int(out_faces_2[z][1])+ int(var_vertex_nm)), (int(out_faces_2[z][2])+ int(var_vertex_nm)),
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
588 (int(out_faces_2[z][3] + int(var_vertex_nm)))))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
589
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
590 out_log.write('number of reconstructed faces:\t%s\n\n'%(len(out_faces) + len(out_faces_2)))
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
591 outfile2.close()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
592
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
593
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
594 main()
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
595
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
596
fc4bc4ab91b7 Uploaded
mb2013
parents:
diff changeset
597