def test_CapillaryPressureCurve(self):

        print('Test_CapillaryPressureCurve : need to improve coverage')

        image = VirtualMaterialsGeneration.CreateTestImage_TetrahedronMedialAxis(
        )
        image[image == 50] = 0
        image[image == 100] = 0

        output = FullMorphology.CapillaryPressureCurve(image,
                                                       porePhaseCode=0,
                                                       inletFace=0,
                                                       voxelLength=1,
                                                       nPoints=3)

        output['Saturation list']
        output['Capillary pressure list (in Pa)']
        output['Ball radius list (in voxel)']
    def test_FullMorphology(self):

        image = VirtualMaterialsGeneration.CreateTestImage_TetrahedronMedialAxis(
        )
        image[image == 50] = 0
        image[image == 100] = 0

        outputImage = FullMorphology.FullMorphology(image,
                                                    inletFace=1,
                                                    voxelLength=1,
                                                    gamma=72e-3,
                                                    pressureList=[10],
                                                    pressureCode=[110])

        #        self.assertTrue( == )
        #        self.assertTrue(np.all( ==))

        print('Test_FullMorphology : need to improve coverage')
Example #3
0
    def test_ExtractNetwork(self):

        #Image 1
        image = VirtualMaterialsGeneration.CreateTestImage_TetrahedronMedialAxis(
        )
        PNMGeometricData = PoreNetworkExtraction.ExtractNetwork(
            image=image,
            phases={
                'void0': 0,
                'void1': 50,
                'void2': 100
            },
            seedMethod='hMaxima',
            seedParam=4)

        nPore = 5
        nInternalLink = 4
        interfaceToPore = np.array([[1, 4], [2, 4], [3, 4], [4, 5]])
        porePhase = np.array([100, 50, 0, 0, 0])

        self.assertTrue(PNMGeometricData['imagePores'].max() == nPore)
        self.assertTrue(PNMGeometricData['imageLiens'].max() == nInternalLink)
        self.assertTrue(
            np.all(PNMGeometricData['interfaceToPore'] == interfaceToPore))
        self.assertTrue(np.all(PNMGeometricData['porePhase'] == porePhase))

        #Image 2
        image = VirtualMaterialsGeneration.CreateTestImage_TetrahedronMedialAxis(
        )
        image[image == 50] = 0
        image[image == 100] = 0
        PNMGeometricData = PoreNetworkExtraction.ExtractNetwork(
            image=image, phases={'void': 0}, seedMethod='hMaxima', seedParam=4)

        nPore = 5
        nInternalLink = 4
        interfaceToPore = np.array([[3, 5], [2, 3], [1, 3], [3, 4]])
        porePhase = np.array([0, 0, 0, 0, 0])

        self.assertTrue(PNMGeometricData['imagePores'].max() == nPore)
        self.assertTrue(PNMGeometricData['imageLiens'].max() == nInternalLink)
        self.assertTrue(
            np.all(PNMGeometricData['interfaceToPore'] == interfaceToPore))
        self.assertTrue(np.all(PNMGeometricData['porePhase'] == porePhase))

        #Image 3
        image = VirtualMaterialsGeneration.CreateTestImage_TwoBalls()
        PNMGeometricData = PoreNetworkExtraction.ExtractNetwork(
            image=image, phases={'void': 0}, seedMethod='hMaxima', seedParam=2)

        nPore = 2
        nInternalLink = 1
        interfaceToPore = np.array([[1, 2]])
        porePhase = np.array([0, 0])

        self.assertTrue(PNMGeometricData['imagePores'].max() == nPore)
        self.assertTrue(PNMGeometricData['imageLiens'].max() == nInternalLink)
        self.assertTrue(
            np.all(PNMGeometricData['interfaceToPore'] == interfaceToPore))
        self.assertTrue(np.all(PNMGeometricData['porePhase'] == porePhase))

        #Image 4
        image = VirtualMaterialsGeneration.CreateTestImage_ThreeBalls()
        PNMGeometricData = PoreNetworkExtraction.ExtractNetwork(
            image=image, phases={'void': 0}, seedMethod='hMaxima', seedParam=2)

        nPore = 3
        nInternalLink = 3
        interfaceToPore = np.array([[2, 3], [1, 3], [1, 2]])
        porePhase = np.array([0, 0, 0])

        self.assertTrue(PNMGeometricData['imagePores'].max() == nPore)
        self.assertTrue(PNMGeometricData['imageLiens'].max() == nInternalLink)
        self.assertTrue(
            np.all(PNMGeometricData['interfaceToPore'] == interfaceToPore))
        self.assertTrue(np.all(PNMGeometricData['porePhase'] == porePhase))

        print(
            'Test_PoreNetworkExtraction_ExtractNetwork : need to improve coverage '
        )