OPTIMAS/convert_npy_to_png.py
def png_conversion(input_data_folder, experiment):
    '''
    takes the images in npy format and convert them into png format for
    visualization purposes. One npy file is outputed as one png image.
    inpupt: path of the folder that contains all the experiments (it is the
            folder with the date of the experiments)
    output: save the images in input_data_folder/experiment/images/
    '''
    files = os.listdir(f'{input_data_folder}/{experiment}/raw_data/')
    for file in tqdm(files):
        #file=files[100]
        if file.endswith('.npy'):
            try:
                img_array = np.load(f'{input_data_folder}/{experiment}/raw_data/{file}')
                json_file_path = f"{input_data_folder}/{experiment}/{experiment}_info.json"
                image_x, image_y = read_image_size(json_file_path)
                #####################################################
                ##### TO CHANGE IN UPDATED PIPELINE VERSION #########
                # img_array = img_array.reshape(image_x, image_y)
                img_array = img_array.reshape(image_y, image_x)
                ####################################################
                output_path = f'{input_data_folder}/{experiment}/images/'
                img_name = output_path+file.replace('.npy', '.png')
                plt.imsave(img_name, img_array, cmap='gray')
            except:
                print(f'cannot convert{str(file)}')

    takes the images in npy format and convert them into png format for
    visualization purposes. One npy file is outputed as one png image.
    inpupt: path of the folder that contains all the experiments (it is the
            folder with the date of the experiments)
    output: save the images in input_data_folder/experiment/images/
    
takes the images in npy format and convert them into png format for
visualization purposes. One npy file is outputed as one png image.
inpupt: path of the folder that contains all the experiments (it is the
folder with the date of the experiments)
output: save the images in input_data_folder/experiment/images
takes the images in npy format and convert them into png format for visualization purposes . One npy file is outputed as one png image . inpupt : path of the folder that contains all the experiments ( it is the folder with the date of the experiments ) output : save the images in input_data_folder / experiment / images
def png_conversion(input_data_folder, experiment):
    files = os.listdir(f'{input_data_folder}/{experiment}/raw_data/')
    for file in tqdm(files):
        if file.endswith('.npy'):
            try:
                img_array = np.load(f'{input_data_folder}/{experiment}/raw_data/{file}')
                json_file_path = f"{input_data_folder}/{experiment}/{experiment}_info.json"
                image_x, image_y = read_image_size(json_file_path)
                img_array = img_array.reshape(image_y, image_x)
                output_path = f'{input_data_folder}/{experiment}/images/'
                img_name = output_path+file.replace('.npy', '.png')
                plt.imsave(img_name, img_array, cmap='gray')
            except:
                print(f'cannot convert{str(file)}')
def png_conversion ( input_data_folder , experiment ) : files = os . listdir ( f'{input_data_folder}/{experiment}/raw_data/' ) for file in tqdm ( files ) : if file . endswith ( '.npy' ) : try : img_array = np . load ( f'{input_data_folder}/{experiment}/raw_data/{file}' ) json_file_path = f"{input_data_folder}/{experiment}/{experiment}_info.json" image_x , image_y = read_image_size ( json_file_path ) img_array = img_array . reshape ( image_y , image_x ) output_path = f'{input_data_folder}/{experiment}/images/' img_name = output_path + file . replace ( '.npy' , '.png' ) plt . imsave ( img_name , img_array , cmap = 'gray' ) except : print ( f'cannot convert{str(file)}' )
takes the images in npy format and convert them into png format for
visualization purposes.
takes the images in npy format and convert them into png format for visualization purposes .
'''
    takes the images in npy format and convert them into png format for
    visualization purposes. One npy file is outputed as one png image.
    inpupt: path of the folder that contains all the experiments (it is the
            folder with the date of the experiments)
    output: save the images in input_data_folder/experiment/images/
    ''' #file=files[100] ##################################################### ##### TO CHANGE IN UPDATED PIPELINE VERSION ######### # img_array = img_array.reshape(image_x, image_y) ####################################################
input_data_folder
experiment