from rsf.proj import*
from rsf.prog import RSFROOT
from math import pi
def Grey3(data,other):
Result(data,
'''
byte gainpanel=e clip=0.8 |
grey3 flat=n frame1=30 frame2=8 frame3=8
point1=0.8 point2=0.8 label2=Inline label3=Xline label1="Time" unit1=s title= screenratio=1.3 color=g %s'''%other)
def Greys(data,other):
Result(data,
'''
byte gainpanel=e clip=1 bar=bar.rsf |
grey3 flat=n frame1=30 frame2=8 frame3=8
point1=0.8 point2=0.8 label2=Inline label3=Xline label1="Time" unit1=s title= screenratio=1.3 color=g %s'''%other)
matlab = WhereIs('matlab')
matROOT = '../matfun'
matfun = 'Synth'
matlabpath = os.environ.get('MATLABPATH',os.path.join(RSFROOT,'lib'))
if not matlab:
sys.stderr.write('\nCannot find Matlab.\n')
sys.exit(1)
put='d1=175 n2=20 n3=20 d1=0.004 d2=1 d3=1 o2=1 o3=1'
Flow('syn3d-t syn3d-n-t syn3d-sgk-t syn3d-ksvd-t',[os.path.join(matROOT,matfun+'.m')],
'''MATLABPATH=%(matlabpath)s %(matlab)s
-nosplash -nojvm -r "addpath %(matROOT)s;%(matfun)s('${TARGETS[0]}','${TARGETS[1]}','${TARGETS[2]}','${TARGETS[3]}');quit"
'''%vars(),stdin=0,stdout=-1)
Flow('syn3d','syn3d-t','put %s'%put)
Flow('syn3d-n','syn3d-n-t','put %s'%put)
Flow('syn3d-sgk','syn3d-sgk-t','put %s'%put)
Flow('syn3d-ksvd','syn3d-ksvd-t','put %s'%put)
Flow('syn3d-ksvd-n','syn3d-n syn3d-ksvd','add scale=1,-1 ${SOURCES[1]}')
Flow('syn3d-sgk-n','syn3d-n syn3d-sgk','add scale=1,-1 ${SOURCES[1]}')
Grey3('syn3d','title="Clean"')
Grey3('syn3d-n','title="Noisy"')
Grey3('syn3d-ksvd','title="KSVD"')
Grey3('syn3d-sgk','title="SGK"')
Grey3('syn3d-ksvd-n','title="KSVD"')
Grey3('syn3d-sgk-n','title="SGK"')
Flow('syn3d-simi1','syn3d-ksvd syn3d-ksvd-n','similarity other=${SOURCES[1]} niter=20 rect1=5 rect2=5 rect3=5')
Flow('syn3d-simi2','syn3d-sgk syn3d-sgk-n','similarity other=${SOURCES[1]} niter=20 rect1=5 rect2=5 rect3=5 ')
Flow('syn3d-simi3','syn3d-simi1','math output="input*2"')
Flow('syn3d-simi4','syn3d-simi2','math output="input*2"')
Greys('syn3d-simi1','color=j scalebar=y minval=0 maxval=1 title="K-SVD" ')
Greys('syn3d-simi2','color=j scalebar=y minval=0 maxval=1 title="SGK"')
Greys('syn3d-simi3','color=j scalebar=y minval=0 maxval=1 title="K-SVD" ')
Greys('syn3d-simi4','color=j scalebar=y minval=0 maxval=1 title="SGK"')
End() |