Very large 3D label matrix

10 views (last 30 days)
Colin Loeffler
Colin Loeffler on 22 Mar 2015
Commented: Sean de Wolski on 23 Mar 2015
I am doing analysis on X-Ray microtomography data, the data comes in the form of several thousand gray scale images that represent horizontal slices of my sample. I import these images one by one, convert them to binary using im2bw, and "stack" them on top of each other by storing each binary image as one layer of a logical 3D array. I only have 16Gb of ram available so I store the 3D array as a disk file using the matfile function. I then identify the connected volumes in the matrix using bwcompconn() and create a label matrix (also a disk variable) using the labelmatrix() function.
I have sucessfully created a label matrix for a 2000x2000x1000 matrix but when I tried a 4000x4000x2000 matrix I got an "Out of Memory" error. I also tried the bwlabeln function with the same error.
any Idea how I can create a label matrix for very large, binary, 3d arrays using less than 16Gb of ram?
EDIT: Sorry I should have been a little more clear, I get the memory error when computing bwconncomp() on matrices bigger than 4000x4000x1000.
But after I get the label matrix I calculate a "metric" for each volume, then replace the numbers in the label matrix with the metric value corresponding to their volume. Then I can visualize the results using isosurface() or export the data to view it with other software, such as Paraview.

Answers (1)

Image Analyst
Image Analyst on 23 Mar 2015
Why do you need that - you already have the output of bwconncomp()? What are you going to do afterwards?
  2 Comments
Image Analyst
Image Analyst on 23 Mar 2015
Subsample your volume and work with a smaller one. It will probably be just as good. You can't visualize that size on a regular monitor anyway - you'd have to zoom way in.
Sean de Wolski
Sean de Wolski on 23 Mar 2015
I agree with IA:
You get an 8x reduction in memory consumption for every element you skip in each dimension:
Ismall = I(1:2:end,1:2:end,1:2:end);
~Someone else who worked with largish (1000x1000x1000) CT data

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!