import os
import pandas as pd

def create_target_points(fixed_results, save_path):
    fixed_results = os.path.join(fixed_results, 'nodule_info_pos_seg.csv')

    new_fixed_list = []
    selected_columns_names = ['coordX', 'coordY', 'coordZ']
    fixed_df = pd.read_csv(fixed_results)
    fixed_list = fixed_df[selected_columns_names].values.tolist()

    save_path = os.path.join(save_path, 'demo.txt')

    with open(save_path, 'w+') as file:
        file.write('point')
        file.write('\n')
        file.write(str(len(fixed_list)))
        file.write('\n')
        for info in fixed_list:
            file.write(str(info[0]))
            file.write(' ')
            file.write(str(info[1]))
            file.write(' ')
            file.write(str(int(info[2])))
            file.write('\n')



if __name__ == '__main__':
    fixed_results = '/fileser/maozj/Downloads/lung_alg_results/proxima/NODULE/1.2.840.113619.2.55.3.34211586.404.1416367707.480.4.mha'
    save_path = '/root/Documents/GroupLung/demo_tmp/point_moving'
    create_target_points(fixed_results, save_path)