How to give thickness to 2D images and stack them to obtain a 3D bulk (cube)?

4 views (last 30 days)
Hi,
I need to extrude 2D images to a thickness of 0.5 microns and stack them one on top of other to obtain a bulk of 100 microns in height. I am attching the images which can be used in the loop to stack repeatedly. Can someone please suggest the code to use to stack the images?
Please let me know if any further information is required.
Thank you!

Answers (1)

Jaswanth
Jaswanth on 8 May 2024
Hi Riddhiben,
To stack 2D images into a 3D structure with a final thickness of 100 microns, using a layer thickness of 0.5 microns, you will need to iterate through the given images repeatedly until you accumulate 200 layers.
Please refer to the following steps that can help you in accomplishing the task:
  • Start by listing your image filenames in an array. Given that each layer is 0.5 microns thick, you will require 200 layers to reach a height of 100 microns. Load the images into MATLAB.
  • Initialize a 3D matrix to hold your stacked images, sized according to the dimensions of your first image and the total number of layers required. Please refer to the code snippet provided below.
% Initialize 3D stack array
[rows, cols] = size(images{1});
stack3D = zeros(rows, cols, numLayers, 'uint8');
  • Use a loop to cycle through your images, assigning each to the appropriate layer in your 3D matrix. This process repeats the set of images until the stack reaches the desired thickness. Please refer to the code snippet provided below.
% Stack images
for layer = 1:numLayers
stack3D(:, :, layer) = images{mod(layer-1, numel(images)) + 1};
end
  • Further, you can then view any layer of the stack using imshow or save the entire stack for future analysis.
Please go through the following MathWorks documentations to learn more about imshow function mentioned above: https://www.mathworks.com/help/matlab/ref/imshow.html?searchHighlight=imshow&s_tid=srchtitle_support_results_1_imshow
I hope the information provided above is helpful.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!