Skip to content

Commit 3bcace3

Browse files
authored
Add files via upload
1 parent 084dfe1 commit 3bcace3

1 file changed

Lines changed: 52 additions & 72 deletions

File tree

mcode/processAmputation_vs1.m

Lines changed: 52 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
loadFolder=fullfile(projectFolder,'data','BodyParts3D','post');
1616
saveFolder_stl=fullfile(projectFolder,'data','BodyParts3D','post_stl');
1717
saveFolder=loadFolder;
18-
saveNameGeom='BodyParts3D_right_leg_transtibial_amp';
19-
select_amputation_case='tt';%'tt';'tf' % where the trans-tibial(tt); trans-femoral (tf)
18+
saveNameGeom_tt='BodyParts3D_right_leg_transtibial_amp';
19+
saveNameGeom_tf='BodyParts3D_right_leg_transfemoral_amp';
20+
select_amputation_case='tf';%'tt';'tf' % where the trans-tibial(tt); trans-femoral (tf)
2021

2122
switch select_amputation_case
2223
case 'tf'
@@ -25,7 +26,7 @@
2526
fileNames={'right_femur','right_tibia','right_fibula','right_patella','right_leg_skin','right_leg_muscles'};
2627
end
2728

28-
saveOn=0;
29+
saveOn=1;
2930

3031
%The percentage for trans-femoral (above knee) amputation
3132
amputationPercentageFemur=25;
@@ -73,12 +74,11 @@
7374
% Visualize surface and landmarks
7475
cFigure; hold on;
7576
gpatch(FT,VT,CT,'none',0.5);
76-
axisGeom; camlight headlight;
77+
axisGeom; axis off;camlight headlight;
7778
colormap gjet; icolorbar;
7879
gdrawnow;
7980

80-
81-
%% Compute landmarks for tt amputation
81+
%% Compute landmarks for tf amputation
8282
switch select_amputation_case
8383
case 'tf'
8484
%% Compute the femur length for tf amputation
@@ -91,10 +91,10 @@
9191
%%
9292
% Visualize surface and landmarks
9393
cFigure; hold on;
94-
gpatch(FT,VT,CT,'none',0.5);
95-
plotV(V_bone_femur(I_min_femur,:),'k.','MarkerSize',35);
96-
axisGeom; camlight headlight;
97-
colormap gjet; icolorbar;
94+
gpatch(FT,VT,CT,'none',0.25);
95+
plotV(V_bone_femur(I_min_femur,:),'k.','MarkerSize',50);
96+
axisGeom; axis off; camlight headlight;
97+
colormap gjet; %icolorbar;
9898
gdrawnow;
9999

100100
case 'tt'
@@ -103,10 +103,10 @@
103103
%%
104104
% Visualize surface and landmarks
105105
cFigure; hold on;
106-
gpatch(FT,VT,CT,'none',0.5);
107-
plotV(P_patella_centroid,'k.','MarkerSize',35);
108-
axisGeom; camlight headlight;
109-
colormap gjet; icolorbar;
106+
gpatch(FT,VT,CT,'none',0.25);
107+
plotV(P_patella_centroid,'k.','MarkerSize',50);
108+
axisGeom; axis off;camlight headlight;
109+
colormap gjet; %icolorbar;
110110
gdrawnow;
111111
end
112112

@@ -146,11 +146,11 @@
146146
% Visualization
147147

148148
cFigure; hold on;
149-
title('Cut features');
149+
%title('Cut features');
150150
% gpatch(FT,VT,'w','none',0.1);
151151
gpatch(FT_amp,VT_amp,CT_amp,'none',0.5);
152-
axisGeom; camlight headlight;
153-
colormap gjet; icolorbar;
152+
axisGeom; axis off; camlight headlight;
153+
colormap gjet; %icolorbar;
154154
gdrawnow;
155155

