def test_pvc(): """ FIXME we need to test the PVC initialization step and how to do this is not finalized """ d = np.random.rand(5, 5, 5, 6) img = AslImage(name="asldata", image=d, tis=[1.5], order="prt") wsp = Workspace(infertiss=True, inferbat=True) wsp.pgm = Image(np.random.rand(5, 5, 5)) wsp.pwm = Image(np.random.rand(5, 5, 5)) steps = basil.basil_steps(wsp, img) assert (len(steps) == 3) options = _get_defaults(img) # options.update({ # "incpve" : True, # }) _check_step(steps[0], desc_text="tissue", options=options) # _check_step(steps[1], desc_text="PVE", options=options) options.update({ "method": "spatialvb", "param-spatial-priors": "N+", "PSP_byname1": "ftiss", "PSP_byname1_type": "M", "max-iterations": 200, "convergence": "maxits", }) options.pop("max-trials") _check_step(steps[2], desc_text="spatial")
def test_pvc_only_one_map_given2(): """ Check that PVC correction fails if you only give the WM map """ d = np.random.rand(5, 5, 5, 6) img = AslImage(name="asldata", image=d, tis=[1.5], order="prt") wsp = Workspace(infertiss=True, inferbat=True) wsp.pwm = Image(np.random.rand(5, 5, 5)) with pytest.raises(ValueError): basil.basil_steps(wsp, img)
def test_pvc_no_tissue(): """ Check that PVC correction fails if you do not infer the tissue component """ d = np.random.rand(5, 5, 5, 6) img = AslImage(name="asldata", image=d, tis=[1.5], order="prt") wsp = Workspace(infertiss=False, inferbat=True) wsp.pgm = Image(np.random.rand(5, 5, 5)) wsp.pwm = Image(np.random.rand(5, 5, 5)) with pytest.raises(ValueError): basil.basil_steps(wsp, img)