This archive contains implementation of the Histogram Binning/Packing method, described in T.Bernas, P.Robinson, B.Rajwa, R.Starosolski "Application of detector precision characteristics and histogram packing for compression of biological fluorescence micrographs". This implementation is intended for research purposes only; it is provided "as is"; authors make no warranty of any kind, either express or implied, with respect to this software. (c) 2011 Roman Starosolski and Tytus Bernas User has to input in the commandline image dark signal and noise coefficients, based on them implementation outputs mappings of levels in noisy (original) image to levels after Histogram Binning (HB) and to levels after Histogram Binning and Packing (HBP). Implementation may also perform actual image conversions for HB and HBP methods. If filenames are given (input filename has to be in the PGM format, type P5 - single channel binary BigEndian), then one of following three modes of operation is selected: a) -raw_to_HB perform histogram binning (default) of noisy image b) -raw_to_HBP perform histogram binning and packing of noisy image c) -HBP_to_HB restore HB image from histogram packed image Commandline parameters, any order, *-obligatory: -p_max_levels n maximum intensity, default 65535 -p_multn n * multiplicative noise coefficient (square of) -p_poissn n * Poisson noise coefficient (square of) -p_addn n * Additive noise coefficient (variance) -p_darklev n * Dark signal (average intensity) -p_conf_lev n confidence level (t value), default 1.96 -f_in f input file name, if not given just output HB levels image must be in PGM P5 single channel binary BigEndian -f_out f otput file name -raw_to_HB perform histogram binning (default) -raw_to_HBP perform histogram binning and packing -HBP_to_HB restore histogram packed image This archive contains files: readme.txt - this file hbp.c - implementation in C hbp.exe - Win32 executable mp_fib_001.pgm - noisy microscope image, detector characteristic: p_multn=0, p_poissn=0.441128967, p_addn=44.10389456, p_darklev=17.83913285 mp_fib_001_hb.pgm - image mp_fib_001.pgm after histogram binning with above parameters mp_fib_001_hbp.pgm - image mp_fib_001.pgm after histogram binning and packing with above parameters Usage examples: >hbp -p_max_levels 4095 -p_multn 0 -p_poissn 0.441128967 -p_addn 44.10389456 -p_darklev 17.83913285 this will output mapping of levels betwen raw(noisy), histogram Binned (HB) and Histogram Binned and Packed (HBP) image: p_max_levels =4095.000000 p_multn =0.000000 p_poissn =0.441129 p_addn =44.103895 p_darklev =17.839133 p_conf_lev =1.960000 processing mode : raw->HB raw level range HB level HBP level [ 0 .. 29 ] 17 0 [ 30 .. 59 ] 45 1 [ 60 .. 92 ] 76 2 [ 93 .. 129 ] 111 3 [ 130 .. 169 ] 150 4 [ 170 .. 213 ] 192 5 [ 214 .. 260 ] 237 6 [ 261 .. 310 ] 286 7 [ 311 .. 364 ] 338 8 [ 365 .. 421 ] 393 9 [ 422 .. 482 ] 452 10 [ 483 .. 546 ] 515 11 [ 547 .. 614 ] 581 12 [ 615 .. 685 ] 650 13 [ 686 .. 759 ] 723 14 [ 760 .. 837 ] 799 15 [ 838 .. 918 ] 878 16 [ 919 .. 1003 ] 961 17 [ 1004 .. 1091 ] 1048 18 [ 1092 .. 1182 ] 1137 19 [ 1183 .. 1277 ] 1230 20 [ 1278 .. 1375 ] 1327 21 [ 1376 .. 1477 ] 1427 22 [ 1478 .. 1582 ] 1530 23 [ 1583 .. 1690 ] 1637 24 [ 1691 .. 1802 ] 1747 25 [ 1803 .. 1917 ] 1860 26 [ 1918 .. 2036 ] 1977 27 [ 2037 .. 2158 ] 2098 28 [ 2159 .. 2283 ] 2221 29 [ 2284 .. 2412 ] 2348 30 [ 2413 .. 2544 ] 2479 31 [ 2545 .. 2680 ] 2613 32 [ 2681 .. 2819 ] 2750 33 [ 2820 .. 2961 ] 2891 34 [ 2962 .. 3107 ] 3035 35 [ 3108 .. 3256 ] 3182 36 [ 3257 .. 3409 ] 3333 37 [ 3410 .. 3565 ] 3488 38 [ 3566 .. 3724 ] 3645 39 [ 3725 .. 3887 ] 3806 40 [ 3888 .. 4053 ] 3971 41 [ 4054 .. 4095 ] 4095 42 No infile, done. >hbp -p_max_levels 4095 -p_multn 0 -p_poissn 0.441128967 -p_addn 44.10389456 -p_darklev 17.83913285 -f_in mp_fib_001.pgm -f_out HB.pgm output tables as above, perform Histogram Binning on mp_fib_001.pgm, save resulting image as HB.pgm (should have the same contents as mp_fib_001_hb.pgm) >hbp -p_max_levels 4095 -p_multn 0 -p_poissn 0.441128967 -p_addn 44.10389456 -p_darklev 17.83913285 -f_in mp_fib_001.pgm -f_out HBP.pgm -raw_to_HBP output tables as above, perform Histogram Binning and Packing on mp_fib_001.pgm, save resulting image as HBP.pgm (should have the same contents as mp_fib_001_hbp.pgm) >hbp -p_max_levels 4095 -p_multn 0 -p_poissn 0.441128967 -p_addn 44.10389456 -p_darklev 17.83913285 -f_in HBP.pgm -f_out re-HB.pgm -HBP_to_HB output tables as above, recreate Histogram Binned image re-HB.pgm from Histogram Binned and Packed image HBP.pgm (re-HB.pgm should be the same as HB.pgm). Note that for HBP to HB conversion, aside the HBP image, You have to store the noise parameters, or the histogram of HB image