This is a collection of Matlab functions programmed by a number of people at DIKU, 3DLab, ITU, and Eindhoven. This site is intended to contain the most recent versions of these shared Matlab functions. This is an experimental setup. If you have comments or would like to add or update a function, please mail me at: [email protected].
Most functions are carefully documented using embedded comments in the beginning of the file. Hence you may learn more about the functions by viewing the M-code. The comments use the standard Matlab style: the first line is the function head followed by the help section used by the Matlab help command. An example of a properly written help section is given in scale.m. The first line contains a one-line description, followed by an empty line, and ending with the body of the help text.
These functions have been developed to extend Root Painter with axis aligned multiplanar training and prediction.
| File | Description | Date | Author |
|---|---|---|---|
| addAnnotation.m | Add an training-annotation pair to an existing root painter file structure | Apr 2025 | Jon Sporring |
| bestOfTwo.m | perform pixelwise majority voting on logical arrays | Apr 2025 | Jon Sporring |
| combineCoarseStructures.m | combine 3 equal size segmentations | Apr 2025 | Jon Sporring |
| combineThinStructures.m | combine 3 equal size segmentations | Apr 2025 | Jon Sporring |
| loadSeries.m | load a sequence of images | Apr 2025 | Jon Sporring |
| multiplaneCombine.m | combine orthogonal sliced 2d series into a single 3D image | Apr 2025 | Jon Sporring |
| multipageTiffToSeries.m | read a multipage tiff and save as a sequence of images | Apr 2025 | Jon Sporring |
| multiplaneSplit.m | reslice a 3d images into orthogonal 2d planes | Apr 2025 | Jon Sporring |
| saveSeries.m | load a sequence of images | Apr 2025 | Jon Sporring |
| seriesToMultipageTiff.m | read a sequence of images and save as a multipage tiff | Apr 2025 | Jon Sporring |
| splitSeries.m | save an image into 3 orthogonal series | Apr 2025 | Jon Sporring |
These functions have are general purpose.
| File | Description | Date | Author |
|---|---|---|---|
| extend.m | Periodic flip-extension of matrices | Sep 1996 | Jon Sporring |
| makeRandomFileName.m | make a random, non-existing filename in path | Apr 2025 | Jon Sporring |
| trim.m | return the smallest axis aligne cube containing all true values in I | Apr 2025 | Jon Sporring |
| resample3.m | resample I to become the size sz. | Apr 2025 | Jon Sporring |
| mul.m | multiply 3 dimensional images in the coordinates of the first argument | Apr 2025 | Jon Sporring |
| power2expand.m | Expand image to nearest higher power of 2 using imresize | Sep 1996 | Jon Sporring |
| sign2.m | Alternative sign calculation. | Jan 1994 | Jon Sporring |
| stretch.m | Do a linear re-mapping of the values in a matrix | Jan 1997 | Jon Sporring |
| waitbarTxt | print a wait progress bar in text | Apr 2025 | Jon Sporring |
These functions implement the Gaussian scale-space in various ways.
| File | Description | Date | Author |
|---|---|---|---|
| scale.m | Linear Scalespace for 1 and 2 dimensions using Fourier Implementation. | April 2001 | Jon Sporring |
| scale2.m | Similar to scale.m. Kept for compatibility reasons | May 2000 | Jon Sporring |
| scalen.m | Linear Scalespace for any dimensions using Fourier Implementation. | Feb 2000 | Jon Sporring |
| scalespace.m | A stack of images from the Linear Scalespace using scale.m. | Jan 1997 | Jon Sporring |
| scalevw.m | Linear Scalespace using scale.m implementing gauge derivatives. | Nov 2000 | Ole Fogh Olsen |
These functions were part of Joachim Weickert's course May 1998 at DIKU. Some of these functions were written in C by Weickert, except for some key elements which were completed by Jon Sporring as part of the course. Sporring has later wrapped the C-code in a mexfunction. Therefore, the M-files are just the Matlab help-text, and the real code is the mex-program with the prefix .c. An example of a setup file of the mex (actually C) compiler is given in mexopts.sh. The test scripts use the image noise.tif.
| File | Description | Date | Author |
|---|---|---|---|
| ild.m | Isotropic Linear Diffusion | Jan 2001 | Jon Sporring |
| ind.m | Isotropic Nonlinear Diffusion using ild.m | Oct 2000 | Joachim Weickert & Jon Sporring |
| ind_aos.c ind_aos.m ind_aostest.m |
Isotropic Nonlinear Diffusion using Additive Operator Splitting | May 1998 | Joachim Weickert & Jon Sporring |
| eed.m | Edge-enhancing Anisotropic Diffusion using ild.m | Oct 2000 | Joachim Weickert & Jon Sporring |
| ced.m | Coherence Enhanced Diffusion using ild.m | Oct 2000 | Joachim Weickert & Jon Sporring |
| erosion.m | Morphological Erosion | Oct 2000 | Jon Sporring |
| dilation.m | Morphological Dilation | Oct 2000 | Jon Sporring |
| mcm.m | Mean Curvature Motion | Oct 2000 | Joachim Weickert & Jon Sporring |
| amss.m | Affine Morphological Scalespace | Oct 2000 | Joachim Weickert & Jon Sporring |
| File | Description | Date | Author |
|---|---|---|---|
| nlfilter3.m | 3d extension of nlfilter2: any block filtering of a 3 dimensional image | Nov 2015 | Jon Sporring |
| File | Description | Date | Author |
|---|---|---|---|
| biasCorrect.m | Estimate the bias field for a 2 dimensional matrix | Oct 2014 | Jon Sporring |
| biasCorrect3d.m | Estimate the bias field for a 3 dimensional matrix | Dec 2015 | Jon Sporring |
| File | Description | Date | Author |
|---|---|---|---|
| sgnDstFromImg.m | Signed Distance Function | Dec 2004 | Henrik Dohlmann, Kenny Erleben, & Jon Sporring |
| chanVese.m | Chan Vese segmentation | Dec 2004 | Jon Sporring |
| 054.tif | Test data for chanVese.m | Dec 2004 | Jon Sporring |
| File | Description | Date | Author |
|---|---|---|---|
| finitediff.m | Calculate the finite difference stencil in 1 dimension | Nov 2003 | Jon Sporring |
| zerocrossing.m | Finds the fractional indices of the zerocrossings of a sampled function | Jan 1996 | Jon Sporring |
| crossings.m | Finds the points where two images are identically equal to zero. | Jan 1996 | Jon Sporring |
| curvature.m | Calculates the Gaussian and Mean curvature of an image using scale.m. | Nov 1997 | Jon Sporring |
| isocurvature.m | Calculates the Isophote curvature using scale.m. | Jan 1997 | Jon Sporring |
| isocurvature2.m | Calculates the Isophote curvature using scale.m. | Jan 1997 | Jon Sporring |
| dexpr.m tokens.def |
Parses and computes a differential expression using scale.m. | March 2001 | Martin Lillholm |
| snake.m | Implementation of Kass's et al. snake | Dec 2003 | Jon Sporring |
| snakeTest.m | A demonstration program for snake.m | Dec 2003 | Jon Sporring |
Function to produce various parameterized distributions.
| File | Description | Date | Author |
|---|---|---|---|
| beta.m | The beta distribution | May 1997 | Jon Sporring |
| binomial.m | The binomial distribution | May 1997 | Jon Sporring |
| chi.m | The X^2 distribution | May 1997 | Jon Sporring |
| exponential.m | The exponential distribution | May 1997 | Jon Sporring |
| fbm_image.m | Generate a randomly chosen Fractal Brownian Motion image. | Jan 1997 | Jon Sporring |
| geometric.m | The geometric distribution | May 1997 | Jon Sporring |
| histogram2Quantile.m | calcualte the p'th quantile from histogram bins and edges | Apr 2025 | Jon Sporring |
| lognormal.m | The log-normal distribution | May 1997 | Jon Sporring |
| makeTube.m | generate a 3D image of a filled tube with rounded endings | Nov 2023 | Jon Sporring |
| makeRandomTubes.m | generate a 3D image with non-overlapping random tubes | Nov 2023 | Jon Sporring |
| normal.m | The normal or Gaussian distribution | May 1997 | Jon Sporring |
| poisson.m | The Poisson distribution | May 1997 | Jon Sporring |
| RandomIsingImage.m | Generate a random image under the Ising Gibbs Random Field model. | Dec 2003 | Jon Sporring |
| randomSample.m | generate random samples distributed similarly to a histogram | Apr 2025 | Jon Sporring |
| randUnit3.m | niformly and randomly distributed points on a sphere | Nov 2023 | Jon Sporring |
| rnd_paste_image.m | Generate a random image of pasted sub-images. | Jan 1997 | Jon Sporring |
Function to produce various parameterized distributions.
| File | Description | Date | Author |
|---|---|---|---|
| kmean.m | A slow but precise kmean algorithm. | Jan 1994 | Jon Sporring |
| kmean2.m | Uses kmean.m with random starting points. | Jan 1994 | Jon Sporring |
| localhist.m | Calculates the Gaussian weighted local histogram in a point of an image using scale.m. | Dec 1999 | Jon Sporring |
| localhist2.m | Calculates all the Gaussian weighted local histograms in an image using localhist.m. | Jun 2001 | Jon Sporring |
| guilocalhist2.m | A stand-alone graphical user interface to localhist2.m. | Oct 2000 | Jon Sporring |
| cooccurrence.m | Calculates the cooccurrence matrix for a gray-valued image. | Jan 1997 | Jon Sporring |
| emGaussianMixture.m | Expectation Maximization estimation for a Mixture of Gaussian Model | Nov 2003 | Jon Sporring |
| emGaussianMixtureTest.m | A demo script for emGaussianMixture.m | Nov 2003 | Jon Sporring |
| File | Description | Date | Author |
|---|---|---|---|
| uni_length.m | Calculate the code length of the Universal Distribution of Integers. | Jan 1996 | Jon Sporring |
| entropy.m | Calculate the entropy of a distribution. | Jan 1996 | Jon Sporring |
| information.m | Calculate the generalized-entropy of a distribution. | May 1997 | Jon Sporring |
| information_scale.m | Calculate the generalized-entropy of a distribution over a number of scales using scale.m. | May 1997 | Jon Sporring |
| inf2spect.m | Transform generalized-entropies to a multifractal spectrum. | May 1997 | Jon Sporring |
| local_information.m | Calculate the local entropy map of an image | Jan 1996 | Jon Sporring |
| spectrum.m | Calculate the multifractal spectrum a distribution using inf2spect.m and information_scale.m. | May 1997 | Jon Sporring |
These functions may also be used to parse contourc.m list, and they implement a general list of vectors of arbitrary dimension.
| File | Description | Date | Author |
|---|---|---|---|
| list_concat.m | Concatenate two lists. | Mar 1997 | Jon Sporring |
| list_delete.m | Delete element from list. | Mar 1997 | Jon Sporring |
| list_first.m | Get index of first element in list. | Mar 1997 | Jon Sporring |
| list_forall.m | Map function onto all elements of list. | Mar 1997 | Jon Sporring |
| list_get.m | Get element in list. | Mar 1997 | Jon Sporring |
| list_get_attributes.m | Get attributes of element. | Mar 1997 | Jon Sporring |
| list_getn.m | Get n'th element in list. | Mar 1997 | Jon Sporring |
| list_insert.m | Insert element in list. | Mar 1997 | Jon Sporring |
| list_last.m | Get last element of list. | Mar 1997 | Jon Sporring |
| list_mat2vec.m | Mar 1997 | Jon Sporring | |
| list_n.m | Get index of n'th element in list. | Mar 1997 | Jon Sporring |
| list_next.m | Get index of next element in list. | Mar 1997 | Jon Sporring |
| list_set_attributes.m | Set attributes of element in list. | Mar 1997 | Jon Sporring |
| list_size.m | Get number of elements in list. | Mar 1997 | Jon Sporring |
| list_toCell.m | Convert a list to a cell-array. | July 2014 | Jon Sporring |
| list_valid_pointer.m | Check for valid index. | Mar 1997 | Jon Sporring |
| list_vec2mat.m | Mar 1997 | Jon Sporring |
These DIKU mex-functions require the DIKU image library to be compiled. Conversely, the HIPS reader hacks the HIPS format and should therefore be used with care. It is mainly intended as an example.
| File | Description | Date | Author |
|---|---|---|---|
| dikuread.c dikuread.m |
Input a DIKU image from disk using the DIKU library. | Mar 1996 | Jon Sporring |
| dikuwrite.c dikuwrite.m |
Output a DIKU image to disk using the DIKU library. | Mar 1996 | Jon Sporring |
| hipsread.c hipsread.m |
Read a HIPS image from disk. | Oct 2000 | Jon Sporring |
Tools for simple experiements with numbers base 2
| File | Description | Date | Author |
|---|---|---|---|
| int_to_binary.m | Convert an integer to binary form. | Jan 1994 | Jon Sporring |
| binary_to_int.m | Convert a binary number into an integer | Jan 1994 | Jon Sporring |
Tools for working with polynomials on Newton form
| File | Description | Date | Author |
|---|---|---|---|
| newtonvalue.m | Calculates the value of a polynomial on Newton form | Jan 1997 | Jon Sporring |
| divdiff.m | Calculates the divided differences vector for a polynomie in Newton form. | Jan 1997 | Jon Sporring |
Old stuff yet to be organized.
| File | Description | Date | Author |
|---|---|---|---|
| distToSegment.m | Eucledian distance to a line segment | Nov 2023 | Jon Sporring |
| ppvalue.m | Calculate the value of the j'th derivative of a piece-wise polynomial | Jan 1997 | Jon Sporring |
| isophote.m | return a list of vectors indicating the isophote curve beginning at X | Jan 1997 | Jon Sporring |
| interval.m | Find which interval x belongs to in B | Jan 1997 | Jon Sporring |
| interpolate.m | Does an interpolation of F values | Jan 1997 | Jon Sporring |
| hamming_distance.m | The hamming distance between two binary matrices | Jan 1994 | Jon Sporring |
| extract.m | Calculates a function as a list of points at V in L. | Jan 1997 | Jon Sporring |
| chebyshevspace.m | Calculates the Chebyshevs sampling points. | Jan 1997 | Jon Sporring |