def smooth_total(data, mask_data):

    # Find the voxels that belong to the spinal cord
    X, Y, Z = (mask_data > 0).nonzero()

    # Define useful variable
    N = len(X) # number of voxels in the spinal cord segmentation

    # Apply the filter to the original data
    smoothed_sc_data = apply_filter(data)

    # Replace the original spinal cord data by the smoothed one in the original data
    for i in range(0, N):
        data[X[i]][Y[i]][Z[i]] = smoothed_sc_data[X[i]][Y[i]][Z[i]]

    # Return the corrected data
    return data
Apply the smoothing to the original data and return the original data where the original
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/sct_apply_local_filter.py/smooth_total