|
30 | 30 | saveOn=1; |
31 | 31 |
|
32 | 32 |
|
33 | | -Select_layer='outer_skin_surface';%'outer_skin_surface';'outer_muscles_surface' |
| 33 | +Select_layer='outer_muscles_surface';%'outer_skin_surface';'outer_muscles_surface' |
34 | 34 | switch Select_layer |
35 | 35 | case 'outer_skin_surface' |
36 | 36 | %% Original |
|
87 | 87 | gpatch(F,V,'w','none',0.25); |
88 | 88 | gpatch(Fe,Ve,'rw','none',1); |
89 | 89 | plotV(V_slice_curve,'k-','LineWidth',4); |
90 | | - |
| 90 | + axis off; |
91 | 91 | axisGeom; |
92 | 92 | camlight headlight; |
93 | 93 | drawnow; |
|
113 | 113 | subplot(1,2,1); hold on; |
114 | 114 | gpatch(F,V,'w','none',0.25); |
115 | 115 | gpatch(Fn,Vn,'bw','none'); |
| 116 | + axis off; |
116 | 117 | axisGeom; |
117 | 118 | camlight headlight; |
118 | 119 |
|
119 | 120 | subplot(1,2,2); hold on; |
120 | 121 | gpatch(Fn,Vn,'bw','k',1,lineWidth); |
| 122 | + axis off; |
121 | 123 | axisGeom; |
122 | 124 | camlight headlight; |
123 | 125 | gdrawnow; |
|
207 | 209 | P(:,3)=P(:,3)-6; |
208 | 210 | [Ff,Vf,~,logicSide,Eb]=triSurfSlice(Fe,Ve,[],P,n,snapTolerance); |
209 | 211 | groupStruct.outputType='label'; |
210 | | - [G,~,groupSize]=tesgroup(Eb,groupStruct); |
211 | | - [~,indKeep]=max(groupSize); |
212 | | - indKeep=2; |
213 | | - logicKeep=G==indKeep; |
214 | | - Eb_keep=Eb(logicKeep,:); |
215 | | - indCurveNow=edgeListToCurve(Eb_keep); |
216 | | - VT=Vf(indCurveNow,:); |
217 | | - [V_slice_curve]=convexhull_curve(VT,numPoints); |
| 212 | + [G,~,groupSize]=tesgroup(Eb,groupStruct); |
| 213 | + for i=1:size(groupSize,2) |
| 214 | + logicKeep=G==i; |
| 215 | + Eb_keep=Eb(logicKeep,:); |
| 216 | + indCurveNow=edgeListToCurve(Eb_keep); |
| 217 | + VT=Vf(indCurveNow,:); |
| 218 | + [V_slice_curve]=convexhull_curve(VT,numPoints); |
| 219 | + Vcc{i}=V_slice_curve; |
| 220 | + end |
| 221 | +% |
| 222 | +% %first_min_value |
| 223 | +% for i=1:size(groupSize,2) |
| 224 | +% [val(i),idx(i)] = min([Vcc{i}(:,1)]); |
| 225 | +% end |
| 226 | +% [~,idx_a]=min(val(:)); |
| 227 | +% Vcc{idx_a} = NaN; |
| 228 | +% %second_min_value |
| 229 | +% for i=1:size(Vcc,2) |
| 230 | +% [val(i),idx(i)] = min([Vcc{i}(:,1)]); |
| 231 | +% end |
| 232 | +% [~,idx_a]=min(val(:)); |
| 233 | +% Vcc{idx_a} = NaN; |
| 234 | +% %third_min_value |
| 235 | +% for i=1:size(Vcc,2) |
| 236 | +% [val(i),idx(i)] = min([Vcc{i}(:,1)]); |
| 237 | +% end |
| 238 | +% [~,idx_a]=min(val(:)); |
| 239 | + idx_a=3; |
| 240 | + V_slice_curve=Vcc{idx_a}; |
218 | 241 | VC{q}=V_slice_curve; |
219 | 242 | FL=[]; |
220 | 243 | VL=V_slice_curve; |
221 | | - |
| 244 | + [~,indStart]=max(VL(:,1)); |
| 245 | + if indStart>1 |
| 246 | + VL=[VL(indStart:end,:); VL(1:indStart-1,:)]; |
| 247 | + end |
| 248 | + |
222 | 249 | [Fh,Vh]=regionTriMesh3D({VL},[],0,'linear'); |
223 | 250 | Fh=fliplr(Fh); |
224 | 251 |
|
225 | 252 |
|
226 | 253 | cFigure;hold on; |
227 | 254 | gpatch(Ff(logicSide,:),Vf,'w','none',1); |
228 | 255 | gpatch(Ff(~logicSide,:),Vf,'w','none',0.25); |
| 256 | + %gpatch(Fh,Vh,'w','k',0.25); |
229 | 257 | gpatch(Eb,Vf,'none','b',1,3); |
230 | | - plotV(VL,'r-','LineWidth',4); |
231 | | - axisGeom; axis manual; camlight headligth; |
| 258 | + plotV(VL,'k-','LineWidth',4); |
| 259 | + axisGeom; axis off;axis manual; camlight headligth; |
232 | 260 | set(gca,'FontSize',25); |
233 | 261 | gdrawnow; |
234 | 262 |
|
|
238 | 266 | groupStruct.outputType='label'; |
239 | 267 | [G,~,groupSize]=tesgroup(Eb,groupStruct); |
240 | 268 |
|
| 269 | + |
| 270 | + for q=1:1:max(size(groupSize)) |
| 271 | + logicKeep=G==q; |
| 272 | + Eb_keep=Eb(logicKeep,:); |
| 273 | + indCurveNow=edgeListToCurve(Eb_keep); |
| 274 | + VT=Vf(indCurveNow,:); |
| 275 | + [V_slice_curve]=convexhull_curve(VT,numPoints); |
| 276 | + Vcc{i}=V_slice_curve; |
| 277 | + end |
| 278 | + |
241 | 279 | VT={}; |
242 | 280 | for q=1:1:max(size(groupSize)) |
243 | 281 | logicKeep=G==q; |
|
272 | 310 |
|
273 | 311 |
|
274 | 312 | FL=[FL;f]; |
275 | | - VL=[VL;V_slice_curve]; |
| 313 | + VL=[VL;V_slice_curve;]; |
276 | 314 | VC{i}=V_slice_curve; |
277 | 315 |
|
278 | 316 | % cFigure;hold on; |
279 | 317 | % gpatch(Ff(logicSide,:),Vf,'w','none',1); |
280 | 318 | % gpatch(Ff(~logicSide,:),Vf,'w','none',0.25); |
281 | 319 | % gpatch(Eb,Vf,'none','b',1,3); |
282 | 320 | % plotV(VL,'r-','LineWidth',4); |
283 | | -% axisGeom; axis manual; camlight headligth; |
| 321 | +% axisGeom; axis off;axis manual; camlight headligth; |
284 | 322 | % set(gca,'FontSize',25); |
285 | 323 | % gdrawnow; |
286 | 324 | end |
|
290 | 328 | if dot(ne,[0 0 1])>0 |
291 | 329 | Fg=fliplr(Fg); |
292 | 330 | end |
293 | | - |
| 331 | + |
| 332 | + %VL0=VL; |
294 | 333 | [FL,VL]=subQuad(FL,VL,3,3); |
| 334 | + %[FL,VL]=subQuadCatmullClark(FL,VL,2,1); |
295 | 335 | [FL,VL]=quad2tri(FL,VL,'a'); |
296 | 336 | FL=fliplr(FL); |
297 | 337 |
|
298 | 338 | cFigure; |
299 | 339 | subplot(1,2,1); hold on; |
300 | | - gpatch(Fe,Ve,'rw','none',1); |
301 | | - axisGeom; |
| 340 | + %gpatch(Fe,Ve,'rw','none',1); |
| 341 | + gpatch(Ff(logicSide,:),Vf,'w','none',1); |
| 342 | + gpatch(Ff(~logicSide,:),Vf,'w','none',0.25); |
| 343 | + %gpatch(Eb,Vf,'none','b',1,3); |
| 344 | + plotV(VL,'k-','LineWidth',4); |
| 345 | + axisGeom;axis off; |
302 | 346 | camlight headligth; |
303 | 347 | set(gca,'FontSize',25); |
304 | 348 |
|
305 | 349 | subplot(1,2,2); hold on; |
306 | | - plotV(P0,'g.','MarkerSize',30); |
307 | | - plotV(PA,'g.','MarkerSize',30); |
| 350 | + %plotV(P0,'g.','MarkerSize',30); |
| 351 | + %plotV(PA,'g.','MarkerSize',30); |
308 | 352 | gpatch(Fg,Vg,'w','k',1); |
309 | 353 | %patchNormPlot(Fg,Vg); |
310 | 354 |
|
|
313 | 357 |
|
314 | 358 | gpatch(FL,VL,'bw','k',1); |
315 | 359 | %patchNormPlot(FL,VL); |
316 | | - |
317 | 360 | gpatch(Ff,Vf,'w','none',0.25); |
318 | | - |
319 | | - |
| 361 | + %plotV(VL0,'k-','LineWidth',4); |
320 | 362 | nn=size(VC); |
321 | 363 | for q=1:1:nn(1) |
322 | 364 | Vpp=VC{q}; |
323 | 365 | plotV(Vpp([1:size(Vpp,1) 1],:),'k-','LineWidth',4); |
324 | 366 | end |
325 | 367 |
|
326 | | - axisGeom; axis manual; camlight headligth; |
| 368 | + axisGeom; axis off;axis manual; camlight headligth; |
327 | 369 | set(gca,'FontSize',25); |
328 | 370 | gdrawnow; |
329 | | - |
| 371 | + |
330 | 372 | % Join and merge surfaces |
331 | 373 | [F_muscles,V_muscles,C_muscles]=joinElementSets({Fg,FL,Fh},{Vg,VL,Vh}); |
332 | 374 | [F_muscles,V_muscles]=mergeVertices(F_muscles,V_muscles); |
333 | 375 |
|
334 | 376 | cFigure; hold on; |
335 | | - title('Completed skin+fat surface'); |
| 377 | + %title('Completed skin+fat surface'); |
336 | 378 | gpatch(Ff,Vf,'w','none',0.5); |
337 | 379 | gpatch(F_muscles,V_muscles,C_muscles,'none',1); |
338 | 380 |
|
|
355 | 397 | [Fn,Vn]=ggremesh(F_muscles,V_muscles_smoothed,optionStructRemesh); |
356 | 398 |
|
357 | 399 | cFigure;hold on; |
358 | | - gpatch(Fn,Vn,'w','k',1); |
359 | | - axisGeom; axis manual; camlight headligth; |
| 400 | + gpatch(Fe,Ve,'w','none',1); |
| 401 | + gpatch(Fn,Vn,'r','k',1); |
| 402 | + axisGeom; axis off; axis manual; camlight headligth; |
360 | 403 | set(gca,'FontSize',25); |
361 | 404 | gdrawnow; |
362 | | - |
| 405 | + |
363 | 406 | %% Store model in structure |
364 | 407 | modelNew.source=fileName_FMA_refined; |
365 | 408 | modelNew.faces=Fn; |
|
0 commit comments