2D Diffusion (ImageXd)

Diffusion allows the mapping of channels or structures (here, biological tissues). It creates a vector field based on all pixels and their surroundings.

See also 3D Diffusion!


In this example, we use an image from Wikipedia (Thanks for the support!), which shows a 2-toed sloth at the Jaguar Rescue Centre in Costa Rica.

Download: Image


First step
Load an image.

▸ ImageXd

image.load "2_toed_sloth.png"

 


2-toed sloth

2-toed sloth (unsharp masking)

Second step
Calculate the vector field.

▸ ImageXd

image.32bit
new := image.diffusion 32

 

▸ More details

// Note: The diffusion method works best with isotropic pixels!
image.submethod 2 // 0=sum 1=mean 2=sd(default) 3=min 4=Q.25 5=median 6=Q.75 7=max
image.fullscan false // true = scan only full circles (without zero), false(default) = scan incomplete circles
image.diffusion.method 5 // 1=stark2013 2=stark2014a 3=stark2014b 4=stark2015a 5=stark2015b(default) 6=stark2019 // algorithm for image.diffusion
//       stark2013 = only the single best vector – vectorlength = submethod.SD
//       stark2014a = mean the two best vectors, if distance < r/2 – vectorlength = submethod.SD
//       stark2014b = mean (same submethod.SD) best vectors – vectorlength = submethod.SD
//       stark2015a = mean (same submethod.SD) best vectors (around diffusion.angle (rad)), only for diffusion.max (%)
//       stark2015b = mean the best vectors (around diffusion.angle (rad)), only for diffusion.max (%)
//       stark2019  = mean the best vectors (around diffusion.angle (rad)), only for diffusion.max (%) – vectorlength = submethod.SD
image.diffusion.max 0.25 // (%)
image.diffusion.angle 0.08726 // (rad) - 5*(pi/180) = 5°
new := image.diffusion 16 // calculate a image (orientation) field from a image with pixel scan length                                                                                         

 


Third step
Store in colorized image.

▸ ImageXd

image.use new
color.map.special 5
image.colorize

imagemagick.disable
freeimage.disable

image.save "2_toed_sloth_new.png"

 


colorized image

colorized image (unsharp masking)

superimposed image

superimposed image (unsharp masking)