AllenInstitute / em_stitch

EM microscopy lens correction
BSD 2-Clause "Simplified" License
4 stars 3 forks source link

adding correction grid and test #31

Closed djkapner closed 5 years ago

djkapner commented 5 years ago

@jaybo I added a function you can use to get information about the transform, like so:

from em_stitch.utils import utils as emu
import json
import numpy as np

with open('/data/em-131fs3/lctest/T3.2019.04.24.a/20190424083337_reference/0/lens_correction_transform.json', 'r') as f:
    jtform = json.load(f)

# or, you already have jtform in memory ...

src, dst = emu.correction_grid(jtform)
delta = dst - src
mag = np.linalg.norm(delta, axis=1)

print('average magnitude : %0.2fpx' % mag.mean())
print('max magnitude : %0.2fpx' % mag.max())
print('average x : %0.2fpx' % delta[:, 0].mean())
print('average |x| : %0.2fpx' % np.abs(delta[:, 0]).mean())
print('max |x| : %0.2fpx' % np.abs(delta[:, 0]).max())
print('etc.')

should give you this:

average magnitude : 18.89px
max magnitude : 81.22px
average x : 0.65px
average |x| : 14.08px
max |x| : 77.90px
etc.
codecov-io commented 5 years ago

Codecov Report

Merging #31 into develop will increase coverage by 0.05%. The diff coverage is 100%.

@@             Coverage Diff             @@
##           develop      #31      +/-   ##
===========================================
+ Coverage    92.71%   92.76%   +0.05%     
===========================================
  Files           10       10              
  Lines          892      899       +7     
===========================================
+ Hits           827      834       +7     
  Misses          65       65