def test_multiecho(self): me = {'MultiEcho': {'TR': 10, 'TE1': 0.01, 'ESP': 0.01, 'ETL': 5}} me_file = 'sim_me.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(img_size=img_sz, grad_dim=0, grad_vals=(0.8, 1.0), out_file='PD.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=2, grad_vals=(0.04, 0.1), out_file='T2.nii.gz', verbose=vb).run() MultiechoSim(sequence=me, in_file=me_file, PD='PD.nii.gz', T2='T2.nii.gz', noise=noise, verbose=vb).run() Multiecho(sequence=me, in_file=me_file, verbose=vb).run() diff_T2 = Diff(in_file='ME_T2.nii.gz', baseline='T2.nii.gz', noise=noise, verbose=vb).run() diff_PD = Diff(in_file='ME_PD.nii.gz', baseline='PD.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_T2.outputs.out_diff, 3) self.assertLessEqual(diff_PD.outputs.out_diff, 2)
def test_despot2(self, gs=False, tol=20): seq = {'SSFP': {'TR': 10e-3, 'FA': [15, 30, 45, 60], 'PhaseInc': [180, 180, 180, 180]}} ssfp_file = 'sim_ssfp.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(img_size=img_sz, grad_dim=0, grad_vals=(0.8, 1.0), out_file='PD.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=1, grad_vals=(0.8, 1.2), out_file='T1.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=2, grad_vals=(0.04, 0.1), out_file='T2.nii.gz', verbose=vb).run() DESPOT2Sim(sequence=seq, in_file=ssfp_file, t1_file='T1.nii.gz', ellipse=gs, noise=noise, verbose=vb, PD='PD.nii.gz', T2='T2.nii.gz').run() DESPOT2(sequence=seq, in_file=ssfp_file, t1_file='T1.nii.gz', ellipse=gs, verbose=vb, residuals=True).run() diff_T2 = Diff(in_file='D2_T2.nii.gz', baseline='T2.nii.gz', noise=noise, verbose=vb).run() diff_PD = Diff(in_file='D2_PD.nii.gz', baseline='PD.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_T2.outputs.out_diff, tol) self.assertLessEqual(diff_PD.outputs.out_diff, tol)
def test_fm(self): seq = {'SSFP': {'TR': 5e-3, 'FA': [15, 15, 60, 60], 'PhaseInc': [180, 0, 180, 0]} } ssfp_file = 'sim_ssfp.nii.gz' img_sz = [16, 16, 16] noise = 0.001 NewImage(img_size=img_sz, fill=1.0, out_file='PD.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=0, grad_vals=(0.8, 1.2), out_file='T1.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=1, grad_vals=(0.04, 0.1), out_file='T2.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=2, grad_vals=(-100, 100), out_file='f0.nii.gz', verbose=vb).run() FMSim(sequence=seq, in_file=ssfp_file, asym=False, t1_file='T1.nii.gz', noise=noise, verbose=vb, PD='PD.nii.gz', T2='T2.nii.gz', f0='f0.nii.gz').run() FM(sequence=seq, in_file=ssfp_file, asym=False, t1_file='T1.nii.gz', verbose=vb, residuals=True).run() diff_T2 = Diff(in_file='FM_T2.nii.gz', baseline='T2.nii.gz', noise=noise, verbose=vb).run() diff_PD = Diff(in_file='FM_PD.nii.gz', baseline='PD.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_T2.outputs.out_diff, 20) self.assertLessEqual(diff_PD.outputs.out_diff, 10)
def test_oef(self): # Use MultiEchoFlex as a proxy for ASE seq = {'MultiEcho': {'TR': 2.5, 'TE': [-0.07, -0.06, -0.05, -0.04, -0.03, -0.02, -0.01, 0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07]}} ase_file = 'sim_ase.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(img_size=img_sz, grad_dim=0, fill=100., out_file='S0.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=0, grad_vals=(-0.01, 0.01), out_file='dT.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=1, grad_vals=(1.0, 3.0), out_file='R2p.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=2, grad_vals=(0.005, 0.025), out_file='DBV.nii.gz', verbose=vb).run() ASESim(sequence=seq, in_file=ase_file, noise=noise, verbose=vb, S0='S0.nii.gz', dT='dT.nii.gz', R2p='R2p.nii.gz', DBV='DBV.nii.gz').run() ASE(sequence=seq, in_file=ase_file, verbose=vb).run() diff_R2p = Diff(in_file='ASE_R2p.nii.gz', baseline='R2p.nii.gz', noise=noise, verbose=vb).run() diff_DBV = Diff(in_file='ASE_DBV.nii.gz', baseline='DBV.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_R2p.outputs.out_diff, 12) self.assertLessEqual(diff_DBV.outputs.out_diff, 50)
def test_hifi(self): seqs = {'SPGR': {'TR': 5e-3, 'FA': [3, 18]}, 'MPRAGE': {'FA': 5, 'TR': 5e-3, 'TI': 0.45, 'TD': 0, 'eta': 1, 'ETL': 64, 'k0': 0}, } spgr_file = 'sim_spgr.nii.gz' mprage_file = 'sim_mprage.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(out_file='PD.nii.gz', img_size=img_sz, grad_dim=0, grad_vals=(0.8, 1.0), verbose=vb).run() NewImage(out_file='T1.nii.gz', img_size=img_sz, grad_dim=1, grad_vals=(0.5, 1.5), verbose=vb).run() NewImage(out_file='B1.nii.gz', img_size=img_sz, grad_dim=2, grad_vals=(0.8, 1.2), verbose=vb).run() HIFISim(sequence=seqs, spgr_file=spgr_file, mprage_file=mprage_file, noise=noise, verbose=vb, PD='PD.nii.gz', T1='T1.nii.gz', B1='B1.nii.gz').run() HIFI(sequence=seqs, spgr_file=spgr_file, mprage_file=mprage_file, verbose=vb, residuals=True).run() diff_T1 = Diff(in_file='HIFI_T1.nii.gz', baseline='T1.nii.gz', noise=noise, verbose=vb).run() diff_PD = Diff(in_file='HIFI_PD.nii.gz', baseline='PD.nii.gz', noise=noise, verbose=vb).run() diff_B1 = Diff(in_file='HIFI_B1.nii.gz', baseline='B1.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_T1.outputs.out_diff, 60) self.assertLessEqual(diff_PD.outputs.out_diff, 35) self.assertLessEqual(diff_B1.outputs.out_diff, 60)
def test_zshim(self): nshims = 8 sz = 32 ref_val = sqrt(sum([x**2 for x in range(1, nshims + 1)])) NewImage(out_file='zshim.nii.gz', img_size=[sz, sz, sz, nshims], grad_dim=3, grad_vals=(1, nshims), grad_steps=7, verbose=vb).run() NewImage(out_file='zshim_ref.nii.gz', img_size=[sz, sz, sz], fill=ref_val, verbose=vb).run() ZShim(in_file='zshim.nii.gz', zshims=nshims, verbose=vb).run() zdiff = Diff(in_file='zshim_zshim.nii.gz', baseline='zshim_ref.nii.gz', noise=1, verbose=vb).run() self.assertLessEqual(zdiff.outputs.out_diff, 1.e-3)
def test_despot1(self): seq = {'SPGR': {'TR': 10e-3, 'FA': [3, 18]}} spgr_file = 'sim_spgr.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(img_size=img_sz, grad_dim=0, grad_vals=( 0.8, 1.0), out_file='PD.nii.gz', verbose=vb).run() NewImage(img_size=img_sz, grad_dim=1, grad_vals=( 0.8, 1.3), out_file='T1.nii.gz', verbose=vb).run() DESPOT1Sim(sequence=seq, in_file=spgr_file, noise=noise, verbose=vb, PD='PD.nii.gz', T1='T1.nii.gz').run() DESPOT1(sequence=seq, in_file=spgr_file, verbose=vb, residuals=True).run() diff_T1 = Diff(in_file='D1_T1.nii.gz', baseline='T1.nii.gz', noise=noise, verbose=vb).run() diff_PD = Diff(in_file='D1_PD.nii.gz', baseline='PD.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_T1.outputs.out_diff, 35) self.assertLessEqual(diff_PD.outputs.out_diff, 35)
def test_asl(self): seq = {'CASL': {'TR': 4.0, 'label_time': 3.0, 'post_label_delay': [0.3]}} asl_file = 'sim_asl.nii.gz' NewImage(img_size=[32, 32, 32, 2], grad_dim=3, grad_vals=(1, 1.06), grad_steps=1, out_file=asl_file, verbose=vb).run() NewImage(img_size=[32, 32, 32], fill=147.355, out_file='ref_cbf.nii.gz', verbose=vb).run() ASL(sequence=seq, in_file=asl_file, verbose=vb).run() diff_CBF = Diff(in_file='CASL_CBF.nii.gz', baseline='ref_cbf.nii.gz', verbose=vb).run() self.assertLessEqual(diff_CBF.outputs.out_diff, 0.1)
def test_ZSpec(self): NewImage(out_file='zspec_linear.nii.gz', verbose=vb, img_size=[8, 8, 8, 4], grad_dim=3, grad_vals=(-3, 3)).run() NewImage(out_file='zspec_zero.nii.gz', verbose=vb, img_size=[8, 8, 8], fill=0).run() ZSpec(in_file='zspec_linear.nii.gz', in_freqs=[-3, -1, 1, 3], out_freqs=[0], verbose=vb).run() diff_zero = Diff(in_file='zspec_linear_interp.nii.gz', abs_diff=True, baseline='zspec_zero.nii.gz', noise=1, verbose=vb).run() self.assertLessEqual(diff_zero.outputs.out_diff, 0.01)
def test_poly(self): sz = 16 scale = sqrt(3 * (sz / 2)**2) poly = { 'center': [0, 0, 0], 'scale': scale, 'coeffs': [1, 1, 2, 4, 1, 0, 0, 1, 0, 1] } poly_sim = 'poly_sim.nii.gz' mask_file = 'poly_mask.nii.gz' NewImage(img_size=[sz, sz, sz], grad_dim=0, grad_vals=(0, 1), grad_steps=1, out_file=mask_file, verbose=vb).run() PolyImage(ref_file=mask_file, out_file=poly_sim, order=2, poly=poly, verbose=vb).run() fit = PolyFit(in_file=poly_sim, order=2, robust=True).run() terms_diff = sum([ abs(x - y) for x, y in zip(poly['coeffs'], fit.outputs.poly['coeffs']) ]) self.assertLessEqual(terms_diff, 1.e-6) PolyImage(ref_file=mask_file, out_file='poly_sim2.nii.gz', order=2, poly=fit.outputs.poly, verbose=vb).run() img_diff = Diff(baseline=poly_sim, in_file='poly_sim2.nii.gz', noise=1).run() self.assertLessEqual(img_diff.outputs.out_diff, 1.e-3)
def test_rfprofile(self): NewImage(out_file='rf_b1plus.nii.gz', img_size=[32, 32, 32], fill=1.0, verbose=vb).run() RFProfile(in_file='rf_b1plus.nii.gz', out_file='rf_slab.nii.gz', rf={ 'rf_pos': [0, 1], 'rf_vals': [0, 1] }, verbose=vb).run() NewImage(out_file='rf_ref.nii.gz', img_size=[32, 32, 32], grad_dim=2, grad_vals=(-16, 15), verbose=vb).run() rf_diff = Diff(baseline='rf_ref.nii.gz', in_file='rf_slab.nii.gz', noise=1, abs_diff=True, verbose=vb).run() self.assertLessEqual(rf_diff.outputs.out_diff, 1.e-3)
def test_lorentzian2(self): sat_f0 = [ *np.linspace(-40, 40, 12).squeeze().tolist(), -0.5, -0.25, 0, 0.25, 0.5 ] sequence = { 'MTSat': { 'pulse': { 'p1': 0.4, 'p2': 0.3, 'bandwidth': 0.39 }, 'TR': 4, 'Trf': 0.02, 'FA': 5, 'sat_f0': sat_f0, 'sat_angle': np.repeat(180.0, 17).squeeze().tolist() } } pools = [{ 'name': 'DS', 'df0': [0, -2.5, 2.5], 'fwhm': [1.0, 1.e-6, 3.0], 'A': [0.2, 1.e-3, 1.0], 'use_bandwidth': True }, { 'name': 'MT', 'df0': [-2.5, -5.0, -0.5], 'fwhm': [50.0, 35.0, 200.0], 'A': [0.3, 1.e-3, 1.0] }] lorentz_file = 'lorentz_sim.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(out_file='PD.nii.gz', verbose=vb, img_size=img_sz, fill=1.0).run() NewImage(out_file='f0.nii.gz', verbose=vb, img_size=img_sz, grad_dim=0, grad_vals=(-0.25, 0.25)).run() NewImage(out_file='fwhm.nii.gz', verbose=vb, img_size=img_sz, fill=1.8).run() NewImage(out_file='A.nii.gz', verbose=vb, img_size=img_sz, grad_dim=2, grad_vals=(0.3, 0.4)).run() NewImage(out_file='MTf0.nii.gz', verbose=vb, img_size=img_sz, fill=-2.2).run() NewImage(out_file='MTfwhm.nii.gz', verbose=vb, img_size=img_sz, fill=90).run() NewImage(out_file='MTA.nii.gz', verbose=vb, img_size=img_sz, fill=0.4).run() LorentzianSim(sequence=sequence, pools=pools, in_file=lorentz_file, noise=noise, verbose=vb, DS_f0='f0.nii.gz', DS_fwhm='fwhm.nii.gz', DS_A='A.nii.gz', MT_fwhm='MTfwhm.nii.gz', MT_f0='f0.nii.gz', MT_A='MTA.nii.gz').run() Lorentzian(sequence=sequence, pools=pools, in_file=lorentz_file, verbose=vb).run() diff_fwhm = Diff(in_file='LTZ_DS_fwhm.nii.gz', baseline='fwhm.nii.gz', noise=noise, verbose=vb).run() diff_A = Diff(in_file='LTZ_DS_A.nii.gz', baseline='A.nii.gz', noise=noise, verbose=vb).run() diff_MTfwhm = Diff(in_file='LTZ_MT_fwhm.nii.gz', baseline='MTfwhm.nii.gz', noise=noise, verbose=vb).run() diff_MTA = Diff(in_file='LTZ_MT_A.nii.gz', baseline='MTA.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_fwhm.outputs.out_diff, 15) self.assertLessEqual(diff_A.outputs.out_diff, 300) self.assertLessEqual(diff_MTfwhm.outputs.out_diff, 15) self.assertLessEqual(diff_MTA.outputs.out_diff, 300)
def test_qMT(self): qmt = { 'MTSat': { 'sat_f0': [1000, 3000, 5000, 7000, 9000, 1000, 3000, 5000, 7000, 9000], 'sat_angle': [360, 360, 360, 360, 360, 720, 720, 720, 720, 720], 'bw': 100, 'FA': 5, 'TR': 0.03, 'Trf': 0.015, 'pulse': { 'p1': 0.416, 'p2': 0.295, 'bandwidth': 100 } }, } qmt_file = 'qmt_sim.nii.gz' t1app = 'qmt_t1app.nii.gz' img_sz = [32, 32, 32] noise = 0.001 lineshape_file = 'qmt_lineshape.json' Lineshape(out_file=lineshape_file, lineshape='SuperLorentzian', frq_start=500, frq_space=500, frq_count=150).run() NewImage(out_file='PD.nii.gz', verbose=vb, img_size=img_sz, fill=1.0).run() NewImage(out_file='T1_f.nii.gz', verbose=vb, img_size=img_sz, grad_dim=0, grad_vals=(0.5, 1.5)).run() NewImage(out_file='T2_f.nii.gz', verbose=vb, img_size=img_sz, fill=0.1).run() NewImage(out_file='T2_b.nii.gz', verbose=vb, img_size=img_sz, fill=12e-6).run() NewImage(out_file='k_bf.nii.gz', verbose=vb, img_size=img_sz, grad_dim=1, grad_vals=(1.0, 5.0)).run() NewImage(out_file='f_b.nii.gz', verbose=vb, img_size=img_sz, grad_dim=2, grad_vals=(0.05, 0.2)).run() qMTSim(sequence=qmt, in_file=qmt_file, t1_map=t1app, lineshape=lineshape_file, noise=noise, verbose=vb, PD='PD.nii.gz', T1_f='T1_f.nii.gz', T2_f='T2_f.nii.gz', T2_b='T2_b.nii.gz', k_bf='k_bf.nii.gz', f_b='f_b.nii.gz').run() qMT(sequence=qmt, in_file=qmt_file, t1_map=t1app, lineshape=lineshape_file, verbose=vb).run() diff_T1_f = Diff(in_file='QMT_T1_f.nii.gz', baseline='T1_f.nii.gz', noise=noise, verbose=vb).run() diff_k_bf = Diff(in_file='QMT_k_bf.nii.gz', baseline='k_bf.nii.gz', noise=noise, verbose=vb).run() diff_f_b = Diff(in_file='QMT_f_b.nii.gz', baseline='f_b.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_T1_f.outputs.out_diff, 32) self.assertLessEqual(diff_k_bf.outputs.out_diff, 32) self.assertLessEqual(diff_f_b.outputs.out_diff, 32)
def test_lorentzian(self): sequence = { 'MTSat': { 'pulse': { 'p1': 0.4, 'p2': 0.3, 'bandwidth': 0.39 }, 'TR': 4, 'Trf': 0.02, 'FA': 5, 'sat_f0': np.linspace(-5, 5, 21).squeeze().tolist(), 'sat_angle': np.repeat(180.0, 21).squeeze().tolist() } } pools = [{ 'name': 'DS', 'df0': [0, -2.5, 2.5], 'fwhm': [1.0, 1.e-6, 3.0], 'A': [0.2, 1.e-3, 1.0], 'use_bandwidth': True }] lorentz_file = 'lorentz_sim.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(out_file='f0.nii.gz', verbose=vb, img_size=img_sz, grad_dim=0, grad_vals=(-0.5, 0.5)).run() NewImage(out_file='fwhm.nii.gz', verbose=vb, img_size=img_sz, grad_dim=1, grad_vals=(0.5, 2.5)).run() NewImage(out_file='A.nii.gz', verbose=vb, img_size=img_sz, grad_dim=2, grad_vals=(0.5, 1)).run() LorentzianSim(sequence=sequence, pools=pools, in_file=lorentz_file, noise=noise, verbose=vb, DS_f0='f0.nii.gz', DS_fwhm='fwhm.nii.gz', DS_A='A.nii.gz').run() Lorentzian(sequence=sequence, pools=pools, in_file=lorentz_file, verbose=vb).run() diff_f0 = Diff(in_file='LTZ_DS_f0.nii.gz', baseline='f0.nii.gz', noise=noise, verbose=vb).run() diff_fwhm = Diff(in_file='LTZ_DS_fwhm.nii.gz', baseline='fwhm.nii.gz', noise=noise, verbose=vb).run() diff_A = Diff(in_file='LTZ_DS_A.nii.gz', baseline='A.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_f0.outputs.out_diff, 60) self.assertLessEqual(diff_fwhm.outputs.out_diff, 20) self.assertLessEqual(diff_A.outputs.out_diff, 25)
def test_emt(self): ellipse_sim = { "SSFP": { "FA": [1, 1, 1, 1, 1, 1], "PhaseInc": [180, 240, 300, 0, 60, 120], "TR": 0.01 } } ellipse_fit = { "SSFP": { "FA": [1, 1, 1, 1, 1, 1], "PhaseInc": [180, 240, 300, 0, 60, 120], "TR": 0.01 } } emt_seq = { "SSFPMT": { "FA": [30], "PhaseInc": [180, 240, 300, 0, 60, 120], "TR": [0.01], "Trf": [0.00025], "pulse": { "p1": 0.250629, "p2": 0.201183, "bandwidth": 2 } } } ellipse_file = 'emt_ellipse.nii.gz' emt_G = 'emt_G.nii.gz' emt_a = 'emt_a.nii.gz' emt_b = 'emt_b.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(out_file='PD.nii.gz', verbose=vb, img_size=img_sz, fill=1).run() NewImage(out_file='T1_f.nii.gz', verbose=vb, img_size=img_sz, grad_dim=0, grad_vals=(0.8, 1.3)).run() NewImage(out_file='T2_f.nii.gz', verbose=vb, img_size=img_sz, grad_dim=1, grad_vals=(0.05, 0.1)).run() NewImage(out_file='f_b.nii.gz', verbose=vb, img_size=img_sz, grad_dim=2, grad_vals=(0.01, 0.15)).run() NewImage(out_file='k_bf.nii.gz', verbose=vb, img_size=img_sz, fill=2).run() NewImage(out_file='zero.nii.gz', verbose=vb, img_size=img_sz, fill=0).run() eMTSim(sequence=emt_seq, G_file=emt_G, a_file=emt_a, b_file=emt_b, noise=0, verbose=vb, PD='PD.nii.gz', T1_f='T1_f.nii.gz', T2_f='T2_f.nii.gz', f_b='f_b.nii.gz', k_bf='k_bf.nii.gz').run() EllipseSim(sequence=ellipse_sim, in_file=ellipse_file, noise=noise, verbose=vb, G=emt_G, a=emt_a, b=emt_b, theta_0='zero.nii.gz', phi_rf='zero.nii.gz').run() Ellipse(sequence=ellipse_fit, in_file=ellipse_file, verbose=vb).run() eMT(sequence=emt_seq, G_map=emt_G, a_map=emt_a, b_map=emt_b, verbose=vb).run() # Currently the simulation framework does not support blocked algorithms # Hence simulating a proper eMT dataset would involve individually simulating # the different TR/Trf combinations and then merging them. I'm not doing that # now, so a proper test will have to wait diff_G = Diff(in_file='ES_G.nii.gz', baseline=emt_G, noise=noise, verbose=vb).run() diff_a = Diff(in_file='ES_a.nii.gz', baseline=emt_a, noise=noise, verbose=vb).run() diff_b = Diff(in_file='ES_b.nii.gz', baseline=emt_b, noise=noise, verbose=vb).run() self.assertLessEqual(diff_G.outputs.out_diff, 3.5) self.assertLessEqual(diff_a.outputs.out_diff, 3.5) self.assertLessEqual(diff_b.outputs.out_diff, 10)
def test_planet(self): ellipse_seq = { "SSFP": { "FA": [15, 15, 15, 15, 15, 15], "PhaseInc": [180, 240, 300, 0, 60, 120], "TR": 0.01 } } planet_seq = {"SSFP": {"FA": [15], "PhaseInc": [0], "TR": 0.01}} ellipse_file = 'planet_ellipse.nii.gz' planet_G = 'planet_G.nii.gz' planet_a = 'planet_a.nii.gz' planet_b = 'planet_b.nii.gz' img_sz = [32, 32, 32] noise = 0.001 NewImage(out_file='PD.nii.gz', verbose=vb, img_size=img_sz, fill=1).run() NewImage(out_file='T1.nii.gz', verbose=vb, img_size=img_sz, grad_dim=0, grad_vals=(0.8, 1.3)).run() NewImage(out_file='T2.nii.gz', verbose=vb, img_size=img_sz, grad_dim=1, grad_vals=(0.05, 0.1)).run() NewImage(out_file='zero.nii.gz', verbose=vb, img_size=img_sz, fill=0).run() PLANETSim(sequence=planet_seq, G_file=planet_G, a_file=planet_a, b_file=planet_b, noise=0, verbose=vb, PD='PD.nii.gz', T1='T1.nii.gz', T2='T2.nii.gz').run() EllipseSim(sequence=ellipse_seq, in_file=ellipse_file, noise=noise, verbose=vb, G=planet_G, a=planet_a, b=planet_b, theta_0='zero.nii.gz', phi_rf='zero.nii.gz').run() Ellipse(sequence=ellipse_seq, in_file=ellipse_file, verbose=vb).run() PLANET(sequence=planet_seq, G_map=planet_G, a_map=planet_a, b_map=planet_b, verbose=vb).run() diff_G = Diff(in_file='ES_G.nii.gz', baseline=planet_G, noise=noise, verbose=vb).run() diff_a = Diff(in_file='ES_a.nii.gz', baseline=planet_a, noise=noise, verbose=vb).run() diff_b = Diff(in_file='ES_b.nii.gz', baseline=planet_b, noise=noise, verbose=vb).run() diff_PD = Diff(in_file='PLANET_PD.nii.gz', baseline='PD.nii.gz', noise=noise, verbose=vb).run() diff_T1 = Diff(in_file='PLANET_T1.nii.gz', baseline='T1.nii.gz', noise=noise, verbose=vb).run() diff_T2 = Diff(in_file='PLANET_T2.nii.gz', baseline='T2.nii.gz', noise=noise, verbose=vb).run() self.assertLessEqual(diff_G.outputs.out_diff, 3.5) self.assertLessEqual(diff_a.outputs.out_diff, 3) self.assertLessEqual(diff_b.outputs.out_diff, 7) self.assertLessEqual(diff_PD.outputs.out_diff, 4) self.assertLessEqual(diff_T1.outputs.out_diff, 1) self.assertLessEqual(diff_T2.outputs.out_diff, 1)