示例#1
0
    def test_Export_terminal(self):
        import niprov

        niprov.discover("testdata")
        pth = os.path.abspath("testdata/dicom/T1.dcm")
        provenance = niprov.ProvenanceContext().get().byLocation(pth)
        niprov.print_(provenance)
示例#2
0
    def test_Discover(self):
        import niprov

        niprov.discover("testdata")
        img = niprov.ProvenanceContext().get().byLocation(os.path.abspath("testdata/dicom/T1.dcm"))
        self.assertEqual(img.provenance["dimensions"], [80, 80, 10])
        img = niprov.ProvenanceContext().get().byLocation(os.path.abspath("testdata/eeg/stub.cnt"))
        self.assertEqual(img.provenance["subject"], "Jane Doe")
示例#3
0
 def test_Log(self):
     import niprov
     niprov.discover('testdata')
     newfile = os.path.abspath('temp/smoothed.test')
     self.touch(newfile)
     niprov.log(newfile, 'test', os.path.abspath('testdata/eeg/stub.cnt'))
     img = niprov.ProvenanceContext().get().byLocation(newfile)
     self.assertEqual(img.provenance['subject'], 'Jane Doe')
     self.assertEqual(img.provenance['size'], os.path.getsize(newfile))
示例#4
0
 def test_Discover(self):
     import niprov
     niprov.discover('testdata')
     img = niprov.ProvenanceContext().get().byLocation(
         os.path.abspath('testdata/dicom/T1.dcm'))
     self.assertEqual(img.provenance['dimensions'], [80, 80, 10])
     img = niprov.ProvenanceContext().get().byLocation(
         os.path.abspath('testdata/eeg/stub.cnt'))
     self.assertEqual(img.provenance['subject'], 'Jane Doe')
示例#5
0
 def test_Narrative_file(self):
     import niprov
     niprov.discover('testdata')
     pth = os.path.abspath('testdata/dicom/T1.dcm')
     provenance = niprov.ProvenanceContext().get().byLocation(pth)
     text = niprov.export(provenance, 'direct', 'narrated')
     self.assertEqual(text, (
         "This is a T1 image. It was recorded August 5, "
         "2014. The participant's name is 05aug14test. It is 158KB in size. "
     ))
示例#6
0
    def test_Log(self):
        import niprov

        niprov.discover("testdata")
        newfile = os.path.abspath("temp/smoothed.test")
        self.touch(newfile)
        niprov.log(newfile, "test", os.path.abspath("testdata/eeg/stub.cnt"))
        img = niprov.ProvenanceContext().get().byLocation(newfile)
        self.assertEqual(img.provenance["subject"], "Jane Doe")
        self.assertEqual(img.provenance["size"], os.path.getsize(newfile))
示例#7
0
    def test_Narrative_file(self):
        import niprov

        niprov.discover("testdata")
        pth = os.path.abspath("testdata/dicom/T1.dcm")
        provenance = niprov.ProvenanceContext().get().byLocation(pth)
        text = niprov.export(provenance, "direct", "narrated")
        self.assertEqual(
            text,
            (
                "This is a T1 image. It was recorded August 5, "
                "2014. The participant's name is 05aug14test. It is 158KB in size. "
            ),
        )
示例#8
0
 def test_bySubject(self):
     import niprov
     niprov.discover('testdata')
     provenance = niprov.ProvenanceContext().get().bySubject('05aug14test')
     niprov.print_(provenance)
示例#9
0
 def test_Export_terminal(self):
     import niprov
     niprov.discover('testdata')
     pth = os.path.abspath('testdata/dicom/T1.dcm')
     provenance = niprov.ProvenanceContext().get().byLocation(pth)
     niprov.print_(provenance)
示例#10
0
    def test_bySubject(self):
        import niprov

        niprov.discover("testdata")
        provenance = niprov.ProvenanceContext().get().bySubject("05aug14test")
        niprov.print_(provenance)