# Last edited on 2010-04-26 01:46:15 by stolfilocal VIEW := NO PLOT := YES SHOW := YES # Ranges for gnuplots: Z_MIN := -1.5 Z_MAX := +8.5 Z_STEP := 2.0 G_MAX := 4.0 ERR_MAX := 2.0 # ---------------------------------------------------------------------- # PROGRAMS: SHELL = /bin/sh # EPS_VIEW := ghostview EPS_VIEW := gv FNI_VIEW := fni_view FNI_TO_PNM := fni_to_pnm FNI_PLOT := fni_plot .PHONY:: \ tidy \ single-level \ conv-slopes conv-weight conv-height \ view-slopes view-weight view-height delete-views \ show-slopes show-weight show-height delete-shows \ plot-slopes plot-weight plot-height delete-plots # all: all: all-figs # ==================================================================== # Cleanup tidy: clean clean:: -/bin/rm -f *.{pgm,ppm,eps,png} # ====================================================================== # File prefixes: TEST_PREFIX := pyr LEVELS := 00 01 02 03 04 05 all-figs: @echo "TEST_PREFIX = ${TEST_PREFIX}" for lev in ${LEVELS} ; do \ ${MAKE} LEVEL=$$lev single-level ; \ done # ======================================================================== # Recursive make - caller must define ${LEVEL} ifneq "/${LEVEL}" "/" IN_PREFIX := ${TEST_PREFIX}-${LEVEL} OUT_PREFIX := ${IN_PREFIX} IN_G_FNI := ${IN_PREFIX}-G.fni IN_W_FNI := ${IN_PREFIX}-W.fni IN_Z_FNI := ${IN_PREFIX}-Z.fni # PGM/PPM versions of FNI files: OUT_Z_PGM := ${OUT_PREFIX}-Z.pgm OUT_W_PGM := ${OUT_PREFIX}-W.pgm OUT_G_PPM := ${OUT_PREFIX}-G.ppm # PNG versions of FNI files: OUT_Z_PNG := ${OUT_PREFIX}-Z.png OUT_W_PNG := ${OUT_PREFIX}-W.png OUT_G_PNG := ${OUT_PREFIX}-G.png # EPS plot files: OUT_GX_PLEPS := ${OUT_PREFIX}-GX-plot.eps OUT_GY_PLEPS := ${OUT_PREFIX}-GY-plot.eps OUT_W_PLEPS := ${OUT_PREFIX}-W-plot.eps OUT_Z_PLEPS := ${OUT_PREFIX}-Z-plot.eps # EPS images: OUT_G_EPS := ${OUT_PREFIX}-G.eps OUT_W_EPS := ${OUT_PREFIX}-W.eps OUT_Z_EPS := ${OUT_PREFIX}-Z.eps # Actions to perform: CONV_ACTIONS := conv-slopes conv-weight conv-height ifeq "/${VIEW}" "/YES" VIEWACTIONS := delete-views view-slopes view-weight view-height else VIEWACTIONS := delete-views endif ifeq "/${SHOW}" "/YES" SHOWACTIONS := delete-shows show-slopes show-weight show-height else SHOWACTIONS := delete-shows endif ifeq "/${PLOT}" "/YES" PLOTACTIONS := delete-plots plot-slopes plot-weight plot-height else PLOTACTIONS := delete-plots endif single-level: ${CONV_ACTIONS} ${VIEW_ACTIONS} ${SHOW_ACTIONS} ${PLOT_ACTIONS} # ====================================================================== # 3D view of images with fni_view(1) view-slopes: ${IN_G_FNI} fni_view \ -channel 0 \ -scale 5.0 \ ${IN_G_FNI} view-height: ${IN_Z_FNI} fni_view \ -channel 0 \ -scale 1.0 \ -texture ${IN_Z_FNI} \ ${IN_Z_FNI} view-weight: ${IN_W_FNI} fni_view \ -channel 0 \ -scale 1.0 \ ${IN_W_FNI} delete-views: # ====================================================================== # Show image converted to PPM with fni_to_pnm show-slopes: ${IN_G_FNI} fni_to_pnm \ -channels 0 1 0 \ -center 0 -uniform \ < ${IN_G_FNI} \ > ${OUT_G_PPM} -display -title '%f' -filter box -resize '400%' ${OUT_G_PPM} show-weight: ${IN_W_FNI} fni_to_pnm \ -channel 0 \ -min 0 -max 1 \ < ${IN_W_FNI} \ > ${OUT_W_PPM} -display -title '%f' -filter box -resize '400%' ${OUT_W_PPM} show-height: ${IN_Z_FNI} fni_to_pnm \ -channel 0 \ -min ${Z_MIN} -max ${Z_MAX} \ < ${IN_Z_FNI} \ > ${OUT_Z_PGM} -display -title '%f' -filter box -resize '400%' ${OUT_Z_PGM} delete-shows: /bin/rm -f ${OUT_Z_PGM} /bin/rm -f ${OUT_G_PPM} /bin/rm -f ${OUT_W_PPM} # ====================================================================== # Convert FNI files to grayscale/color EPS images Z_MIN_LEV := ${shell gawk -v n=${LEVEL} -v z=${Z_MIN} 'BEGIN { print z*exp(log(0.5)*n); }'} Z_MAX_LEV := ${shell gawk -v n=${LEVEL} -v z=${Z_MAX} 'BEGIN { print z*exp(log(0.5)*n); }'} conv-slopes: ${IN_G_FNI} fni_to_pnm \ -channels 0 1 0 \ -center 0 \ -width ${G_MAX} / 0.5 \ < ${IN_G_FNI} \ | pnmdepth 255 \ | pnmtopsx -noturn -scale 8.00 \ > ${OUT_G_EPS} -display -filter box -resize '128x' ${OUT_G_EPS} conv-weight: ${IN_W_FNI} fni_to_pnm \ -channel 0 \ -min 0 -max 1 \ < ${IN_W_FNI} \ | pnmdepth 255 \ | pnmtopsx -noturn -scale 8.00 \ > ${OUT_W_EPS} -display -filter box -resize '128x' ${OUT_W_EPS} conv-height: ${IN_Z_FNI} fni_to_pnm \ -channel 0 \ -min ${Z_MIN_LEV} -max ${Z_MAX_LEV} \ < ${IN_Z_FNI} \ | pnmdepth 255 \ | pnmtopsx -noturn -scale 8.00 \ > ${OUT_Z_EPS} -display -filter box -resize '128x' ${OUT_Z_EPS} # ====================================================================== # 3D Postscript plots of samples, with fni_plot(1) plot-slopes: ${IN_G_FNI} fni_plot \ -channel 0 -title "dZ/dX" \ -range -${G_MAX} +${G_MAX} \ < ${IN_G_FNI} \ > ${OUT_GX_PLEPS} && \ ${PSVIEW} ${OUT_GX_PLEPS} fni_plot \ -channel 1 -title "dZ/dY" \ -range -${G_MAX} +${G_MAX} \ < ${IN_G_FNI} \ > ${OUT_GY_PLEPS} && \ ${PSVIEW} ${OUT_GY_PLEPS} plot-weight: ${IN_W_FNI} fni_plot \ -channel 0 -title "W" \ -range -0.1 2.1 \ -ztics 0.5 \ < ${IN_W_FNI} \ > ${OUT_W_PLEPS} && \ ${PSVIEW} ${OUT_W_PLEPS} plot-height: ${IN_Z_FNI} fni_plot \ -channel 0 -title "Z" \ -range ${Z_MIN} ${Z_MAX} \ -ztics ${Z_STEP} \ < ${IN_Z_FNI} \ > ${OUT_Z_PLEPS} && \ ${PSVIEW} ${OUT_Z_PLEPS} delete-plots: /bin/rm -f ${OUT_GX_PLEPS} ${OUT_GY_PLEPS} /bin/rm -f ${OUT_Z_PLEPS} /bin/rm -f ${OUT_W_PLEPS} # # End make with ${LEVEL} ###################################################################### endif