Commit 7d5becca authored by Elijah Andrews's avatar Elijah Andrews

Removed deprecated code.

parent f2533095
......@@ -43,38 +43,6 @@ def calculate_offset(frame_1, frame_2, plot_compared_frames=False):
return offset
def calculate_mm_per_pixel(dir_path, plot_compared_frames=False):
""" Just used for testing, do not use for actual calculations. """
index_file = open(dir_path + "index.csv")
index_lines = index_file.readlines()
readings = [] # x, y, index
for i in range(1, len(index_lines)): # Start at 1 to skip header.
split = index_lines[i].strip().split(",")
readings.append([float(split[0]), float(split[1]), split[2]]) # x, y, index number
readings = np.array(readings)
xs = np.array(readings[:, 0], dtype=float)
ys = np.array(readings[:, 1], dtype=float)
first_frames = []
for r in range(len(readings)):
path = dir_path + "movie_S" + str(readings[r][2]).rjust(4, '0') + "/a_C001H001S0001.cih"
movie = mraw(path)
first_frames.append(movie[0])
movie.close()
# For now just take the first two readings.
# TODO: Make a method of detecting if geometry is in view and get average mm_per_pixel across a range.
pixel_offset = vect.mag(calculate_offset(first_frames[10], first_frames[11], plot_compared_frames))
mm_offset_x = float(readings[1][0]) - float(readings[0][0])
mm_offset_y = float(readings[1][1]) - float(readings[0][1])
mm_offset = math.sqrt(mm_offset_x ** 2 + mm_offset_y ** 2)
return mm_offset / pixel_offset
if __name__ == '__main__':
# cal_dir = "../../../Data/SidewaysSeries/w2.2h2.7/"
# print(calculate_mm_per_pixel(cal_dir, plot_compared_frames=True))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment