1.1. User Karo's PINK-library operators ---------------------------------- pink: Shortcut for command 'pink_new'. pink_new: pink_cmd,p1,...,pn Pink wrapper (requires the PINK library to be installed), see https://perso.esiee.fr/~coupriem/pinktutorial/ (in French) and https://perso.esiee.fr/~coupriem/Pink/doc/html/index.html (in English) Shortcut: pink * Prepares input, calls external "pink_cmd input p1...pn output" and reads output (/tmp) and replaces positional IMAGE parameters bei temp. files. These images are not splitted and merged. They have to have the necessary format for the respectice pink executable. Only Pink routines with input file(s) and ONE output file can be called. Images with spectral channels (s>1) are splitted, processed one by one and merged. * ATTENTION positional image parameter are never spitted and merged in contrast to selected (input) and output images. Positional image parameter should already have the needed format for the selected pink binary! * pink_new prepares selected images and image parameter as pnk files in auto mode and creates a command string. File format of generated input pnk file can be forced by an option attached to the "pink_cmd" by "pink_cmd:if-", e.g. "asf:if-uchar", overwriting auto mode. Images (splitted if spectrum s > 1) are processed one by one and are written as pnk files to temporary space, outfile is a pnk file name pointing to temporary space too. The executed call looks like "pink_cmd infile p1 ... (px)imagefile ... pn outfile". * For help of pink executable a call "pink_new help,pink_cmd" calls the executive command "open https://perso.esiee.fr/~coupriem/pinktutorial/_8c.html" instead of a pink binary. OS variables: GMIC_PINK_NO_RM == true: created files in temporary space are not removed GMIC_PINK_VERBOSE == true: created cmd string and pink messages are printed Example: [#1] sp tiger +pink_new. asfr,5 pink_new.. asf,5 [#2] sp tiger +blur 2 round. pink_new maxima,4 [#3] sp to_gray ir. 0,50% +pink_new. distc,3 +negate.. +pink_new... dist,3 pink_new[1] bisector,[0] pink_new[3] bisector,[2] k[1,3] a c [#4] sp 2 +pink_new. dilatballnum,5 +- [#5] sp 2 +pink_new. asf,5 - [#6] sp boats ir. 0,50% +pink_new. dilatballnum,10 +pink_new.. distgeo,.,4 [#7] sp barbara +pink_new. seuilauto,128,max,3 [#8] sp 1,512,512 colorwheel 512 +pink_new. average,.. pink_grayskel: _connectivity(4), _lambda(0) (https://perso.esiee.fr/~coupriem/Pink/doc/html/grayskel_8c.html) Grayscale homotopic skeleton (requires the PINK library to be installed). Default values: 'connectivity=4' and 'lambda=0' (actually only connex=4 implemented). Example: [#1] sp tiger +pink_grayskel , +pink_grayskel[0] ,10 +pink_grayskel[0] ,100 append_tiles 2 pink_heightmaxima: _connectivity={ 4 | 8 | 6 | 26 },_height=1 (https://perso.esiee.fr/~coupriem/Pink/doc/html/heightmaxima_8c.html) Heightmaxima filtering (requires the PINK library to be installed). Default values: 'connectivity=4' and 'height=1'. Example: [#1] sp car +blur 2 round +pink_heightminima ,15 round[0,1] +pink_heightmaxima[0,1] ,15 -[-3,-1] -[-3,-1] k[-1, -2] pink_heightminima: _connectivity={ 4 | 8 | 6 | 26 },_height=1 (https://perso.esiee.fr/~coupriem/Pink/doc/html/heightminima_8c.html) Heightminima filtering (requires the PINK library to be installed). Default values: 'connectivity=4' and 'height=1'. Example: [#1] sp car +blur 2 round +pink_heightminima ,15 round[0,1] +pink_heightmaxima[0,1] ,15 -[-3,-1] -[-3,-1] k[-1, -2] pink_htkern: _connectivity={ 4 | 8 | 6 | 26 }, _type={"" | u} (https://perso.esiee.fr/~coupriem/Pink/doc/html/htkern_8c.html) (https://perso.esiee.fr/~coupriem/Pink/doc/html/htkernu_8c.html) Grayscale ultimate homotopic thinning/thickening without condition (requires the PINK library to be installed). Default values: 'connectivity=4' and 'type=""'. Example: [#1] sp tiger +pink_htkern ,u +pink_htkern[0] , +-[-1,-2] remove[0] pink_lvkern: _connectivity={ 4 | 8 | 6 | 26 }, _type={"" | u} (https://perso.esiee.fr/~coupriem/Pink/doc/html/lvkern_8c.html) (https://perso.esiee.fr/~coupriem/Pink/doc/html/lvkernu_8c.html) Grayscale ultimate leveling thinning/thickening without condition (requires the PINK library to be installed). Default values: 'connectivity=4' and 'type=""'. Example: [#1] sp tiger pink_lvkern ,u pink_reg_minima: _connectivity={ 0 | 4 | 8 | 6 | 18 | 26 | 14} (https://perso.esiee.fr/~coupriem/Pink/doc/html/minima_8c.html) Regional minima (requires the PINK library to be installed). Default values: 'connectivity=4'. Example: [#1] sp tiger +blur 2 round. pink_reg_minima , pink_reg_maxima: _connectivity={ 0 | 4 | 8 | 6 | 18 | 26 | 14} (https://perso.esiee.fr/~coupriem/Pink/doc/html/maxima_8c.html) Regional maxima (requires the PINK library to be installed). Default values: 'connectivity=4'. Example: [#1] sp tiger +blur 2 round. pink_reg_maxima , pink_skelcurv: _prio={prio image|0|1|2|3|4|8|6|18|26|5},_connectivity={ 4 | 8 | 6 | 26 },_inhibit={""|inhibit image} (https://perso.esiee.fr/~coupriem/Pink/doc/html/skelcurv_8c.html) Curvilinear binary skeleton guided by a priority function or image (requires the PINK library to be installed). Default values: 'prio=0', 'connectivity=4' and 'inhibit=""'. Example: [#1] sp tiger threshold 50% {w},{h} fill. 'if(x>w/2,255,0)' tp=${-path_tmp} output. ${tp}/inhibit.pgm remove. +pink_skelcurv[0] , +pink_skelcurv[0] ,,${tp}/inhibit.pgm exec "rm "${tp}"/inhibit.pgm" [#2] sp tiger threshold 50% +pink_skelcurv , +pink_skelcurv.. ,8 pink_skelend: _connectivity={ 4 | 8 | 6 | 26 },_n=0 (https://perso.esiee.fr/~coupriem/Pink/doc/html/skelend_8c.html) Homotopic skeleton of a 2d or 3d binary image with dynamic detection of end points (requires the PINK library to be installed). Default values: 'connectivity=4' and 'n=0'. Example: [#1] sp tiger threshold 50% +pink_skelend , +pink_skelend.. ,-1 pink_skeleton: _prio={0|1|2|3|4|8|6|26},_connectivity={ 4 | 8 | 6 | 26 },_inhibit="" (https://perso.esiee.fr/~coupriem/Pink/doc/html/skeleton_8c.html) Ultimate binary skeleton guided by a priority image (requires the PINK library to be installed). Default values: 'prio=0', 'connectivity=4' and 'inhibit=-1'. Example: [#1] sp tiger threshold 50% +pink_skeleton. , pink_skelpar: _algorithm={0...31},_nsteps=_1,_inhibit="" (https://perso.esiee.fr/~coupriem/Pink/doc/html/skelpar_8c.html) Parallel binary skeleton (requires the PINK library to be installed). Default values: 'algorithm=4', 'nsteps=-1' and 'inhibit=""'. For most of the implemented algorithsm an inhibit image is not implemented! Example: [#1] sp tiger threshold 50% +pink_skelpar. 0 +pink_skelpar. 2 pink_wshed: _connectivity={ 4 | 8 | 6 | 26 },_inverse={ 0 | 1 },_height=0 (https://perso.esiee.fr/~coupriem/Pink/doc/html/wshedtopo_8c.html) Watershed (requires the PINK library to be installed). Default values: 'connectivity=4', 'inverse=0' and 'height=0'. Example: [#1] sp car +pink_wshed ,1,5 pink_wshed[0] ,,5 output_pinklist: filename, _type write an (c,n) image with c=1..4 colums and n lines to a pink list file Automatic type: c1 => e, c2 => b c3 => B, c4 => N Manual type possible: c2 => s, c3 => n Default value: 'type=" "' (space) List formats according PINK format description ~~~ e s b n B N x1 x1 v1 x1 y1 x1 y1 v1 x1 y1 z1 x1 y1 z1 v1 x2 or x2 v2 or x2 y2 or x2 y2 v2 or x2 y2 z2 or z2 x2 y2 v2 ... ... ... ... ... ... xn xn vn xn yn xn yn vn xn yn z3 z3 xn yn vn ~~~ pink_delaunay: _mode Prepare the delaunay triangulation from a list of coordimates (vertices) using the external program pink.delaunay, no test for external delaunay mode == 0 a 3d object or mode != 0 the vertice, hull, edge lists and the adjacency matrix Default value: 'mode=0' Example: [#1] 2,50,1,1 rand 0,512 pink_delaunay. 0 pink_asflin: _dir(x|y|z), _rad(5), _radmax(0) 'asflin' filter workaround for 2D images! 'asflin' works only in 3D images (d>1) 'asflin' is called with dir,rad or if radmax>rad with dir,rad,radmax (https://perso.esiee.fr/~coupriem/Pink/doc/html/asflin_8c.html) pink_asflin (requires the PINK library to be installed). Example: [#1] sp tiger +pink_asflin. , +pink_asflin.. y,5 pink_karo_zerleg: Shortcut for command 'karo_zerleg'. karo_zerleg :: Partition of binary image zero areas using pink watershed (https://perso.esiee.fr/~coupriem/Pink/doc/html/wshedtopo_8c.html) Author : KaRo. Latest update : 2017/11/30. Example: [#1] follic pink seuilauto,254,min,5 n 0,1 karo_open 3 +not karo_zerleg. not. a c [#2] sp 6 to_gray +threshold 140 +karo_zerleg. a[-1,-2] c 1.2. User KaRo's CLI I/O functions ----------------------------- osteo :: Load osteoblast cell image (transmitted light) Example: [#1] osteo osteo_ :: Load osteoblast cell image and cell mask (transmitted light) Example: [#1] osteo_ follic :: Load follicle cells sample image from thyroid (transmitted light) from internet or local storage. For frequent usage do "gmic follic o ${_path_rc}follic.pgm" to store the image locally, follic looks there first! Example: [#1] follic follic_ :: Load follicle cells image and masks from thyroid (transmitted light) from internet or local storage. Example: [#1] follic_ sincos: _w(512), _h(512), _new(0) Generation of a simple sine cosine testimage Default value: 'w=h=512', 'new=1' Example: [#1] sincos , +shift. 50%,0,0,0,2 +shift.. 0,50%,0,0,2 a c [#2] sincos , sincos ,,1 +- f. 'if(i<-1,0,i)' kr_spect: _size=512, _force_native(=0) Generate example spectrum image prepared with 'distance' or if existant external pink executable 'dist' and not forced! Example: [#1] kr_spect ,1 kr_testimage: _sizex(256),_sizey(_sizex) Another simple spectrum image for tests Example: [#1] kr_testimage , karo_read_bd: name,_verbosity(=0),_append_type(=z) {z|c|x|y},_no_delete(=0) Read biodata with external bfconvert from OME bftools directory has to be in the PATH http://www.openmicroscopy.org/site/support/bio-formats5/users/comlinetools/conversion.html Default values: 'verbosity=0', 'append_type=z', 'no_delete=0' gwyddionread: _filename Read gwyddion ASCII file and produce image. For gwyddion files see http://gwyddion.net . Data beginning after "Start of Data:" are imported [x-length, y-length, x-offset, y-offset, header lines] are returned in ${} gwyddion Example header | # File Format = ASCII | # Created by Gwyddion 2.48 | # Original file: gwyddion_Example.asc | # x-pixels = 640 | # y-pixels = 480 | # x-length = 313789.96127244376 | # y-length = 235219.70492879587 | # x-offset = 0 | # y-offset = 0 | # Bit2nm = 1.0 | # Start of Data: wykoread: _filename Read Wyko/Bruker/Vision ASCII file and produce image(s) For Wyko files see also under http://gwyddion.net . Data preceded by "RAW_DATA" and/or "Intensity" are imported Wyko Example header | Wyko ASCII Data File Format 0 1 1 | X Size 640 | Y Size 480 | Block Name Type Length Value | Wavelength 7 4 71.992500 | Aspect 7 4 1.000000 | Pixel_size 7 4 0.000985 | Magnification 8 8 10.050000 | ScannerSpeed 7 4 2.315832 | RAW_DATA 3 1228800 Default value: 'filename=Wyko_Example.ASC' karo_dtpread: filename,_bit0 Read dtp image file format (512 byte header, col[22-24] x row[25-27] byte image) with _bit0 != 0 bit level 1 is extracted as binary mask and bit level 1 in the gray image is randomized with karo_rndbit0 Default value: 'bit0=0' Ex.: karo_dtpread Images/Beispiele/tra005.cel,1 output_pink3d: filename,_type Save selected images as type-coded (P5,P8,P9) PNK files (PINK extension for 3d volumetric images). https://perso.esiee.fr/~coupriem/Pink/doc/html/ Other file types are listed for info only! Pink file formats (from PINK source) P4: raw binary ; P1: ascii binary (2D: standard ; 3D: extension Pink) NOT YET SUPPORTED P5: raw byte ; P2: ascii gray (2D: standard ; 3D: extension Pink) P6: raw byte rgb ; P3: ascii rgb (2D: standard ; 3D: NOT YET SUPPORTED) P8: raw long 2d-3d (extension Pink) P9: raw float 2d-3d (extension Pink) PA: ascii float 2d-3d (extension Pink) PB: ascii long 2d-3d (extension Pink) PC: raw double 2d-3d (extension Pink) PD: ascii double 2d-3d (extension Pink) PE: raw single precision complex 2d-3d (extension Pink) PF: ascii single precision complex 2d-3d (extension Pink) Images FILE ::= 'P2' * * FILE ::= 'P5' * * COMMENT ::= '#' char* newline COMMENT ::= '#' char* newline DIMENSIONS ::= | DIMENSIONS ::= | RS ::= ascii_coded_integer RS ::= ascii_coded_integer CS ::= ascii_coded_integer CS ::= ascii_coded_integer DS ::= ascii_coded_integer DS ::= ascii_coded_integer VALMAX ::= ascii_coded_integer VALMAX ::= ascii_coded_integer PIXEL ::= ascii_coded_integer8 PIXEL ::= binary_coded_integer8 FILE ::= 'P8' * * FILE ::= 'P9' * * COMMENT ::= '#' char* newline COMMENT ::= '#' char* newline DIMENSIONS ::= | DIMENSIONS ::= | RS ::= ascii_coded_integer RS ::= ascii_coded_integer CS ::= ascii_coded_integer CS ::= ascii_coded_integer DS ::= ascii_coded_integer DS ::= ascii_coded_integer VALMAX ::= ascii_coded_integer [unused] VALMAX ::= ascii_coded_integer [unused] PIXEL ::= binary_coded_integer32 PIXEL ::= binary_coded_float FILE ::= 'PA' * * FILE ::= PB * * COMMENT ::= '#' char* newline COMMENT ::= '#' char* newline DIMENSIONS ::= | DIMENSIONS ::= | RS ::= ascii_coded_integer RS ::= ascii_coded_integer CS ::= ascii_coded_integer CS ::= ascii_coded_integer DS ::= ascii_coded_integer DS ::= ascii_coded_integer VALMAX ::= ascii_coded_integer [unused] VALMAX ::= ascii_coded_integer [unused] PIXEL ::= ascii_coded_float PIXEL ::= ascii_coded_integer32 FILE ::= 'PC' * * FILE ::= 'PD' * * COMMENT ::= '#' char* newline COMMENT ::= '#' char* newline DIMENSIONS ::= | DIMENSIONS ::= | RS ::= ascii_coded_integer RS ::= ascii_coded_integer CS ::= ascii_coded_integer CS ::= ascii_coded_integer DS ::= ascii_coded_integer DS ::= ascii_coded_integer VALMAX ::= ascii_coded_integer [unused] VALMAX ::= ascii_coded_integer [unused] PIXEL ::= binary_coded_double PIXEL ::= ascii_coded_double FILE ::= 'PE' * ( )* FILE ::= 'PF' * ( )* COMMENT ::= '#' char* newline COMMENT ::= '#' char* newline DIMENSIONS ::= | DIMENSIONS ::= | RS ::= ascii_coded_integer RS ::= ascii_coded_integer CS ::= ascii_coded_integer CS ::= ascii_coded_integer DS ::= ascii_coded_integer DS ::= ascii_coded_integer VALMAX ::= ascii_coded_integer [unused] VALMAX ::= ascii_coded_integer [unused] RE ::= binary_coded_float RE ::= ascii_coded_float IM ::= binary_coded_float IM ::= ascii_coded_float Default value: 'type=P5' input_pinktest: file_name Test file type for pnk (pink) and pnm (portable anymap) file type. Routine returns the first character from the first non comment line in status. If status 'P'( 80) a pnk/pnm file is expected! For pink everything else is considered as pink list or non-pink-file. pink_setorigin: pink_file, _orig_x, _orig_y, _orig_z Call of pink routine setorigin to make an image file as structuring element usable Default values: 'orig_x=orig_y=orig_z=0' input_pinklist: file_name, _mode Read a pink list file spec. type G from pink.delaunay) at file_name and prepare _mode == 0 a 3d object or _mode != 0 the vertice, hull, edge list images and the adjacency matrix _mode only valid for graph lists type G, all other list types return only an image. All list (image) sizes are returned in status! Default value: 'mode=0' Summary of Pink list formats read: ~~~ Type e s b n B N values x1 x1 v1 x1 y1 x1 y1 v1 x1 y1 z1 x1 y1 z1 v1 ... x2 x2 v2 x2 y2 x2 y2 v2 x2 y2 z2 z2 x2 y2 v2 ... ... ... ... ... ... ... ... xn xn vn xn yn xn yn vn xn yn z3 z3 xn yn vn Type G values x1 y1[ v1] ec1 ns1 s11 s12 ... s1ns1 ... x2 y2[ v2] ec2 ns2 s21 s22 ... s1ns2 ... ... ... xn yn[ vn] ecn nsn sn1 sn2 ... s1nsn ~~~ where xi, yi are the coordinates of the i -th vertex, vi is the associated value (if given in the input file), eci is a int which indicates whether the vertex i belongs to the convex hull, nsi denotes the number of adjacent vertices, and si1 si2 ... sins1 is the list of the indexes of the adjacent vertices (counted from 0) (see https://perso.esiee.fr/~coupriem/Pink/doc/html/delaunay_8c.html). pink_input_pnk: filename Read pgm P2 extended (pink) ascii files via pink exec pgm2list anything else with pink type in 'esbnBNcCdDGS' with input_pinklist and the rest with standard gmic input function. pink_input_test: file_name Test file type of file_name for pnk (pink) and pnm (portable anymap) file type. Routine returns the first character from the first non comment line in status. Only ['PQesbnBNcCdDGS#'] are allowed, 'P'=80 is returned for pgm files with type <> P2 (not ascii pgm), 'Q'=81 is returned for pgm files with type == P2. ['esbnBNcCdDGS'] is returned for PINK list files where the second char is ' '. '#'=35 is returned otherwise. cimg2tiff: filenamein, _pathout(=pathin), _type(=integer) File Converter gmic cimg* to tiff e.g. for ImageJ with <_pathout>.tif. Type can be _type='integer'(size dep. uchar(<256)|ushort(<65536)|uint(4294967296)|float) or any other numrical gmic types. Usage is thought for multipage tiff files of 2/3/4d multi-channel data. In case of tiff float files, value ranges other than [0,1] deliver often problems. Best to use (not only in ImageJ) bio-formats package (https://www.openmicroscopy.org/bio-formats/) Default values: 'pathout={f}' (file path from input file), 'type=integer' Ex.: gmic cimg2tiff Step\ 3/_wt_Time_0.cimgz Ex.: gmic cimg2tiff \"Step 3/_wt_Time_0.cimgz\",\"./\" 1.3. User Karo's CLI Utilities ------------------------- karos_about: Logo for gui and errors Example: [#1] karos_about karos_error: "message" Message in karos_about image for gui Example: [#1] karos_error Test kr_is_exec: executable_name Look for 'executable_name' with 'type' (unix/MacOS) or 'where' (windows) Return unix/Macos/Windows status==0 found! kr_draw_vars: _type(0) If _type==0 Draw with text several variable and function values Else Draw PATH variable into an image Default value; 'type=0' Example: [#1] 0 kr_draw_vars kr_help: _command, _gmic_file(=$_path_rc/update$_version.gmic) Display help (parse_cli ascii,command) optionally from _gmic_file (e. g. external files). Default _command="" _gmic_file=$_path_rc/update$_version.gmic karo_frame: _width, _border Delete a border of width or delete the inner part _width : thickness of border _border ==false : border is set 0, inner region copied _border ==true : border is copied, inner region is set 0 Default values: 'width=1', 'border=0' Example: [#1] osteo +negate karo_frame 5,0 karo_li2st: p1,p2,...,pn Convert comma separated list to space separated string. karo_xcimg: programname, parameterlist : Call external CImg Example 'programname' which has to be found in PATH by external call by 'programname' image_in 'parameterlist' image_out with writing image_in and reading after execution image_out Example: [#1] sp lena karo_xcimg pde_TschumperleDeriche2d,-iter\ 50\ -visu\ 0\ -ns +- karo_skeleton: _p1,..,p2n | (-median,0,-inv,0|1,-t,-0.3,-curve,0|1,-corr,0|1,-dlt,1) Execute use_skeleton (CImg demo) external. For help execute in terminal shell "use_skeleton -help" ~~~ use_skeleton: Compute the skeleton of a shape, using Hamilton-Jacobi equations (Aug 11 2021, 20:46:01) Input/Output options -------------------- -i img/milla.bmp Input (black&white) image -median 0 Apply median filter -inv false Invert image values -o 0 Output skeleton image -visu true Display results Skeleton computation parameters ------------------------------- -t -0.3 Threshold -curve false Create medial curve Torsello correction parameters ------------------------------ -corr false Torsello correction -dlt 1 Discrete step ~~~ Example: [#1] sp car otsu 256 +karo_skeleton "-median,5,-inv,1" karo_nlmeans: _p1,..,pn=-zoom,1,-ng,0|1,-nu,0|1,-ns,0|1,-p,1,-lambda,-1,-sigma,-1,-alpha,3,-sampling,1 Execute use_nlmeans (CImg demo) external. (see also q-nlmeans p=4,lambda=4,sigma=10) For help execute in terminal shell "use_nlmeans -help" ~~~ use_nlmeans: Non-local means denoising algorithm. [1] Buades, A. Coll, B. and Morel, J.: A review of image denoising algorithms, with a new one. Multiscale Modeling and Simulation: A SIAM Interdisciplinary Journal 4 (2004) 490-530 [2] Gasser, T. Sroka,L. Jennen Steinmetz,C. Residual variance and residual pattern nonlinear regression. Biometrika 73 (1986) 625-659 Build : (Aug 11 2021, 20:45:21) -i img/milla.bmp Input image -o 0 Output file -zoom 1 Image magnification -ng 0 Add gauss noise before aplying the algorithm -nu 0 Add uniform noise before applying the algorithm -ns 0 Add salt&pepper noise before applying the algorithm -visu 1 Visualization step (0=no visualization) -p 1 Half size of the patch (2p+1)x(2p+1) -lambda -1 Bandwidth as defined in [1] (-1 : automatic bandwidth) -sigma -1 Noise standard deviation (-1 : robust estimation) -alpha 3 Neighborhood size (3) -sampling 1 Sampling of the patch (1: slow, 2: fast) ~~~ Example: [#1] osteo +karo_nlmeans -p,2 +- 1.4. User KaRo's CLI functions ------------------------- karo_rndbit0 :: Randomize in [0..255] (byte) image$? bit level 0. wow randomize numbers to even and odd" Example: [#1] osteo +karo_rndbit0 +- kr_circular_mean :: Calculation of the mean (and SD) for angles (radian), especially for mean and sd of hue angles. Returned in status and a global variabale _kr_circular_mean pseudo_c :: Pseudo coloring of greyscale images Example: [#1] follic_ k. label 0 +pseudo_c karo_luminance: _type = [itur1990 | itur1990-2 | gmic | gmic-2] Compute luminance of selected RGB images according itur1990 | itur1990-2 sqr/sqrt | gmic luminance | sqr/sqrt gmic luminance. sRGB to RGB and back only with gmic and gmic-2! Default value: 'type=itur1990' Example: [#1] sp tiger +karo_luminance , karo_close: _size>0, _shape={0|1|2} (square|octagon|circle),_invert={0|1}, scale={0|1|2}, Value action none | cut | normalize, channel=>0 see color_channels in apply_channels Morphological closing (dilate and erode) of given size (only 2d) with fx_morpho_v2 and implicitly apply_channels! Default values: 'size=5', 'shape=invert=scale=channel=0' Example: [#1] sp tiger,400 +karo_close 21 +karo_close[0] 21,1 +karo_close[0] 21,2 rm[0] karo_open: _size>0,_shape=0|1|2 (square|octagon|circle), _invert=0|1, '_scale=0|1|2','_channel' see value action, color_channels in 'apply_channels' Morphological opening (erode and dilate) of given size (only 2d) with fx_morpho_v2 and implicitly apply_channels! Default values: 'size=5', 'shape=invert=scale=channel=0' Example: [#1] sp tiger,400 +karo_open 15 +karo_open[0] 15,1 +karo_open[0] 15,2 rm[0] karo_doc: _size>0,_shape=0|1|2 (square|octagonal|circular), _channel see color_channels in 'apply_channels' compute difference of open+close and original (only 2d) Default values: 'size=5', 'shape=1', 'channel=0' Example: [#1] sp tiger +karo_doc 15,2,5 replace. 0,{im} karo_doo: _size1>0,_size2>0,_type=0..3 (ero/dil/open/close),_shape=0|1|2 (sqaure|octagon|circle),_scale=0|1,_scale,_channel see value action, color_channels in apply_channels Compute difference of math. morph operation type on selected images (only 2d). Default values: 'size1=5', 'size2=7', 'type=2', 'shape=1', 'scale=channel=0' Example: [#1] sp tiger +karo_doo 10,15,2,2,0,0 karo_label_sort :: Rearrange a label image (the selected image) according to region size Example: [#1] 400,400 srand 12345 rand 0,1 b 3 ge 50% label_fg 0,1 +karo_label_sort dh 400,200,{iM-1},1,{iM} Author : KaRo and David Tsch.. Latest update : 2013/04/07. karo_label: tolerance>=0,is_high_connectivity={ 0 | 1 }, _sort={ 0 | 1} Label connected components in selected images and possibly sort by region size. Default values: 'is_high_connectivity=sort=0' Example: [#1] follic_ k. +karo_label 0,,1 +dh. {w},{h},{iM},1 Author : KaRo and David Tsch.. Latest update : 2013/04/07. karo_bin_fill :: Fill holes in binary pattern. A 1-bit border is deleted to ensure background detection. Example: [#1] follic otsu 256 +karo_bin_fill. karo_bin_rand_del: _thickness(=1) _typ={0=all | 1=top/right | 2=bottom/left} Delete border (defined by _thickness) touching 4-connected objects/regions in binary pattern either around, at top/right or at bottom/left borders. The latter two serve for unbiased sampling/counting of object sets in limited test areas, the "forbidden line algorithm". Example: [#1] follic threshold 18.6% negate[-1] +karo_bin_rand_del[-1] , +karo_bin_rand_del[-2] ,1 +karo_bin_rand_del[-3] ,2 a[-1--3] c karo_bin_max :: Select maximum 4-connected region in binary Example: [#1] follic_ k. +karo_bin_max a c karo_segmentarea: low Get all 4-connected non-zero (foreground) regions of area>=low Delete small regions Number of remaining objects in status Example: [#1] 400,400 srand 12345 rand 0,1 b 3 ge 50% +karo_segmentarea 50 a c karo_threshold: _method={ triangle | yen | otsu | _otsu | bgt | intermeans | intera | rats | fixnnn | huang | huang2 | li | moments | minerrori | maxentropy | mean | renyientropy | shanbhag | bgt2 },_delclass>0,_smooth>0 Calculate threshold (methods derived from ImageJ) in range [0,255] using histogram evaluation, evtl. normalization necessary. Methods 'otsu','_otsu' and 'rats' base on image evaluation in contrast to the other methods. For help do 'gmic help otsu' or '... _karo__otsu' or '... rats'. Method 'fixnnn' allows to apply a fixed threshold 'nnn' calling '_karo_fix nnn'. Method 'intera' calls the internal function 'x_threshold' in interactive mode For each method the user function _karo_'method' is called! If {_delclass > 0} delete cluster {_delclass-1}. If {_smooth > 0} blur_x histogram with amplitude _smooth. No histogram processing for otsu, rats and intera! No test for existence of method! Default values: 'method=triangle', 'delclass=smooth=0' Example: [#1] sp tiger luminance. +karo_threshold. otsu karo_threshold.. triangle karo_threshold_demo :: Display 4x4 different threshold methods applied to selected image Example: [#1] follic karo_threshold_demo , negate. [#2] sp to_gray karo_threshold_demo karo_rats: _pow(0.5) 'R'obust 'a'utomatic 't'hreshold 's'election (Kittler et al. 1985) Input image (not histogram similar otsu!) Default value: 'pow=0.5' Example: [#1] osteo +karo_rats hist_percentile: _nth[%],_zero={0|1},_min0,_stepw Estimation of _nth percentiles (lower & upper) from histogram and returning value(s) in status (${}) _zero Class 0 is zeroed if !=0 _min0 value of class 0 _stepw value of class width (bin size) Default values: 'nth=25%', '_zero=0', '_min0=0', '_stepw=1' Example: [#1] sp tiger luminance +dh ,,256,0,255 histogram.. 256,0,255 hist_percentile.. , rm.. t=${} to_rgb text $t,40, 5,23,1,255,0,0 karo_morpho: action, _kernel(0), _size(5), _ckernel("1,0,1; 0,1,0; 1,0,1") Mathematical morphology filter action={0=Ero | 1=Dil | 2=Open | 3=Close | 4=Ori-Ero | 5=Dil-Ori | 6=Ori-Open | 7=Close-Ori | 8=(Ori2-(Open+Close))0.5 | 9=Close-Open} _kernel={0=Square | 1=Octogon | 2=Circle | 3=Custom} _size>=2(5) _ckernel (custom kernel only if _kernel==3) Default values: 'kernel=0', 'size=5','ckernel=1,0,1;0,1,0;1,0,1' Derived from D. Tschumperle's older fx_morpho (formerly gmic_stdlib) and extended by action 4..9 Example: [#1] osteo +karo_morpho 4,3,,"0\,1\,0\;1\,1\,1\;0\,1\,0" hist_feature: _nofeature>=-2,_nth>0,_zero={0|1},_min0,_stepw,_percent[%]>0 Estimation from histogram (frequency dist, 1d image) the features 'mode','sum' (m0),'mean' (m1),'SD' (m2),'min','max','median','iqr' (hiq-loq+1),'loq','hiq' returned in status (${}). nofeature=-2 mode,m0,m1,m2,min,max,med,iqr,loq,hiq, -1 mode,0 sum,1 mean,2 SD,3 min,4 max,5 median, 6 iqr (interquantile range),7 loq (lower quantile),8 hiq (higer qunatile) nth extreme value (nth+1 occurence!) zero Class 0 is zeroed if !=0 min0 value of class 0 stepw value of class width (bin size) percent quantile Default valalues: '_nofeature=-2', '_nth=1', '_zero=0', '_min0=0', '_stepw=1', '_percent=25%' Updated 140314 (smoothing replaced by nth selection) Updated 100817 (percent parameter and iqr,loq,hiq feature added) Example: [#1] sp tiger luminance +histogram 256,0,255 dh.. ,,256,0,255 hist_feature , repeat 8 t={_arg($>+1${})} text $t, 40,{$>*25+5},23,1,128 done rm. hist_feature_demo: Parameters like in hist_feature (Plot) of features in blue into the histogram with Gaussian in green Example: [#1] sp 0 luminance +threshold 40 * histogram 256,0,255 = 0,0 hist_feature_demo , dg 600,300,3 karo_nth_max: _n(1),_ind(=0) Return in the status the _n-th max or the index of the n-th max of an image Possibility to fetch the index instead of the value (_ind=1) Default values: 'n=1', 'ind=0' karo_nth_min: _n(1),_ind(=0) Return in the status the _n-th min of an image or the index of the _n-th min of an image Possibility to fetch the index instead of the value (_ind!=1) Default values: 'n=1', 'ind=0' karo_VST: _inverse(=0) Variance Stabilizing Transformation following http://hal.archives-ouvertes.fr/docs/00/51/08/66/PDF/Burst_Hal.pdf Example: [#1] sp tiger v1=${-std_noise},2,2 +karo_VST. 0 v2=${-std_noise},2,2 +karo_VST. 1 text... $v1 text.. $v2 Default values: 'inverse=0' pearson_correlation :: Compute pearson-correlation using two-by-two selected images. Example: [#1] sp tiger +shift -30,-20 pearson_correlation text. {_${}},0,0,20%,1,255,255,255 karo_extinction: _whitevalue[%] Convert (integer) transmission image into extinction with _whitevalue. Default value: 'whitevalue=100%' Example: [#1] osteo +karo_extinction region_feature: [labelimage],_region_label(1),_feature({wh}) Return feature for a specified region in status. Selected image is unchanged, only one is evaluated. Argument '_feature' is a string that corresponds to the way the feature would be requested for the entire image in math. processor syntax without {}. Example: [#1] 200,256 follic +threshold. 18.6% negate. label_fg. 0,1 repeat 10 region_feature.. .,{$>+1},"ia,h" text[0] {``$>\ ${}},5,{$>*14+14},13,1,255 done region_feature_example: _sample={follic | sample name/number},_number Illustrate region_feature Example: [#1] region_feature_example 40,15 f. if(i,i*2+100,0) karo_feat_eval_n: [maskimage],_high_connectivity,_oneo Compute features from selected transmission (grey) image and multi-component maskimage. if _oneo is true, mask is considered as one-component maskimage Features: centroid (x,y), area, mean extincton, sd extinction. follic_ loads an example image and mask Example: [#1] follic_ karo_feat_eval_n.. . run "repeat h#-2 =. 2,{i(#-2,0,$>)},{i(#-2,1,$>)} done" +ge. 2 delaunay3d. n.. 0,255 j3d.. .,0,0,0,0.5,1 rm. descriptive_feature :: Estimation of features number(sum,m0),mean(m1),SD(m2),skewness(m3),kurtosis(m4),min,max,median from skalar images. See custom function example_descriptive_feature example_descriptive_feature: [region],_all(false),_background(false),_verbose_draw(true),_verbose_text(false) Example for feature extraction from a selected grey image and a [region] mask or label image using 'extract_region' and 'descriptive_feature'. More than 9 regions are truncated if _all false. Background region (label 0) is only calculated if _background true. Graphical display of feature with _verbose_draw true and textual display only with _verbose_text == true. The list of features is returned in status, label,area,mean,SD,curtosis,excess,min,max,median for each region. 'osteo_' and 'follic_' in the examples are transmission image examples from microscopic cells with region masks Example: [#1] osteo_ example_descriptive_feature.. . e ${} [#2] follic_ karo_extinction.. , label_fg. 0 example_descriptive_feature.. . kr_mean_lch: _mode(0..4) Calculate LCH color features from selected RGB image after application of rgb2lch [ mean l(uminance), c(hromaticity), h(hue), sd l, c, h ] returned in status and global variable _kr_mean_lch. Mean and sd of h is the circular mean and sd of hue (angles)! There is no test of image mode RGB! mode==0 return original (default) mode==1 return original and image generated from original l(uminance) and mean c, mean h mode==2 return original and const. image generated from mean l(uminance), mean c, mean h mode==3 return original and image generated from l(uminance), c, mean h mode==4 return original and image generated from l(uminance), mean c, h Default value: 'mode=0' Example: [#1] sp wall kr_mean_lch. 1 (${}) s. x,2 rm. [#2] sp +luminance threshold. 50% karo_close. 15,1 +extract_region.. .,0,1 kr_mean_lch. 0 (${}) rm.. +rgb2lch... s. c f.. {-4,@1} f. {-4,@2} a[-1--3] c lch2rgb. rm.. f. I=i#-2?I:I#-3 # Replace region with mean chromaticity amd mean hue karo_shape_moments: selected image considered as binary or skalar pattern with pixle values0 outside the pattern or region and either 1 (for binary) or !=0 for skalar pattern. Calculation of shape moments and other features returned in status. With mean==1 input was binary otherwise skalar! Moments m00=sum, m10,m01 centroid, orientation=theta, mean, h1-h7 Hu's moment invariants, with length. Result in status: sum centroid_x,y theta eccenticity mean Hu_moments_1-7 main_axis_lengths 0-14 m00 m10 m01 theta excent mean h1 h2 h3 h4 h5 h6 h7 width length Result in global variable _karo_shape_moments: moments, centered and normalized moments m, my, eta, Hu's moment invariants h1-h7, orientation, eigenvalues, eccentricity and extension: 0-15 [[$m00,$m01,$my02,$my03],[$m10,$my11,$my12,0],[$my20,$my21,0,0],[$my30,0,0,0]], 16-31 [[$eta00,$eta01,$eta02,$eta03],[$eta10,$eta11,$eta12,0],[$eta20,$eta21,0,0],[$eta30,0,0,0]], 32-39 [$h1,$h2,$h3,$h4,$h5,$h6,$h7,0], 40-47 [$theta,$lambda1,$lambda2,$excent,0,0,0,0] Example: [#1] osteo_ k. +karo_shape_moments _sm=${} to_rgb n 0,255 circle ${arg\ 2,$_sm},${arg\ 3,$_sm},1%,1,255,0,0 [#2] osteo_ * +karo_shape_moments _sm=${} to_rgb n 0,255 circle ${arg\ 2,$_sm},${arg\ 3,$_sm},1%,1,255,0,0 karo_shape_moments_example :: Any selected skalar image is evaluated for all pixels != 0 Example: [#1] osteo_ k. karo_shape_moments_example 1.5. User Karo's GIMP/gui Custom functions ------------------------------------- fx_karo_mm_diff: _size,_size2,_operation,_shape,_channel,_scale Compute difference of math. morph. operation with two sizes on selected images. _size = int(5,1,25) _size2 = int(7,1,25) _operation = choice(2,"Erosion","Dilation","Open","Close") _shape = choice(1,"Square","Octagon","Circle") _channel = choice(0,"All","RGBA [All]","RGB [All]","RGB [Red]","RGB [Green]","RGB [Blue]","RGBA [Alpha]", "Linear RGB [All]","Linear RGB [Red]","Linear RGB [Green]","Linear RGB [Blue]","YCbCr [Luminance]", "YCbCr [Blue-Red Chrominances]","YCbCr [Blue Chrominance]","YCbCr [Red Chrominance]", "YCbCr [Green Chrominance]","Lab [Lightness]","Lab [ab-Chrominances]","Lab [a-Chrominance]", "Lab [b-Chrominance]","Lch [ch-Chrominances]","Lch [c-Chrominance]","Lch [h-Chrominance]","HSV [Hue]", "HSV [Saturation]","HSV [Value]","HSI [Intensity]","HSL [Lightness]","CMYK [Cyan]","CMYK [Magenta]", "CMYK [Yellow]","CMYK [Key]","YIQ [Luma]","YIQ [Chromas]","RYB [All]","RYB [Red]","RYB [Yellow]","RYB [Blue]") _scale = bool(true) Arithmetical difference of a morphological operation of size and size2. Author : KaRo. Latest update : 2019/09/03. fx_karo_cimg_nlmeans: add_Gauss_noise(0),add_uniform_noise(0),add_salt_pepper(0),patch_size(0),lambda(-1),noise_sd(-1),alpha(3),steps(2) Execute use_nlmeans (CImg demo) external. fx_karo_cimg_skel: auto_thresh(1),thresh(50%),median(0),invert(0),thresh_flux(-0.3),medial_curve(0),Torsello corr(0),steps(1) Execute use_skeleton (CImg demo) external. fx_karo_oc_diff: _size,_shape,_channel,_scale Compute difference of math. morph opening and closing on selected images. _size = int(5,1,25) _shape = choice(1,"Square","Octagon","Circle") _channel = choice(0,"All","RGBA [All]","RGB [All]","RGB [Red]","RGB [Green]","RGB [Blue]","RGBA [Alpha]", "Linear RGB [All]","Linear RGB [Red]","Linear RGB [Green]","Linear RGB [Blue]","YCbCr [Luminance]", "YCbCr [Blue-Red Chrominances]","YCbCr [Blue Chrominance]","YCbCr [Red Chrominance]", "YCbCr [Green Chrominance]","Lab [Lightness]","Lab [ab-Chrominances]","Lab [a-Chrominance]", "Lab [b-Chrominance]","Lch [ch-Chrominances]","Lch [c-Chrominance]","Lch [h-Chrominance]","HSV [Hue]", "HSV [Saturation]","HSV [Value]","HSI [Intensity]","HSL [Lightness]","CMYK [Cyan]","CMYK [Magenta]", "CMYK [Yellow]","CMYK [Key]","YIQ [Luma]","YIQ [Chromas]","RYB [All]","RYB [Red]","RYB [Yellow]","RYB [Blue]") _scale = bool(true) Arithmetical difference of a morphological operation of size and size2. Author : KaRo. Latest update : 2019/09/03. fx_karo_pink: _operator(=11), _connect(=0), _smooth(=0), _param(=5), _channel(=0) _operator = 0..19 ("wshedtopo","wshedtopo inv","minima","maxima","heightminima","heightmaxima","grayskel","htkern", "htkernu","lvkern","lvkernu","saliency","asf","asflin","asfr","asft","asftmed","asftndg","dilatballnum", "erosballnum","lintophat") _connect = 0..1 ("Four/x","Eight/y") _smooth = 0.. _param = 0..25 _channel = choice(0,"All","RGBA [All]","RGB [All]","RGB [Red]","RGB [Green]","RGB [Blue]","RGBA [Alpha]","Linear RGB [All]","Linear RGB [Red]","Linear RGB [Green]","Linear RGB [Blue]","YCbCr [Luminance]","YCbCr [Blue-Red Chrominances]","YCbCr [Blue Chrominance]","YCbCr [Red Chrominance]","YCbCr [Green Chrominance]","Lab [Lightness]", "Lab [ab-Chrominances]","Lab [a-Chrominance]","Lab [b-Chrominance]","Lch [ch-Chrominances]","Lch [c-Chrominance]", "Lch [h-Chrominance]","HSV [Hue]","HSV [Saturation]","HSV [Value]","HSI [Intensity]","HSL [Lightness]","CMYK [Cyan]","CMYK [Magenta]","CMYK [Yellow]","CMYK [Key]","YIQ [Luma]","YIQ [Chromas]","RYB [All]","RYB [Red]","RYB [Yellow]","RYB [Blue]") Example: [#1] sp tiger +fx_karo_pink , +- [#2] sp tiger +fx_karo_pink. 12,1,0.582524,10,0,0 +fx_karo_pink.. 12,0,0.582524,10,0,0 +[-1,-2] # asflin in x and y fx_karo_pink_bianca: Pink test operator bianca ASF smooth size = int(5,1,10) Threshold (%) = int(60,0,100) Watershed height min = int(5,0,20) Opening radius = int(1,0,10) Invert = bool(0) Use G instead of B = bool(0) Pink test operator Bianca for RGB image; only B used. Pink executables in search PATH or C:\Pink\bin\ for Windows Author : KaRo. Latest update : 2012/11/18 note = link("https://perso.esiee.fr/~coupriem/Pink/doc/html/files.html")