can't push my code to the repo

I can't push my code to the repo. The code added lines to improve thumbnail quality

# Authors: Ghislain Antony Vaillant <g.vaillant@imperial.ac.uk>
#          Jonathan Passerat-Palmbach <j.passerat-palmbach@imperial.ac.uk>
# Amended: Jianliang Gao <j.gao@imperial.ac.uk> and Amir Alansary <a.alansary14@imperial.ac.uk> 20 August 2019
from __future__ import division


def parse_args():
    from argparse import ArgumentParser

    DESCRIPTION = 'Generate a thumbnail from a NIfTI file'

    parser = ArgumentParser(prog='nithumb', description=DESCRIPTION)
    parser.add_argument('inputfile', help='input NIfTI file')
    parser.add_argument('snapshot', help='output snapshot')
    parser.add_argument('thumbnail', help='output thumbnail')
    parser.add_argument('--snapshot_size', '-ss', type=int, nargs=2, default=(256, 256),
            help='size of the snapshot')
    parser.add_argument('--thumbnail_size', '-ts', type=int, nargs=2, default=(256, 256),
            help='size of the thumbnail')

    return parser.parse_args()


def main():
    from nibabel import load,as_closest_canonical,flip_axis #added as_closest_canonical,flip_axis for correct classic orientation
    from PIL import Image
    import numpy as np
    from shutil import copyfile

    parsed = parse_args()
    try:
    # correct the orientation of image
       image_tmp = load(parsed.inputfile)
       image_tmp = as_closest_canonical(image_tmp)

    # Load image with the correct orientation.
       image = image_tmp.get_data().swapaxes(0, 1)
       image = flip_axis(image, axis=0)
       image = flip_axis(image, axis=1)
    # Threshold outlier intensity values based on percentiles
       p5 = np.percentile(image,5)
       p95 = np.percentile(image,98)
       image[image<5] = p5
       image[image>98] = p95

    # Scale intensities to fit to 256 values.
       image = ((image - image.min()) *
             (255.0 / (image.max() - image.min()))).astype('uint8')

    # Select the centre slice if 3D. Centre frame if 4D
       image = image[:, :, :, image.shape[3]//2] if image.ndim == 4 else image
       image = image[:, :, image.shape[2]//2] if image.ndim == 3 else image
    # Generate and save the snapshot and its thumbnail.
       size=256,256
       if max(image.shape)>=256:
          img_new = Image.fromarray(image)   
          img_new.thumbnail(size, Image.ANTIALIAS) ## for keeping the ratio
          img_new.save(parsed.snapshot)
  #  Image.fromarray(image).resize(parsed.thumbnail_size).save(parsed.thumbnail)
          img_new = Image.fromarray(image)   
          img_new.thumbnail(size, Image.ANTIALIAS) ## for keeping the ratio
          img_new.save(parsed.thumbnail)
          del img_new
       else:
          img_size = image.shape
          aspect_ratio = float(256 /max(image.shape))
          new_size = tuple([int(x*aspect_ratio) for x in img_size])
          Image.fromarray(image).resize(new_size).save(parsed.snapshot)
          Image.fromarray(image).resize(new_size).save(parsed.thumbnail)
       del image       
    except FileNotFoundError:
       copyfile("/homes/jgao/GIT/nithumb/image_not_found.gif", parsed.snapshot)
       copyfile("/homes/jgao/GIT/nithumb/image_not_found.gif", parsed.thumbnail)

if __name__ == '__main__':
    main()
Edited by jgao
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information