How can I change the size of mesh element?

7 views (last 30 days)
Veronika
Veronika on 15 Jan 2017
Answered: Walter Roberson on 15 Jan 2017
Dear all,
I have this code:
% hranice okolí
shape = [];
tmp = bwboundaries(binaryImage_okoli);
shape.thorax = tmp{1};
tmp = bwboundaries(leftLung);
tmp = bwboundaries(rightLung);
shape.leftLung = tmp{1};
shape.rightLung = tmp{1};
size(grayImage)
% interpolace hraničních bodů, fourier
Npts1 = 60; % počet bodů interpolovaných hranic
Npts2 = 45; % počet bodů interpolovaných hranic
Ncomps = 30; % počet fourierových komponentů
shape.thorax = fourier_fit(fourier_fit(shape.thorax, Ncomps), linspace(0, 1, Npts1));
shape.leftLung = fourier_fit(fourier_fit(shape.leftLung, Ncomps), linspace(0, 1, Npts2));
shape.rightlung = fourier_fit(fourier_fit(shape.rightLung, Ncomps), linspace(0, 1, Npts2));
% visualize resulting boundaries
figure();
imshow(grayImage);
hold on
plot(shape.thorax(:,2), shape.thorax(:,1), 'o-b')
plot(shape.leftLung(:,2), shape.leftLung(:,1), 'o-g')
plot(shape.rightLung(:,2), shape.rightLung(:,1), 'o-r')
legend('thorax', 'left lung', 'right lung');
%%FEM model hrudníku
thorax_shape = { 1, % výška
{(shape.thorax(1:end-1,:) - 256)/256,
(shape.leftLung(1:end-1,:) - 256)/256
(shape.rightlung(1:end-1,:) - 256)/256}, % kontury
1, % použití defaultních vrcholů
*2}; % maxh (zjemnění )*
elec_pos = [ 16, % počet elektrod
1, % vzdálenost mezi elektrodami
0.5]'; % v z rovině
elec_shape = [0.05, % poloměr
0, % kulaté elektrody
0.05 ]'; % maxh (zjemnění)
fmdl = ng_mk_extruded_model(thorax_shape, elec_pos, elec_shape);
img=mk_image(fmdl,1);
img.elem_data(fmdl.mat_idx{2})= 0.3; % rlung
img.elem_data(fmdl.mat_idx{3})= 0.5; % llung
figure();
show_fem(img);
I would like to change the size of mesh elements, because Matlab is too long busy. I think I should modify this line
(2}; % maxh (zjemnění )), but I do not know to what value.
Thank you for your answers.

Answers (1)

Walter Roberson
Walter Roberson on 15 Jan 2017
I do not happen to read the language the comments are in (and it is not convenient for me to run them through a translator at the moment) but it looks to me as if you should reduce Npts1 and Npts2

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!