Ejemplo n.º 1
0
    def test_valid_MR_dataset(self):
        """
        valid MRI dataset
        """
        P13 = MRAnalysis(13, './testing')
        self.assertFalse(P13.valid)

        P11 = MRAnalysis(11, './testing')
        self.assertTrue(P11.valid)

        P14 = MRAnalysis(14, './testing')
        self.assertTrue(P14.valid)
Ejemplo n.º 2
0
    def test_established_ece_match(self):
        """
        MRI ECE : Histology ECE for if ECE present in entire patient
        """
        P10 = MRAnalysis(10, './testing')
        self.assertTrue(P10.ece_match['established_match'] == 'True_Positive')

        P11 = MRAnalysis(11, './testing')
        self.assertTrue(P11.ece_match['established_match'] == 'False_Negative')

        P14 = MRAnalysis(14, './testing')
        self.assertTrue(P14.ece_match['established_match'] == 'True_Negative')
Ejemplo n.º 3
0
 def test_histology_ECE(self):
     """
     Histology JSON ECE parsing
     """
     P10 = LesionAnalysis(10, './testing')
     self.assertTrue(P10.histology['index']['Staging'] == 'T3a')
     self.assertTrue(P10.histology['index']['ECE_extent'] == 'Established')
     P10 = MRAnalysis(10, './testing')
     self.assertTrue(P10.histology['index']['Staging'] == 'T3a')
     self.assertTrue(P10.histology['index']['ECE_extent'] == 'Established')
     P11 = MRAnalysis(11, './testing')
     self.assertTrue(P11.histology['index']['Staging'] == 'T3b')
     self.assertTrue(P11.histology['index']['ECE_extent'] == 'Established')
Ejemplo n.º 4
0
 def test_mri_lesion(self):
     """
     MRI file parsing for index lesion
     """
     P11 = MRAnalysis(11, './testing')
     self.assertTrue(P11.mri['index']['region'] == '9p')
     self.assertTrue(P11.mri['index']['IOS'] == 3)
     # these tests depend on Prostate27, but I'll include them too
     self.assertTrue(P11.mri['index']['location'] == 'posterior')
     self.assertTrue(P11.mri['index']['zone'] == 'peripheral zone')
     # these tests are only relevant for MRI data
     self.assertTrue(P11.mri['index']['Gleason'] == 7)
     self.assertTrue(P11.mri['index']['diameter_mm'] == 8)
     self.assertTrue(P11.mri['index']['ECE'] == False)
     self.assertTrue(P11.mri['index']['lesion_number'] == 1)
     # test for case with multiple IOS3 lesions (top line in text file is index)
     P14 = MRAnalysis(14, './testing')
     self.assertTrue(P14.mri['index']['region'] == '10p')
     self.assertTrue(P14.mri['index']['IOS'] == 3)
     self.assertFalse(P14.mri['index']['region'] == '3p')
Ejemplo n.º 5
0
    def test_histology_mri_index_match(self):
        """
        histology / MRI index match
        """
        P11 = MRAnalysis(11, './testing')
        self.assertFalse(P11.index_match['exact'])
        self.assertTrue(P11.index_match['nn'])

        P14 = MRAnalysis(14, './testing')
        self.assertFalse(P14.index_match['exact'])
        self.assertTrue(P14.index_match['nn'])

        P13 = MRAnalysis(13, './testing')
        self.assertFalse(P13.valid)

        P11 = MRAnalysis(11, './testing')
        self.assertTrue(P11.valid)

        P14 = MRAnalysis(14, './testing')
        self.assertTrue(P14.valid)
Ejemplo n.º 6
0
    def test_index_ece_match(self):
        """
        MRI ECE : Histology ECE for index lesions
        """
        P11 = MRAnalysis(11, './testing')
        self.assertFalse(P11.ece_match['index']['False_Positive'])
        self.assertFalse(P11.ece_match['index']['Established'])
        self.assertFalse(P11.ece_match['index']['Focal'])
        self.assertFalse(P11.ece_match['index']['True_Negative'])

        P10 = MRAnalysis(10, './testing')
        self.assertFalse(P10.ece_match['index']['False_Positive'])
        self.assertTrue(P10.ece_match['index']['Established'])
        self.assertFalse(P10.ece_match['index']['Focal'])
        self.assertFalse(P10.ece_match['index']['True_Negative'])

        P14 = MRAnalysis(14, './testing')
        self.assertFalse(P14.ece_match['index']['False_Positive'])
        self.assertFalse(P14.ece_match['index']['Established'])
        self.assertFalse(P14.ece_match['index']['Focal'])
        self.assertFalse(P14.ece_match['index']['True_Negative'])
 def test_MR_no_index_match(self):
     """
     no histology index lesion using MRAnalysis class
     """
     P13 = MRAnalysis(13, './testing')
     self.assertFalse(P13.check_index_match())
Ejemplo n.º 8
0
 def test_MR_no_index_match(self):
     """
     no histology index lesion using MRAnalysis class
     """
     P13 = MRAnalysis(13, './testing')
     self.assertFalse(P13.check_index_match())
Ejemplo n.º 9
0
Pece_index_TN = []
Pece_index_FP = []
Pece_index_miss = []
# check ECE for patient-level matches
Pece_pm_TP = []
Pece_pm_FN = []
Pece_pm_TN = []
Pece_pm_FP = []
# check ECE for patient level matches only on Established focal extent lesions
Pece_em_TP = []
Pece_em_FN = []
Pece_em_TN = []
Pece_em_FP = []

for p in range(56, 107):
    P = MRAnalysis(p)
    if P.valid:
        Ptotal.append(p)
        if P.index_match['exact']:
            Pexact.append(p)
        if P.index_match['nn']:
            Pnn.append(p)
        else:
            Pmiss.append(p)
        if P.benign_match['atrophy']:
            Patrophy.append(p)
        if P.benign_match['bph']:
            Pbph.append(p)

        Pclinsig.append(P.clin_sig_match)
        Pclinsigsens.append(P.clin_sig_sensitivity)