156156
%% Set up skin taper parameterisation
@@ -236,7 +236,7 @@
236236
cFigure; hold on;
237237
title('Distal end closure');
238238
gpatch(FT_amp,VT_amp,'w','none',1);
239-
gpatch(Fs,Vs,'w','none',0.25);
239+
%gpatch(Fs,Vs,'w','none',0.25);
240240
hp=gpatch(Fsb,Vsb,Vsb(:,3),'none',1); hp.FaceColor='interp';
241241
% gpatch(Ebs,Vs,'none','b',1,3);
242242

@@ -251,7 +251,7 @@
251251

252252
plotV(P_end,'k.','MarkerSize',25);
253253

254-
axisGeom; camlight headlight;
254+
axisGeom; axis off; camlight headlight;
255255
gdrawnow;
256256

257257

@@ -282,12 +282,12 @@
282282
subplot(1,2,1); hold on;
283283
% gpatch(FT,VT,'w','none',0.25);
284284
gpatch(FT_amp,VT_amp,CT_amp,'none',0.5);
285-
axisGeom; camlight headlight;
286-
colormap gjet; icolorbar;
285+
axisGeom; axis off; camlight headlight;
286+
colormap gjet; %icolorbar;
287287

288288
subplot(1,2,2); hold on;
289289
gpatch(FT_amp,VT_amp,'w','k',1);
290-
axisGeom; camlight headlight;
290+
axisGeom; axis off; camlight headlight;
291291
gdrawnow;
292292

293293

@@ -385,12 +385,12 @@
385385
subplot(1,2,1); hold on;
386386
% gpatch(FT,VT,'w','none',0.25);
387387
gpatch(FT_amp,VT_amp,CT_amp,'none',0.5);
388-
axisGeom; camlight headlight;
389-
colormap gjet; icolorbar;
388+
axisGeom; axis off; camlight headlight;
389+
colormap gjet; %icolorbar;
390390

391391
subplot(1,2,2); hold on;
392392
gpatch(FT_amp,VT_amp,'w','k',0.5);
393-
axisGeom; camlight headlight;
393+
axisGeom; axis off; camlight headlight;
394394
gdrawnow;
395395

396396
%% Process femur taper
@@ -462,8 +462,8 @@
462462
subplot(1,2,1); hold on;
463463
% gpatch(FT,VT,'w','none',0.25);
464464
gpatch(FT_amp,VT_amp,CT_amp,'none',0.5);
465-
axisGeom; camlight headlight;
466-
colormap gjet; icolorbar;
465+
axisGeom; axis off; camlight headlight;
466+
colormap gjet; %icolorbar;
467467

468468
subplot(1,2,2); hold on;
469469
gpatch(FT_amp,VT_amp,'w','none',0.5);
@@ -475,8 +475,8 @@
475475
hold on;
476476
% gpatch(FT,VT,'w','none',0.25);
477477
gpatch(FT_amp,VT_amp,CT_amp,'none',0.5);
478-
axisGeom; camlight headlight;
479-
colormap gjet; icolorbar;
478+
axisGeom; axis off; camlight headlight;
479+
colormap gjet; %icolorbar;
480480
gdrawnow;
481481

482482
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -715,9 +715,9 @@
715715
%%
716716
cFigure; hold on;
717717
gpatch(FT_amp,VT_amp,CT_amp,'none',0.5);
718-
patchNormPlot(FT_amp{1},VT_amp{1});
719-
axisGeom; camlight headlight;
720-
colormap gjet; icolorbar;
718+
%patchNormPlot(FT_amp{1},VT_amp{1});
719+
axisGeom; axis off; camlight headlight;
720+
colormap gjet; %icolorbar;
721721
gdrawnow;
722722

723723
case 'tf'
@@ -875,57 +875,37 @@
875875
cFigure; hold on;
876876
gpatch(FT_amp,VT_amp,CT_amp,'none',0.5);
877877
patchNormPlot(FT_amp,VT_amp);
878-
axisGeom; camlight headlight;
879-
colormap gjet; icolorbar;
878+
axisGeom; axis off; camlight headlight;
879+
colormap gjet; %icolorbar;
880880
gdrawnow;
881881

