I'd like to compute ImageCooccurence for an Image3D object. Mathematica advertises that "Now essentially any operation possible for 2D images also works for 3D images." https://www.wolfram.com/mathematica/new-in-10/enhanced-3d-image-processing/

I've defined a 3D Kernel and a 3D image as such:

kernel3d = {
  {{0, 0, 0}, {0, 1, 0}, {0, 0, 0}},
  {{0, 1, 0}, {1, 0, 1}, {0, 1, 0}},
  {{0, 0, 0}, {0, 1, 0}, {0, 0, 0}}};
image3d = Image3D[RandomReal[1, {5, 5, 5}]];

When I run ImageCooccurrence[image3d,10,kernel3d], Mathematica just reports that the the input should be an Image.

Is there any ImageCooccurrence extension for Image3D? If not, does anyone have any suggestions for quickly accomplishing this?

  • $\begingroup$ I'm struggling to understand what ImageCoocurrence actually does. From the docs ImageCooccurrence[image,n] returns an n*n matrix m whose elements mij represent the probability of all occurrences of a pixel with intensity i to the left or bottom of a pixel with intensity j, assuming all pixels to lie in one of n successive bins. - represent the probability of ... what? Also what is the kernel for? If somebody could take this sentence and dumb it down a bit we might have an answer. $\endgroup$ – flinty Jun 19 at 14:12
  • 2
    $\begingroup$ Say you have a 4x4 2D Image with just two colors: black and white. We can assign this image n=2 bins (one black, one white). Say this image has vertical stripes that are one pixel wide (bl, wh, bl, wh). If the kernel is {{0,0,0},{0,0,1},{0,0,0}}, ImageCooccurrence will check the pixel immediately to the right of every pixel. For the black bin, this yields 0 black neighbors and 8 white. For the white bin, this yields 4 black neighbors and 0 white. The resulting matrix is {{0,8},{4,0}}. The func then just divides by 12 (total number of neighbors) to return {{0,0.6},{0.3,0}} $\endgroup$ – Shaggy1135 Jun 20 at 8:08
  • $\begingroup$ Try ImageCooccurrence[Image[Table[{0, 1, 0, 1}, {i, 0, 4}]], 2, {{0, 0, 0}, {0, 0, 1}, {0, 0, 0}}] $\endgroup$ – Shaggy1135 Jun 20 at 8:09

Is there any ImageCooccurrence extension for Image3D?



enter image description here

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.