LOADING TIFF FILES AND GENERATING A 3D PLOT SHOWING THE PORES

21 views (last 30 days)
How can i generate a 3D plot of a tiff file for a rcok sample (that will be converted to an array) shoing just the pores in the rock
In essence what i woiuld like to do is to
Read my stack of tiff files into an array
Get porosity values
Genearte arrays of porosity
Visualize the rock pores

Answers (1)

Shubh Pareek
Shubh Pareek on 16 Jun 2023
To generate a 3D plot in MATLAB of a tiff file representing a rock sample with just the pores showing, you can follow these general steps:
  1. To read the stack of tiff files into an array use the function "imread" to read the stack of tiff files into a 3D array in MATLAB.
image_stack = imread('sample.tiff');% use whatever is the name of your file,it should be in same directory
2. To determine the porosity values for defining the proportion of pores in the rock sample. It can be calculated by thresholding the image stack with a suitable threshold value to extract the regions corresponding to pores.
level = graythresh(image_stack);
bw_stack = imbinarize(image_stack, level);
voxel_volume = 0.03.*0.03.*0.03; % voxel volume in cubic millimeters
porosity_stack = sum(bw_stack(:)==1) ./ size(bw_stack(:),1) ./ voxel_volume;
3.To Create a 3D visualization of the rock pores , use the isosurface function to extract the pores from the thresholded image stack and create a polygonal surface for each pore. The resulting surface can be plotted using "patch" function.
pore_surface = isosurface(bw_stack,0.5);
figure;
patch(pore_surface,'FaceColor', 'blue', 'EdgeColor', 'none');
view(3);
axis tight;
daspect([1 1 1]);
light('Position',[0 0 1],'Style','infinite');
light('Position',[0 0 -1],'Style','infinite');
lighting gouraud
In this example, I used a voxel size of 0.03 mm and a threshold of the grayscale threshold that determined by the Otsu's method for binarization of the image. You may need to adjust these parameters based on the specific application.
I hope this helps with your query .
Resources for the commands used -
  2 Comments
Enoch
Enoch on 16 Jun 2023
I followed your approach but i noticed
Error using isosurface
V must be a 3D array.
Error in Cores (line 6)
pore_surface = isosurface(bw_stack,0.5);
Enoch
Enoch on 16 Jun 2023
To Replicate along the third dimension
bw_stack = repmat(bw_image, [1 1 10]);
I added this code...
This is my result (attached)
I think now i would like to isolate just the pores and visualize that

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!