882882
% stlwrite(triangulation(VT_amp{1},FT_amp{1}),fullfile(saveFolder_stl,'femur_tf.stl'),'binary');
883883
% stlwrite(triangulation(VT_amp{2},FT_amp{2}),fullfile(saveFolder_stl,'skin_tf.stl'),'binary');
884884
% stlwrite(triangulation(VT_amp{3},FT_amp{3}),fullfile(saveFolder_stl,'muscle_tf.stl'),'binary');
885885
% stlwrite(triangulation(VT_amp{4},FT_amp{4}),fullfile(saveFolder_stl,'muscle_lid_tf.stl'),'binary');
886886
% stlwrite(triangulation(VT_amp{5},FT_amp{5}),fullfile(saveFolder_stl,'skin_lid_tf.stl'),'binary');
887-
stlStruct.solidNames={'Femur'};
888-
stlStruct.solidVertices={VT_amp{1}};
889-
stlStruct.solidFaces={FT_amp{1}};
890-
stlStruct.solidNormals={[]};
891-
fileName=fullfile(saveFolder_stl,'femur_tf.stl');
892-
export_STL_txt(fileName,stlStruct);
893-
894-
stlStruct.solidNames={'Skin'};
895-
stlStruct.solidVertices={VT_amp{2}};
896-
stlStruct.solidFaces={FT_amp{2}};
897-
stlStruct.solidNormals={[]};
898-
fileName=fullfile(saveFolder_stl,'skin_tf.stl');
899-
export_STL_txt(fileName,stlStruct);
900-
901-
stlStruct.solidNames={'Muscle'};
902-
stlStruct.solidVertices={VT_amp{3}};
903-
stlStruct.solidFaces={FT_amp{3}};
904-
stlStruct.solidNormals={[]};
905-
fileName=fullfile(saveFolder_stl,'muscle_tf.stl');
906-
export_STL_txt(fileName,stlStruct);
907-
908-
stlStruct.solidNames={'Muscle_lid'};
909-
stlStruct.solidVertices={VT_amp{4}};
910-
stlStruct.solidFaces={FT_amp{4}};
911-
stlStruct.solidNormals={[]};
912-
fileName=fullfile(saveFolder_stl,'muscle_lid_tf.stl');
913-
export_STL_txt(fileName,stlStruct);
914-
915-
stlStruct.solidNames={'Skin_lid'};
916-
stlStruct.solidVertices={VT_amp{5}};
917-
stlStruct.solidFaces={FT_amp{5}};
918-
stlStruct.solidNormals={[]};
919-
fileName=fullfile(saveFolder_stl,'skin_lid_tf.stl');
920-
export_STL_txt(fileName,stlStruct);
921-
922-
887+
%
888+
% %% Remesh
889+
% optionStructRemesh.pointSpacing=2; %Set desired point spacing
890+
% [FT_amp{1},VT_amp{1}]=ggremesh(FT_amp{1},VT_amp{1},optionStructRemesh);
891+
% [FT_amp{2},VT_amp{2}]=ggremesh(FT_amp{2},VT_amp{2},optionStructRemesh);
892+
% [FT_amp{3},VT_amp{3}]=ggremesh(FT_amp{3},VT_amp{3},optionStructRemesh);
893+
% [FT_amp{4},VT_amp{4}]=ggremesh(FT_amp{4},VT_amp{4},optionStructRemesh);
894+
% [FT_amp{5},VT_amp{5}]=ggremesh(FT_amp{5},VT_amp{5},optionStructRemesh);
895+
923896
end
924897

925898
%% Save model
926899
if saveOn==1
927-
saveName_mat=fullfile(saveFolder,[saveNameGeom,'.mat']);
928-
save(saveName_mat,'FT_amp','VT_amp','CT_amp');
900+
switch select_amputation_case
901+
case 'tt'
902+
saveName_mat=fullfile(saveFolder,[saveNameGeom_tt,'.mat']);
903+
save(saveName_mat,'FT_amp','VT_amp','CT_amp');
904+
case 'tf'
905+
906+
saveName_mat=fullfile(saveFolder,[saveNameGeom_tf,'.mat']);
907+
save(saveName_mat,'FT_amp','VT_amp','CT_amp');
908+
end
929909
end
930910

931911
%%

0 commit comments

Comments
 (0)