How to visualise results of regionprops3 function?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear all,
I am currently working with some CT data, which I have created by image stacking.
I would like to analyse properties using regionprops3 function. I would like to plot/visualise each found volume by this function so I can check, if the results are correct.
Here is my code:
% V_initial -- size 1000x1100x71
Volsize = size(V_initial);
for i=1:Volsize(3) % could be speed up by using parfor, but the volume is small
XY_vol{i} = V_initial(:,:,i); % slicing volume into each plane
XY_vol_adjst{i} = imadjust(XY_vol{i}); % adjusting contrast
threshold_multi(i,:) = multithresh(XY_vol_adjst{i},3); % Otsu multhreshold method to identify phases
XY_vol_bin_pores{i} = imbinarize(XY_vol_adjst{i},threshold_multi(i,1)); %pores
XY_vol_bin_solid{i} = imbinarize(XY_vol_adjst{i},threshold_multi(i,2)); %paste
XY_vol_bin_agg{i} = imbinarize(XY_vol_adjst{i},threshold_multi(i,3)); %aggregates
volstack_pores(:,:,i) = XY_vol_bin_pores{i}; %stacking volume of pores
volstack_solid(:,:,i) = XY_vol_bin_solid{i}; %stacking volume of paste
volstack_agg(:,:,i) = XY_vol_bin_agg{i}; %stacking volume of aggregates
vol_solid_flipped_BW{i} = imcomplement(XY_vol_bin_solid{i}); %inversion of binarized paste
volstack_solid_1(:,:,i) = vol_solid_flipped_BW{i}; %stacking volume of inverted paste
end
%region analysis
stats = regionprops3(volstack_solid,'all'); %takes some time
voxelID = cat(1,stats.VoxelIdxList);
%selecting the first and the biggest volume identified by regionprops3
volume = volstack_solid(voxelID{1}); %using volume indices should allow to new volume out
% of volstack_solid this time only using identified volume
volshow(volume) %visualise volume
%Error using volshowvolumeViewer requires 3-D data with no singleton dimensions.
I am stuck using identified indices. Maybe I am doing something wrong using identified indices.
Could you help me to fix this problem, please ?
Thank you in advance,
Petr
1 Commento
Alvaro
il 24 Gen 2023
From the documentation of volshow, this function takes a 3D array.
What are the dimensions of your variable volume?
Risposte (1)
Constantino Carlos Reyes-Aldasoro
il 25 Gen 2023
What regionprops will do is to calculate the metrics for each of the elements in your data, and you can then use these to select a subset of the elements to visualise, for example:
a=randn(256); % random values
b=bwlabel(a>1.5); % threshold to select a few of these, label to have unique ids
c=regionprops(b); % find properties, for this example we will use the area, you can open with openvar('c')
d=ismember(b,find([c.Area]==2)); % select only those elements with area 2
imagesc((b>0)+d) % display original elements + those selected
elements with area ==2 appear in yellow, all others appear in light blue.
Hope this helps answer your question.
0 Commenti
Vedere anche
Categorie
Scopri di più su 3-D Volumetric Image Processing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!