Example #1
0
def test_conversion_vox_png():
    img = Image.fromVox("tests/data/test_img.vox")
    img.exportAsPng("tests/data/test_img.png")
    img_test = Image.fromPng("tests/data/test_img.png")
    assert np.alltrue(img_test == img)
Example #2
0
def test_pgm_vox():
    img = Image.fromPgm("tests/data/test_img.pgm")
    img.exportAsVox("tests/data/test_img.vox")
    img_test = Image.fromVox("tests/data/test_img.vox")
    assert np.alltrue(img_test == img)
Example #3
0
if __name__ == "__main__":
    parser = argparse.ArgumentParser()

    parser.add_argument("-fun", "--fun", type=str, required=True)
    parser.add_argument('-model', "--model", type=str, required=True)
    parser.add_argument('-ti', "--ti", type=str, required=True)
    parser.add_argument('-output', "--output", type=str, default="output.csv")
    parser.add_argument("-n-samples", "--n-samples", type=int, default=100)
    parser.add_argument("-n-ti", "--n-ti", type=int, default=100)

    args = parser.parse_args()
    model = GAN(args.model)

    if ".vox" in args.ti:
        ti = Image.fromVox(args.ti)
    elif ".gslib" in args.ti:
        ti = Image.fromGslib(args.ti)

    ti.threshold(thresholds=[1], values=[0, 1])
    ti = ti.asArray()

    if args.fun == "conn":
        stat_fun = mpstool.connectivity.get_function
    elif args.fun == "vario":
        stat_fun = mpstool.stats.variogram
    else:
        raise Exception(
            "argument -fun not recognized. Should be 'conn' or 'vario' ")

    # Read connectivity for the TI : min and max of values