Scripts/ViewPhaseDifference: view_phase_difference.py

File view_phase_difference.py, 486 bytes (added by valerio, 4 years ago)
Line 
1 import sys
2 import math
3
4 image1=LoadImage(sys.argv[1])
5 image2=LoadImage(sys.argv[2])
6 image1.CenterSpatialOrigin()
7 image2.CenterSpatialOrigin()
8 image1.ApplyIP(alg.DFT())
9 image2.ApplyIP(alg.DFT())
10 ex_it=ExtentIterator(image1.GetExtent())
11 diff_image=CreateImage(image1.GetExtent())
12 for pixel in ex_it:
13   phase1=Phase(image1.GetComplex(pixel))
14   phase2=Phase(image2.GetComplex(pixel))
15   phase_diff=phase1-phase2
16   diff_image.SetReal(pixel,180.0*float(phase_diff)/math.pi)
17 Viewer(diff_image)