ExamplesΒΆ

This page contains some examples on how to use pi2 for simple (and some not so simple) tasks. All the examples are given in Python 3.6. They can be found in a single Python file here.

The examples require a few small images that can be downloaded from here, or from GitHub.

In order to run the examples, please run this initialization first (make sure that the file paths point to correct locations):

import numpy as np
from pi2py2 import *
pi = Pi2()

# Define convenience functions that return input and output file names.
# This is just to avoid copying the paths to all the examples in case they change.
def input_file(filename='t1-head_256x256x129.raw'):
        return '../../test_input_data/' + filename

def input_file_bin():
        return '../../test_input_data/t1-head_bin_256x256x129.raw'

def output_file(name):
        return '../../test_output_data/pi2py2/' + name