def calc_displacements(volreg):
    """
    This function calculate volume displacement from motion parameter
    """
    import numpy as np
    import pandas as pd
    output = dict()
    columns = volreg.columns
    output['FD'] = np.abs(np.insert(np.diff(volreg, axis=0), 0, 0, axis=0)
        ).sum(axis=1)
    output['ARD'] = np.abs(np.insert(np.diff(volreg[columns[:3]], axis=0), 
        0, 0, axis=0)).sum(axis=1)
    output['ATD'] = np.abs(np.insert(np.diff(volreg[columns[3:]], axis=0), 
        0, 0, axis=0)).sum(axis=1)
    return pd.DataFrame(output)
