reconstruct_png_step_random.sh 909 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #! /bin/bash
  2. if [ -z "$1" ]
  3. then
  4. echo "No argument supplied"
  5. echo "Need data folder"
  6. exit 1
  7. fi
  8. if [ -z "$2" ]
  9. then
  10. echo "No argument supplied"
  11. echo "Need output folder"
  12. exit 1
  13. fi
  14. if [ -z "$3" ]
  15. then
  16. echo "No argument supplied"
  17. echo "Need step output images expected (step of samples)"
  18. exit 1
  19. fi
  20. prefix="p3d_"
  21. build_folder="build"
  22. folder_path=$1
  23. output_folder=$2
  24. step=$3
  25. nb_elements=$(ls -l ${folder_path} | grep ${prefix} | wc -l)
  26. IFS='/' read -ra ADDR <<< "${folder_path}"
  27. folder=${ADDR[-1]}
  28. mkdir -p $output_folder
  29. counter=0
  30. startindex=0
  31. while [ $startindex -lt $nb_elements ]
  32. do
  33. startindex=$(($startindex + $step))
  34. outfile="${folder}_${step}_${counter}.png"
  35. echo $outfile
  36. ./${build_folder}/main/rawls_merge_mean --folder ${folder_path} --random 1 --samples ${step} --outfile $output_folder/$outfile
  37. counter=$(( $counter + 1 ))
  38. done