예제 #1
0
 def testCorrectTwoShellOk(self):
     dann = Dry()
     model2s = dann.train_model(bval2s)
     dann.fwe(dwis2s, model2s, bval2s, testingdir)
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "merged1/tissue_volume_fraction.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "merged1/fwe_dwi.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "merged2/tissue_volume_fraction.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "merged2/fwe_dwi.nii.gz")))
예제 #2
0
 def testCorrectOneShellOk(self):
     dann = Dry()
     model1s = dann.train_model(bval1s)
     dann.fwe(dwis1s, model1s, bval1s, testingdir)
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "test1/tissue_volume_fraction.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "test1/fwe_dwi.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "test2/tissue_volume_fraction.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "test2/fwe_dwi.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "test3/tissue_volume_fraction.nii.gz")))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "test3/fwe_dwi.nii.gz")))
예제 #3
0
 def testCorrectEmptyOutputFolder(self):
     dann = Dry()
     model = dann.train_model(bval1s)
     dann.fwe(dwis1s, model, bval1s)
     self.assertTrue(os.path.isfile("test1/tissue_volume_fraction.nii.gz"))
     self.assertTrue(os.path.isfile("test1/fwe_dwi.nii.gz"))
     self.assertTrue(os.path.isfile("test2/tissue_volume_fraction.nii.gz"))
     self.assertTrue(os.path.isfile("test2/fwe_dwi.nii.gz"))
     self.assertTrue(os.path.isfile("test3/tissue_volume_fraction.nii.gz"))
     self.assertTrue(os.path.isfile("test3/fwe_dwi.nii.gz"))
예제 #4
0
from dry.dry import Dry

if __name__ == "__main__":
    bfile = 'dry/data/one-shell/test_ok.bvals'
    dwi = ['dry/data/one-shell/test1.nii.gz',
           'dry/data/one-shell/test2.nii.gz',
           'dry/data/one-shell/test3.nii.gz']
    dann = Dry()
    model1s = dann.train_model(bfile)
    dann.correct_fwe(dwi, model1s, bfile, output_folder='dry/data')

    # bfile = 'dry/data/two-shell/merged.bval'
    # dwi = ['dry/data/two-shell/merged1.nii.gz',
    #        'dry/data/two-shell/merged2.nii.gz']
    # dann = Dry()
    # model2s = dann.train_model(bfile)
    # dann.correct_fwe(dwi, model2s, bfile, output_folder='dry/data')
예제 #5
0
 def testCorrectDifferentBval(self):
     dann = Dry()
     model = dann.train_model(bval1s)
     with self.assertRaises(ValueError):
         dann.fwe(dwis1s, model, bval2s, testingdir)
예제 #6
0
 def testCorrectEmptyBval(self):
     dann = Dry()
     model = dann.train_model(bval1s)
     with self.assertRaises(ValueError):
         dann.fwe(dwis1s, model, None, testingdir)
예제 #7
0
 def testCorrectEmptyModel(self):
     dann = Dry()
     with self.assertRaises(ValueError):
         dann.fwe(dwis1s, None, bval1s, testingdir)
예제 #8
0
 def testCorrectEmtpyDwi(self):
     dann = Dry()
     model = dann.train_model(bval1s)
     with self.assertRaises(ValueError):
         dann.fwe(None, model, bval1s, testingdir)
예제 #9
0
 def testLoadModelOK(self):
     dann = Dry()
     model = dann.train_model(bval1s)
     dann.save_model(model, os.path.join(testingdir, "testmodel"))
     model2 = dann.load_model(os.path.join(testingdir, "testmodel"))
     self.assertIsInstance(model2, Sequential)
예제 #10
0
 def testSaveModelOK(self):
     dann = Dry()
     model = dann.train_model(bval1s)
     dann.save_model(model, os.path.join(testingdir, "testmodel"))
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "testmodel")))
예제 #11
0
 def testSaveModelNoModel(self):
     dann = Dry()
     with self.assertRaises(ValueError):
         dann.save_model(None, "dry/data/")
예제 #12
0
 def testTrainModelOk(self):
     dann = Dry()
     model = dann.train_model(bval1s)
     self.assertIsInstance(model, Sequential)
예제 #13
0
 def testTrainModelEmptyBval(self):
     dann = Dry()
     with self.assertRaises(FileNotFoundError):
         dann.train_model("")
예제 #14
0
 def testCorrectFromTissueVolumeFraction(self):
     dann = Dry()
     dann.fwe_tissue(dwis2s[0], ftissue, bval2s, testingdir)
     self.assertTrue(os.path.isfile(os.path.join(testingdir, "merged1/fwe_dwi.nii.gz")))
예제 #15
0
 def testCorrectFromFEmptyBfile(self):
     dann = Dry()
     with self.assertRaises(ValueError):
         dann.fwe_tissue(dwis2s, ftissue, None)
예제 #16
0
 def testCorrectFromFEmptyFtissue(self):
     dann = Dry()
     with self.assertRaises(ValueError):
         dann.fwe_tissue(dwis2s, None, bval2s)