Some of these tools are available in a plugin menu for QVox. Run qvox, go to "Plugins" / "Manage plugins" / "Add plugin menu", select npic-qvox-plugins.qpx, "Rebuild menu". You should now have the "Plugins" / "Npic tools" menu.
| npic-new | Create an image, with all pixels set to 0. | |
| npic-info | Print info on image or mask file. | |
| npic-conv | Convert image file in other file format from its extension. | |
| npic-slice | Extract a slice from a volume or hypervolume. | |
| npic-draw | Draw in images by changing pixel values. | |
| npic-val | Change pixel values. | |
| npic-sum | Sum up pixel values. | |
| npic-diff | Compare two images, pixel per pixel. | |
| npic-sedt | Compute Square Euclidean Distance Transforms. | |
| npic-mask | Create a mask, set vectors and properties. | |
| npic-wdt | Compute Weighted Distance Transforms (a.k.a. chamfer DT). | |
| npic-wd-norm | Test if a weighted (= chamfer) distance induces a norm. | |
| npic-mlut | Compute Medial Axis, LUT and Mlut for Distance Transforms. | |
| npic-dtma | Compute Distance Transform and extract Medial Axis from it. | |
| npic-ball.sh | Generate a Distance Ball. | |
| npic-bissec | Compute bissector of two points for two distances. | |
| npic-metbases | Compute metric bases and dimension. | |
| npic-print | Print image as text in console. | |
| npic-xfig | Convert an 2-d image file to an Xfig file. | |
| npic-geomv | Convert a 3-d image file to a geomview file. | |
| npic-anim4d.sh | Show a hyper-volume slice by slice with geomview. |
| npic-templa | expand Npic @macros in C files. |
npic-new - Create an image, with all pixels set to 0. Usage: npic-new -h | -help | --help : print help npic-new out1 -2c|-2l|-2d|-2q y:x : create y*x 2D image npic-new out1 -3c|-3l|-3d|-3q z:y:x : create z*y*x 3D image npic-new out1 -4c|-4l|-4d|-4q t:z:y:x : create t*z*y*x 4D image npic-new out1 -5c|-5l|-5d|-5q s:t:z:y:x : create s*t*z*y*x 5D image npic-new out1 -6c|-6l|-6d|-6q r:s:t:z:y:x : create r*s*t*z*y*x 6D image out1 : image file in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format r, s, t, z, y, x : positive integers. pixel types : c = unsigned char, d = double, q = 4 unsigned shorts, l = signed long. |
npic-info - Print info on image or mask file. Usage: npic-info -h | -help | --help : print help npic-info in1 : print infos on in1 in1 : image or mask file Succeed if in1 can be read. |
npic-conv - Convert image file in other file format from its extension. Usage: npic-conv -h | -help | --help : print help npic-conv in1 out1 [-c|-l|-d] : convert in1 to out1 -c|-l|-d : convert pixel type to char, long, double in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format |
npic-slice - Extract a slice from a volume or hypervolume.
Usage:
npic-slice -h | -help | --help : print help
npic-slice in1 out1 [options] : cut in1 to out1
Options:
-c|-l|-d : convert pixel type to char, long, double
-x|-y|-z|-t|-s|-r k : cut slice k for given coordinate.
different slices can be achieved at the same time. Each slice decreases
the dimension; the result must have at least dimension 2.
in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
Example: SEDT on a volume, shown slice by slice (please open a wide terminal!)
./npic-sedt -dt -hirata ../images/klette_3c.pan.gz tmp1.npz
for ((i = 24; i < 46 ; i++)); do
echo "Slice x=$i"
if ./npic-slice tmp1.npz tmp2.npz -x $i
then ./npic-print tmp2.npz | sed -e 's/ 0/ ./g'
else break ; fi ; sleep 1
done
|
npic-draw - Draw in images by changing pixel values.
Usage:
npic-draw -h | -help | --help : print help
npic-draw in1 out1 actions ...
in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
actions:
-point p c : draw point p in color c
-rect p q c : draw rectangle bounded by p and q in color c
-ellip p q c : draw ellipse bounded by p and q in color c
-line a b c d : draw bresenham segment [a, b] in colors c to d
p, q: coordinates y:x or z:y:x or t:z:y:x or s:t:z:y:x or r:s:t:z:y:x
depending on dimension;
they can leave outside the image (the drawing is cut).
a, b: idem but coordinates lying inside image.
c, d: integer or double or r:g:b:a, depending on image type.
Example: create a 4D image:
./npic-new tmp2.npz -4l 24:28:25:30
./npic-draw tmp2.npz tmp2.npz \
-rect 12:3:10:21 19:11:14:29 100 \
-ellip 5:2:21:0 9:2:25:29 200 \
-rect 20:12:20:11 22:14:24:29 300 \
-ellip 17:20:2:8 21:24:20:22 400
|
npic-val - Change pixel values. Usage: npic-val -h | -help | --help : print help npic-val in1 out1 actions ... in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format actions: -fill a : set all pixels -> a -change a b : a -> b -exchange a b : a <-> b -thr-lt a b : pixels < a -> b -thr-gt a b : pixels > a -> b -thr-le a b : pixels <= a -> b -thr-ge a b : pixels >= a -> b a, b: integer or double or r:g:b:a, depending on image type. |
npic-sum - Sum up pixel values.
Usage:
npic-sum -h | -help | --help : print help
npic-sum -linear a b in1 out1 : out1 := in1*a + b
npic-sum -bilin a b c in1 in2 out1 : out1 := in1*a + in2*b + c
npic-sum -trilin a b c d in1 in2 in3 out1 : out1 := in1*a + in2*b + in3*c + d
npic-sum -quad a b c in1 out1 : out1 := in1^2*a + in1*b + c
npic-sum -biquad a b c d e in1 in2 out1 : out1 := in1^2*a + in1*b +
in2^2*c + in2*d + e
in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
a, b, c, d, e : float.
|
npic-diff - Compare two images, pixel per pixel. Usage: npic-diff -h | -help | --help : print help npic-diff in1 in2 options : compare pixels Options: -c|-l|-d : convert pixel type to char, long, double for both images -b : binary comparison (pixel == 0 or != 0) -p x : max number of printed differences, default is 20 in1, in2 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format |
npic-sedt - Compute Square Euclidean Distance Transforms.
Usage:
npic-sedt -h | -help | --help : print help
npic-sedt what how in1 out1 : compute distance transforms
what: -dt : compute SEDT
-idt : idem with infinite borders
-rdt : compute reverse SEDT
how: -hirata : with Hirata's algorithm (fastest)
-saito : with Saito's et al algorithm
-quadra : with quadratic algorithm (slowest)
-verify : compare the three algorithms; save hirata
in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
|
npic-mask - Create a mask, set vectors and properties.
Usage:
npic-mask -h | -help | --help : print help
npic-mask m1 actions ...
m1 : mask file in .nmask[.gz|bz2|7z] format
actions:
-create -2l|-2d|-3l|-3d|-4l|-4d|-5l|-5d|-6l|-6d : create a new empty mask
2,3,4,5,6 = dimension ; l = signed int32 ; d = double.
-dist|-med|-conv : add property Nature: Distance or MedialAxis
or Convolution.
-wd|-sed|-fed|-ced : add property DistanceType: Weighted or
SquaredEuclidean or FloorEuclidean or CeilEuclidean.
-vec r:s:t:z:y:x:h | s:t:z:y:x:h | t:z:y:x:h | z:y:x:h | y:x:h :
insert vector and value h depending of the mask dimension.
-ghalf : add property AddSym: GSymToHalfMask
keep small file, symmetries will be added after reading.
-comphalf : compute half mask by G-symmetries
insert all symmetries in the file, give large file.
-print : print mask to stdout
|
npic-wdt - Compute Weighted Distance Transforms (a.k.a. chamfer DT).
Usage:
npic-wdt -h | -help | --help : print help
npic-wdt what mask in1 out1 : compute distance transforms
what: -dt : compute WDT
-idt : idem with infinite borders
-rdt : compute reverse WDT
mask : mask file in .nmask[.gz|bz2|7z] format (see npic-mask -h)
in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
|
npic-wd-norm - Test if a weighted (= chamfer) distance induces a norm.
Usage:
npic-wd-norm -h | -help | --help : print help
npic-wd-norm mask r [-o out1] [-p j] :
compute a DT_inf on a (2r+1)^dim centred image, then scan for
homogeneity and positive definiteness with a sieve on visible vectors.
-o out1 : save DT_inf (default is don't save). Wrong vectors
are marked as negative.
-p j : print the j first series of wrong vectors (default is 10).
-p -1 : silent mode, only print "NORM: YES" or "NORM: NO".
mask : mask file in .nmask[.gz|bz2|7z] format (see npic-mask -h)
out1 : image file in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
Example: 5-7-d16 is not a 2D norm
./npic-wd-norm ../masks/d-5-7-d16_2l.nmask 10 -o tmp1.npz
./npic-print tmp1.npz
Example: bash script that checks a,b,c 3D masks
for ((a = 1; a < 10; a++)); do
for ((b = 1; b < 10; b++)); do
for ((c = 1; c < 10; c++)); do
echo -n "$a $b $c "
./npic-mask tmp1.nmask -create -3l -dist -ghalf \
-vec 0:0:1:$a -vec 0:1:1:$b -vec 1:1:1:$c > /dev/null
./npic-wd-norm tmp1.nmask 20 -p -1
done ; done ; done | more
|
npic-mlut - Compute Medial Axis, LUT and Mlut for Distance Transforms. Usage: npic-mlut -h | -help | --help : print help npic-mlut options ... Options: -wd d-mask : use weighted distance mask -sed : or use square Euclidean distance -2l|-3l|-4l|-5l|-6l : specify dimension (if it cannot be guessed) -mlut t-mask : medial axis test mask (a.k.a Mlut), to use or to expand -create : create or overwrite t-mask -rad Rtarget : the radius to reach (if it cannot be guessed) -axis in1 out1 : compute medial axis from distance transform in1 -col n R : show the Lut column [n][1..R] for vector number n in t-mask -ctg out2 : save CTg d-mask, t-mask : masks in .nmask[.gz|bz2|7z] format in1, out1, out2 : images in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format Example: compute and show MA from WDT for d4 ./npic-wdt -dt ../masks/d4_2l.nmask ../images/K1b_2c.pgm.gz tmp1.npz ./npic-mlut -wd ../masks/d4_2l.nmask -axis tmp1.npz tmp2.npz ./npic-val tmp2.npz tmp3.npz -thr-gt 0 255 ./npic-conv tmp3.npz tmp3.pgm -c gimp tmp3.pgm& Example: compute and show MA from SEDT ./npic-sedt -dt -hirata ../images/klette_3c.pan.gz tmp1.npz ./npic-mlut -sed -axis tmp1.npz tmp2.npz -mlut ../masks/t-sed_3l.nmask.gz # or: ./npic-mlut -sed -axis tmp1.npz tmp2.npz ./npic-geomv tmp2.npz tmp3.geomv -show Example: compute Mlut for SED in dim 4, then resume computation ./npic-mlut -sed -4l -rad 30 -mlut tmp1.nmask -create ./npic-mlut -sed -4l -rad 50 -mlut tmp1.nmask Example: show a Lut column ./npic-mlut -wd ../masks/d-5-7-11_2l.nmask -col 2 65 |
npic-dtma - Compute Distance Transform and extract Medial Axis from it.
Usage:
npic-dtma -h | -help | --help : print help
npic-dtma Mdist Mlut in1 out1 : compute DT and MA
Mdist : a weighted distance mask, or a Euclidean distance mask,
or "sed" for Squared Euclidean Distance
Mlut : a medial axis neighbourhood test mask corresponding to
the distance (will be created or updated) or "none"
in1 : a binary image
out1 : the medial axis of in1
Mdist, Mlut : mask file in .nmask[.gz|bz2|7z] format (see npic-mask -h)
in1, out1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
Example: compute and show Medial Axis with distance <3,4,5> and with SED
./npic-dtma sed none ../images/K1b_2c.pgm.gz tmp1.pbm
gimp tmp1.pbm &
./npic-dtma ../masks/d-3-4-5_3l.nmask none ../images/klette_3c.pan.gz tmp2.npz
./npic-geomv tmp2.npz tmp2.geom -show &
./npic-dtma sed ../masks/t-sed_3l.nmask ../images/klette_3c.pan.gz tmp3.npz
./npic-geomv tmp3.npz tmp3.geom -show &
|
npic-ball.sh - Generate a Distance Ball.
Usage:
npic-ball.sh -h | -help | --help : print help
npic-ball.sh mask out1 options : compute a distance ball with WD mask or SED
mask : weighted distance mask in .nmask[.gz] format
or "sed" for Squared Euclidean Distance
out1 : image in .npz, .pan[.gz] or other format.
Options:
-2|-3|-4|-5|-6 : dimension d, if it cannot be guessed from mask
-ir N : image radius N, will create a (2N+1)^d image
-dr R : distance radius R of the closed ball
-dt : fill the center point and make a DT on the ball
Example 1: a 2-d Euclidean ball, without and with option -dt
./npic-ball.sh sed tmp1.npz -2 -dr 100 -ir 12
./npic-print tmp1.npz | sed -e 's/ 0/ ./g'
./npic-ball.sh sed tmp1.npz -2 -dr 100 -ir 12 -dt
./npic-print tmp1.npz | sed -e 's/ 0/ ./g'
Example 2: a 2-d Montanari's ball
./npic-ball.sh ../masks/d-M2_2d.nmask tmp1.npz -dr 254.3 -ir 280
./npic-conv tmp1.npz tmp1.pgm -c
gimp tmp1.pgm &
Example 3: a 3-d chamfer ball
./npic-ball.sh ../masks/d-7-10-13-18_3l.nmask tmp1.npz -dr 210 -ir 40
./npic-geomv tmp1.npz tmp1.geom -show &
|
npic-bissec - Compute bissector of two points for two distances.
Usage:
npic-bissec -h | -help | --help : print help
npic-bissec out1 options : create image of bissector between points
Options:
-2|..|-6 : dimension
-size coord : size of image
-p1|-p2 coord : coordinates of centers
-m1|-m2 mask : weighted distance mask in .nmask[.gz|bz2|7z] format,
or "sed" for squared Euclidean distance (default).
-a1|-a2 alpha : normalisation factor, default is 1.0
-col p r1 r2 f : color of points, regions and frontier, in 0..255,
default is 0 99 200 255
-thr h : threshold for comparing normalized distances, default 1E-5
The result out1 will contain the bissector of points p1 and p2, computed for
distance m1 from p1 and distance m2 from p2. Distances are normalized.
coord: y:x or z:y:x or t:z:y:x s:t:z:y:x or r:s:t:z:y:x
out1: image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
Example 1: using d8 and sed
./npic-bissec tmp1.npz -2 -size 40:30 -p1 20:2 -p2 28:26 \
-m1 ../masks/d8_2l.nmask -m2 sed
./npic-print tmp1.npz
Exemple 2: using d<3,4> and d<5,7,11>
./npic-bissec tmp1.pgm -2 -size 700:500 -p1 300:10 -p2 351:490 \
-m1 ../masks/d-3-4_2l.nmask -a1 3 -m2 ../masks/d-5-7-11_2l.nmask -a2 5
gimp tmp1.pgm &
Exemple 3 in dim 3: using sed and d6
./npic-bissec tmp1.npz -3 -size 80:80:80 -p1 40:10:40 -p2 37:70:45\
-m1 sed -m2 ../masks/d6_3l.nmask -col 1 0 0 2 -thr 1
./npic-geomv tmp1.npz tmp1.geomv -show &
|
npic-metbases - Compute metric bases and dimension.
Usage:
npic-metbases -h | -help | --help : print help
npic-metbases options action : check or find bases and dimension
Options:
-2|..|-6 : dimension of space
-size coord : size of the rectangle
-m mask : weighted distance mask in .nmask[.gz|bz2|7z] format,
or "sed" for squared Euclidean distance (default).
-v coord : add one vertex to the set S (empty by default)
-out out1 : save result in out1.
-list : print additional results
-trace : show the progression in stderr
Action:
-test-rset : test if the set S is a resolving set
Labels in out1: -1 undef, 0 vertex, 1 resolved, >1 unresolved
-find-rsets d : find resolving sets in metric dimension d, starting from S
Labels in out1: occurrence number
-find-dim d1 d2 : find metric dimension in [d1..d2]
Labels in out1: 0 background, 1 vertex of the first base
out1: image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
coord: y:x or z:y:x or t:z:y:x or s:t:z:y:x or r:s:t:z:y:x
Example 1: test a resolving set
./npic-metbases -size 10:20 -m ../masks/d-5-7-11_2l.nmask -out tmp2.npz \
-v 0:0 -v 9:17 -test-rset
./npic-print tmp2.npz | sed -e 's/ 1/ ./g'
Example 2: find bases of dimension 2
./npic-metbases -size 8:11 -m ../masks/d-3-4_2l.nmask -out tmp2.npz \
-find-rsets 2
./npic-print tmp2.npz | sed -e 's/ 0/ ./g'
Example 3: find bases given a forcing subset
./npic-metbases -size 8:11 -m ../masks/d-3-4_2l.nmask -out tmp2.npz \
-find-rsets 2 -v 2:1 -list
./npic-print tmp2.npz | sed -e 's/ 0/ ./g'
Example 4: searching metric dimension
for f in ../masks/d*_2l.nmask ; do \
./npic-metbases -size 10:15 -m "$f" -find-dim 1 4 -list ; done
|
npic-print - Print image as text in console. Usage: npic-print -h | -help | --help : print help npic-print in1 : print in1 in1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format |
npic-xfig - Convert an 2-d image file to an Xfig file.
Usage:
npic-xfig -h | -help | --help : print help
npic-xfig in1 out1 [options] : convert in1 to out1
Options:
-box y x h w : only convert this part of image
-latex : add text flag 'special' to produce pstex
-font n : change font size (default is 12)
-size h w : change pixel height and width in cm (default is 0.8 0.8)
-nozero : do not output 0 values
-norect : do not output 0 pixels
-bg a b grey : set bg color for [a..b] pixels to grey (0..100)
(multiple -bg ... are allowed.)
-coords : show coordinates
-co-orig y x : the coordinates start from y,x
-co-font n : change coordinates font size (default is 10)
-3d : add 3D effects (more with -norect)
-3d-size h w : change 3D border height and width in cm (default 0.15 0.18)
-show : show result with xfig
in1 : image in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
out1 : result in the Xfig .fig format
Example:
./npic-sedt -dt -saito ../images/ex1_2c.npz tmp1.npz
./npic-xfig tmp1.npz tmp2.fig -norect -nozero -coords -3d \
-bg 9 15 90 -bg 16 25 80 -show
|
npic-geomv - Convert a 3-d image file to a geomview file.
Usage:
npic-geomv -h | -help | --help : print help
npic-geomv in1 out1 [options] : convert in1 to out1
in1 : volume in .npz .pan|vol|pnm|pbm|pgm|ppm[.gz|bz2|7z] format
out1 : result in the geomview .geom format
Options:
-vobb : add the real volume bounding box
-rad r : face radius, default is 0.5
-show : show result with geomview
Geomview is an interactive 3D viewing program using OpenGL,
available on most Unix platforms. See: http://www.geomview.org
To get on Ubuntu/Debian, type: sudo apt-get install geomview
Example:
./npic-geomv ../images/klette_3c.pan.gz tmp1.geom
geomview tmp1.geom &
Example:
./npic-new tmp2.npz -3c 50:40:60
./npic-draw tmp2.npz tmp2.npz \
-rect 10:20:30 15:26:37 100 \
-ellip 30:20:30 35:26:37 100
./npic-geomv tmp2.npz tmp3.geom -vobb -show
|
npic-anim4d.sh - Show a hyper-volume slice by slice with geomview. Usage: npic-anim4d.sh -h | -help | --help : print help npic-anim4d.sh in1 [options] : load in1 and run geomview in1 : image in .npz, .pan[.gz] or other format. Options: -time t : time interval between 2 slices in seconds (default is 0.5). -x|-y|-z|-t ... : show a sequence of slices for x, y, z, t -all : equivalent to -x -y -z -t -cont : show sequence continuously Example: show a 4-dimensionnal ball for weighted distance <3,4,5,6> ./npic-new tmp1.npz -4l 41:41:41:41 ./npic-draw tmp1.npz tmp1.npz -point 20:20:20:20 60 ./npic-wdt -rdt ../masks/d-3-4-5-6_4l.nmask tmp1.npz tmp2.npz ./npic-anim4d.sh tmp2.npz -x -cont |
npic-templa - expand Npic @macros in C files.
Usage:
npic-templa -h | -help | --help : print this help
npic-templa in1 out1 : expand in1 to out1
in1 : .ct file containing Npic @macros
out1 : .c resulting file
General macros:
@@ : expand to '@'
@# ... \n : comment, suppressed in output
@G : expand a generation message and date
Rule: any line expanding to blank is suppressed.
Loop:
@BLOOP <list>\n
<text>
@ELOOP
<list> is a list of words in 2C 2L 2D 2Q .. 6C 6L 6D 6Q
separated by ' ' or ',' or '\t'
<text> is a multi-line text; it will be duplicated for each word in <list>
Macros available in a loop:
@H : expand to the current word in loop list (upper case)
@h : the same in lower case
@J : expand to first letter in @H (the dimension).
@K : expand to second letter in @H (pixel type).
@k : the same in lower case
Conditionnal in loop: x is a char in "'`:?#~&^
@IF[<list>]<text>@FI : expand <text> if @H in <list>
@[<list>]x<text>x : expand <text> if @H in <list>
@<23456>x<text>x : expand <text> if @J in <23456>
@<LCDQ>x<text>x : expand <text> if @K in <LCDQ>
Any conditionnal can be negated by: @!...
Coordinates for dimension: word ~$~ can be empty; ? in ',;)'
@ox~$~x] : expand to ~r~][...][~y~][~x~]
@ox~$~x? : expand to ~r~, ..., ~y~, ~x~?
|