2D Mask of a 3D image

6 views (last 30 days)
Andy
Andy on 17 Jan 2013
Hey there,
I'm rather new to using Matlab and my boss has asked me to analyze some SEM images of several membranes to compare the porosity and pore size of various membranes. The images I was given to analyze are 3D black and white images that I'd like to import into Matlab to further analyze. Ideally I'd like to be able to utilize the threshold of the image to identify the depth and thus the volume of the membrane being studied to further characterize the pores but that could be further down the road. My main question is what is the best way to create a 2D mask of the surface layer/cross-section of the image in Matlab? Also, I'd be more than happy to email a sample image if that will help clarify anything. Thanks again.
Sample Photo: https://dl.dropbox.com/u/95356349/3-009-HT-1%20T4.jpg

Accepted Answer

Image Analyst
Image Analyst on 17 Jan 2013
Like you said, use the threshold to identify regions of interest:
binaryImage = oneSlice > thresholdValue;
Then call do further processing or call regionprops().
  13 Comments
Image Analyst
Image Analyst on 20 Jan 2013
No, not quite - you still have imageArray in there. imageArray is the name of your variable - like the (poorly-named) I in your code. If you have a typical uint8 image, the value would go between 0 and 255. So the code would be:
grayImage = imread(filepath); % Load image
thresholdValue= 128; % Set threshold value to whatever you want
% Get map of where image is less than the threshold
binaryImage = grayImage < thresholdValue;
% Set pixels meeting threshold criteria to black (zeros).
grayImage (binaryImage) = 0; % Set to black
For the above, I inserted an extra step of creating a binary image to let you see where the image is above or below the threshold. You can imshow(binaryImage) if you want to see what pixels are affected.
Andy
Andy on 20 Jan 2013
Thank you very much.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!