Commit ec9c6371 authored by Vesa Oikonen's avatar Vesa Oikonen

Added spillover demo for web pages

parent b9789158
::
:: Basic demonstration on spillover effect.
:: Requires Inkscape and ImageMagick
::
@echo off
setLocal enableExtensions enableDelayedExpansion
chcp 1252
@echo.
@echo Make result folders
@echo.
if not exist sim1 mkdir sim1
del /Q sim1\*.* > NUL
@echo Make simple image with zero background and a circle containing value 1
simcirc -format=float 2048 512 sim1\data.bin
if not %errorlevel%==0 goto FAILED
flat2img -scanner=HRRT sim1\data.bin sim1\data.v 1 1 2048 2048
if not %errorlevel%==0 goto FAILED
imgunit -us=Bq/cc sim1\data.v
if not %errorlevel%==0 goto FAILED
@echo Make a negative of the image with zeroes inside circle and 1 in background
imgcalc sim1\data.v x -1 sim1\temp.v
if not %errorlevel%==0 goto FAILED
imgcalc sim1\temp.v + 1 sim1\dataneg.v
if not %errorlevel%==0 goto FAILED
@echo Image with zero background and 100 inside circle
imgcalc sim1\data.v x 100 sim1\sim1.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim1.v sim1\sim2.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim2.v sim1\sim3.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim3.v sim1\sim4.v
if not %errorlevel%==0 goto FAILED
copy /Y sim1\sim4.v sim1\c100b0.v
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b0.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b0.v sim1\c100b0.xpro sim1\c100b0.ypro
if not %errorlevel%==0 goto FAILED
@echo Image with 100 background and 0 inside circle
imgcalc sim1\dataneg.v x 100 sim1\sim1.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim1.v sim1\sim2.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim2.v sim1\sim3.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim3.v sim1\sim4.v
if not %errorlevel%==0 goto FAILED
copy /Y sim1\sim4.v sim1\c0b100.v
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c0b100.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c0b100.v sim1\c0b100.xpro sim1\c0b100.ypro
if not %errorlevel%==0 goto FAILED
@echo Image with 50 background and 100 inside circle
imgcalc sim1\data.v x 50 sim1\temp.v
if not %errorlevel%==0 goto FAILED
imgcalc sim1\temp.v + 50 sim1\sim1.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim1.v sim1\sim2.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim2.v sim1\sim3.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim3.v sim1\sim4.v
if not %errorlevel%==0 goto FAILED
copy /Y sim1\sim4.v sim1\c100b50.v
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b50.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b50.v sim1\c100b50.xpro sim1\c100b50.ypro
if not %errorlevel%==0 goto FAILED
@echo Image with 10 background and 100 inside circle
imgcalc sim1\data.v x 90 sim1\temp.v
if not %errorlevel%==0 goto FAILED
imgcalc sim1\temp.v + 10 sim1\sim1.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim1.v sim1\sim2.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim2.v sim1\sim3.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim3.v sim1\sim4.v
if not %errorlevel%==0 goto FAILED
copy /Y sim1\sim4.v sim1\c100b10.v
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b10.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b10.v sim1\c100b10.xpro sim1\c100b10.ypro
if not %errorlevel%==0 goto FAILED
@echo Image with 100 background and 10 inside circle
imgcalc sim1\dataneg.v x 90 sim1\temp.v
if not %errorlevel%==0 goto FAILED
imgcalc sim1\temp.v + 10 sim1\sim1.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim1.v sim1\sim2.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim2.v sim1\sim3.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim3.v sim1\sim4.v
if not %errorlevel%==0 goto FAILED
copy /Y sim1\sim4.v sim1\c10b100.v
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c10b100.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c10b100.v sim1\c10b100.xpro sim1\c10b100.ypro
if not %errorlevel%==0 goto FAILED
@echo Image with 90 background and 100 inside circle
imgcalc sim1\data.v x 10 sim1\temp.v
if not %errorlevel%==0 goto FAILED
imgcalc sim1\temp.v + 90 sim1\sim1.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim1.v sim1\sim2.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim2.v sim1\sim3.v
if not %errorlevel%==0 goto FAILED
imgshrink sim1\sim3.v sim1\sim4.v
if not %errorlevel%==0 goto FAILED
copy /Y sim1\sim4.v sim1\c100b90.v
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b90.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b90.v sim1\c100b90.xpro sim1\c100b90.ypro
if not %errorlevel%==0 goto FAILED
@echo Simulate Gaussian blurring
imgfiltg sim1\c100b0.v sim1\c100b0g20.v 20mm
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b0g20.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b0g20.v sim1\c100b0g20.xpro sim1\c100b0g20.ypro
if not %errorlevel%==0 goto FAILED
tac2svg -y1=0 -y2=100 -x1=-150 -x2=150 -nmt -nxt -nyt sim1\c100b0g20.svg -l sim1\c100b0.xpro sim1\c100b0g20.xpro
if not %errorlevel%==0 goto FAILED
imgfiltg sim1\c0b100.v sim1\c0b100g20.v 20mm
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c0b100g20.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c0b100g20.v sim1\c0b100g20.xpro sim1\c0b100g20.ypro
if not %errorlevel%==0 goto FAILED
tac2svg -y1=0 -y2=100 -x1=-150 -x2=150 -nmt -nxt -nyt sim1\c0b100g20.svg -l sim1\c0b100.xpro sim1\c0b100g20.xpro
if not %errorlevel%==0 goto FAILED
imgfiltg sim1\c100b50.v sim1\c100b50g20.v 20mm
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b50g20.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b50g20.v sim1\c100b50g20.xpro sim1\c100b50g20.ypro
if not %errorlevel%==0 goto FAILED
tac2svg -y1=0 -y2=100 -x1=-150 -x2=150 -nmt -nxt -nyt sim1\c100b50g20.svg -l sim1\c100b50.xpro sim1\c100b50g20.xpro
if not %errorlevel%==0 goto FAILED
imgfiltg sim1\c100b10.v sim1\c100b10g20.v 20mm
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b10g20.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b10g20.v sim1\c100b10g20.xpro sim1\c100b10g20.ypro
if not %errorlevel%==0 goto FAILED
tac2svg -y1=0 -y2=100 -x1=-150 -x2=150 -nmt -nxt -nyt sim1\c100b10g20.svg -l sim1\c100b10.xpro sim1\c100b10g20.xpro
if not %errorlevel%==0 goto FAILED
imgfiltg sim1\c10b100.v sim1\c10b100g20.v 20mm
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c10b100g20.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c10b100g20.v sim1\c10b100g20.xpro sim1\c10b100g20.ypro
if not %errorlevel%==0 goto FAILED
tac2svg -y1=0 -y2=100 -x1=-150 -x2=150 -nmt -nxt -nyt sim1\c10b100g20.svg -l sim1\c10b100.xpro sim1\c10b100g20.xpro
if not %errorlevel%==0 goto FAILED
imgfiltg sim1\c100b90.v sim1\c100b90g20.v 20mm
if not %errorlevel%==0 goto FAILED
img2tif -s=100 -rb sim1\c100b90g20.v
if not %errorlevel%==0 goto FAILED
imgprofi -pxl=127,127,1 sim1\c100b90g20.v sim1\c100b90g20.xpro sim1\c100b90g20.ypro
if not %errorlevel%==0 goto FAILED
tac2svg -y1=0 -y2=100 -x1=-150 -x2=150 -nmt -nxt -nyt sim1\c100b90g20.svg -l sim1\c100b90.xpro sim1\c100b90g20.xpro
if not %errorlevel%==0 goto FAILED
@echo Convert SVG to PNG
set PROGNAME="C:\Program Files\Inkscape\inkscape.exe"
call !PROGNAME! -z -e "sim1\c0b100g20.png" -w 256 -d 300 -b white "sim1\c0b100g20.svg"
call !PROGNAME! -z -e "sim1\c100b0g20.png" -w 256 -d 300 -b white "sim1\c100b0g20.svg"
call !PROGNAME! -z -e "sim1\c100b10g20.png" -w 256 -d 300 -b white "sim1\c100b10g20.svg"
call !PROGNAME! -z -e "sim1\c100b50g20.png" -w 256 -d 300 -b white "sim1\c100b50g20.svg"
call !PROGNAME! -z -e "sim1\c100b90g20.png" -w 256 -d 300 -b white "sim1\c100b90g20.svg"
call !PROGNAME! -z -e "sim1\c10b100g20.png" -w 256 -d 300 -b white "sim1\c10b100g20.svg"
@echo Add images and profiles together
magick montage -tile 3x1 -geometry 100%%x100%%+0+0 sim1\c100b0.tif sim1\c100b0g20.tif sim1\c100b0g20.png sim1\c100b0g20wop.png
magick montage -tile 3x1 -geometry 100%%x100%%+0+0 sim1\c0b100.tif sim1\c0b100g20.tif sim1\c0b100g20.png sim1\c0b100g20wop.png
magick montage -tile 3x1 -geometry 100%%x100%%+0+0 sim1\c100b50.tif sim1\c100b50g20.tif sim1\c100b50g20.png sim1\c100b50g20wop.png
magick montage -tile 3x1 -geometry 100%%x100%%+0+0 sim1\c100b10.tif sim1\c100b10g20.tif sim1\c100b10g20.png sim1\c100b10g20wop.png
magick montage -tile 3x1 -geometry 100%%x100%%+0+0 sim1\c10b100.tif sim1\c10b100g20.tif sim1\c10b100g20.png sim1\c10b100g20wop.png
magick montage -tile 3x1 -geometry 100%%x100%%+0+0 sim1\c100b90.tif sim1\c100b90g20.tif sim1\c100b90g20.png sim1\c100b90g20wop.png
:PASSED
@echo.
@echo ==========================================================================
@echo All steps fine.
@echo ==========================================================================
goto END
:FAILED
@echo.
@echo ==========================================================================
@echo Failed!
@echo ==========================================================================
pause
:END
@echo.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment