Warning, /epic/scripts/view2/generate_eps is written in an unsupported language. File is not indexed.
0001 #!/usr/bin/env bash
0002
0003 echo "view2 produces a series of XY slices a different z locations."
0004
0005 function print_the_help {
0006 echo "USAGE: $0 <PRIM_FILE> "
0007 echo " OPTIONS: "
0008 echo " -t,--tag filename tag (default: view1)"
0009 exit
0010 }
0011
0012 FILE_TAG="view2"
0013 INPUT_FILE="g4_0000.prim"
0014
0015
0016 POSITIONAL=()
0017 while [[ $# -gt 0 ]]
0018 do
0019 key="$1"
0020
0021 case $key in
0022 -h|--help)
0023 shift # past argument
0024 print_the_help
0025 ;;
0026 -t|--tag)
0027 FILE_TAG="$2"
0028 shift # past argument
0029 shift # past value
0030 ;;
0031 -i|--input)
0032 INPUT_FILE="$2"
0033 shift # past argument
0034 shift # past value
0035 ;;
0036 *) # unknown option
0037 #POSITIONAL+=("$1") # save it in an array for later
0038 echo "unknown option $1"
0039 print_the_help
0040 shift # past argument
0041 ;;
0042 esac
0043 done
0044 set -- "${POSITIONAL[@]}" # restore positional parameters
0045
0046
0047 # units are mm
0048 dawncut 0 0 -1 1 ${INPUT_FILE} ${FILE_TAG}a_temp0.prim
0049 dawncut 0 0 1 1 ${FILE_TAG}a_temp0.prim ${FILE_TAG}a.prim
0050 dawn -d ${FILE_TAG}a.prim
0051 ps2pdf ${FILE_TAG}a.eps ${FILE_TAG}a_full.pdf
0052 gs -o ${FILE_TAG}a.pdf -sDEVICE=pdfwrite \
0053 -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0054 -f ${FILE_TAG}a_full.pdf
0055 pdftoppm ${FILE_TAG}a.pdf ${FILE_TAG}a -png -singlefile -cropbox
0056
0057 # slice at z = 2m
0058 dawncut 0 0 1 2001 ${INPUT_FILE} ${FILE_TAG}b_temp0.prim
0059 dawncut 0 0 -1 -2000 ${FILE_TAG}b_temp0.prim ${FILE_TAG}b.prim
0060 dawn -d ${FILE_TAG}b.prim
0061 ps2pdf ${FILE_TAG}b.eps ${FILE_TAG}b_full.pdf
0062 gs -o ${FILE_TAG}b.pdf -sDEVICE=pdfwrite \
0063 -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0064 -f ${FILE_TAG}b_full.pdf
0065 pdftoppm ${FILE_TAG}b.pdf ${FILE_TAG}b -png -singlefile -cropbox
0066
0067 # slice at z = 1m
0068 dawncut 0 0 1 1001 ${INPUT_FILE} ${FILE_TAG}c_temp0.prim
0069 dawncut 0 0 -1 -1000 ${FILE_TAG}c_temp0.prim ${FILE_TAG}c.prim
0070 dawn -d ${FILE_TAG}c.prim
0071 ps2pdf ${FILE_TAG}c.eps ${FILE_TAG}c_full.pdf
0072 gs -o ${FILE_TAG}c.pdf -sDEVICE=pdfwrite \
0073 -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0074 -f ${FILE_TAG}c_full.pdf
0075 pdftoppm ${FILE_TAG}c.pdf ${FILE_TAG}c -png -singlefile -cropbox
0076
0077 # slice at z = -1m
0078 dawncut 0 0 1 -1000 ${INPUT_FILE} ${FILE_TAG}d_temp0.prim
0079 dawncut 0 0 -1 1001 ${FILE_TAG}d_temp0.prim ${FILE_TAG}d.prim
0080 dawn -d ${FILE_TAG}d.prim
0081 ps2pdf ${FILE_TAG}d.eps ${FILE_TAG}d_full.pdf
0082 gs -o ${FILE_TAG}d.pdf -sDEVICE=pdfwrite \
0083 -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0084 -f ${FILE_TAG}d_full.pdf
0085 pdftoppm ${FILE_TAG}d.pdf ${FILE_TAG}d -png -singlefile -cropbox
0086
0087 # slice at z = -2m
0088 dawncut 0 0 1 -2000 ${INPUT_FILE} ${FILE_TAG}e_temp0.prim
0089 dawncut 0 0 -1 2001 ${FILE_TAG}e_temp0.prim ${FILE_TAG}e.prim
0090 dawn -d ${FILE_TAG}e.prim
0091 ps2pdf ${FILE_TAG}e.eps ${FILE_TAG}e_full.pdf
0092 gs -o ${FILE_TAG}e.pdf -sDEVICE=pdfwrite \
0093 -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0094 -f ${FILE_TAG}e_full.pdf
0095 pdftoppm ${FILE_TAG}e.pdf ${FILE_TAG}e -png -singlefile -cropbox
0096
0097
0098 #https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
0099 # % dawncut a b c d input-file [output-file]
0100 #
0101 # input-file : Source DAWN-format file describing a 3D scene.
0102 #
0103 # output-file: Output DAWN-format file describing a plane-clipped
0104 # 3D scene. The default output stream is stdout.
0105 #
0106 # a, b, c, d : Parameters a, b, c, and d are double values to
0107 # define a clipping plane described with the following
0108 # equation:
0109 #
0110 # ax + by + cz + d = 0.
0111 #
0112 # Vector (a,b,c) defines the normal vector of
0113 # the clipping plane.
0114 # 3D scene data in the half space at the front side
0115 # of the clipping plane are clipped out and erased.
0116 # The normal vector (a,b,c) needs not be a unit vector.
0117 # If it is a unit vector, parameter "d" gives distance
0118 # between the clipping plane and origin (0,0,0).