Commit b3d83bf0 authored by Mark van Turnhout's avatar Mark van Turnhout
Browse files

script to clean basillab output (except for segmentations)

parent a7f2f9c4
function bas_abaMeshHead(fname, basil)
fid = fopen(fname,'w+');
fprintf(fid,'"""=============================\n');
fprintf(fid,'Script to make a mesh of rat leg with tibia\n');
fprintf(fid,'============================="""\n\n');
fprintf(fid,'from abaqus import *\n');
fprintf(fid,'from abaqusConstants import *\n\n');
fprintf(fid,'import part\n\n');
fprintf(fid,'from math import *\n\n');
fprintf(fid,'# Create a model\n');
fprintf(fid,'Mdb()\n');
fprintf(fid,'myModel = mdb.Model(name=''Basil%i\'')\n',basil);
fprintf(fid,'myPart = myModel.Part(name=''leg'', dimensionality=THREE_D, type=DEFORMABLE_BODY)\n');
fprintf(fid,'del mdb.models[''Model-1'']\n\n');
fprintf(fid,'# import contours\n');
fprintf(fid,'execfile(''mesh_contours.py'')\n\n');
fprintf(fid,'# get edges\n');
fprintf(fid,'e = myPart.edges\n\n');
fclose(fid);
end
\ No newline at end of file
function deleted = bas_cleanModel(basil, basilhome)
% deleted = bas_cleanModel(basil, basilhome)
%
% Deletes the following files (if they exist):
% <basilhome>/<basil>/contour_skin_preload-ncc.mat
% <basilhome>/<basil>/contour_skin_loading-ncc.mat
% <basilhome>/<basil>/contour_bone_preload-ncc.mat
% <basilhome>/<basil>/contour_bone_loading-ncc.mat
% <basilhome>/<basil>/contour_bone_postload-ncc.mat
% <basilhome>/<basil>/Bone_preload_loading.txt
% <basilhome>/<basil>/Bone_preload_postload.txt
% <basilhome>/<basil>/Indenter_tipNR.txt
% <basilhome>/<basil>/Indenter_Lc.mat
% <basilhome>/<basil>/Indenter_StartEnd.txt
%
% A 'clean' model build can then be prepared with
% bas_prepFEM(basil, basilhome)
%
% If basilhome is empty, data will be sought in the root-folder defined by
% bas_getDataRoot
%
% See also, bas_getDataRoot, bas_prepFEm, bas_buildFEM, bas_rebuildFEM
if nargin == 1, basilhome = bas_getDataRoot; end
toCheck = {'contour_skin_preload-ncc.mat';
'contour_skin_loading-ncc.mat';
'contour_bone_preload-ncc.mat';
'contour_bone_loading-ncc.mat';
'contour_bone_postload-ncc.mat';
'Bone_preload_loading.txt';
'Bone_preload_postload.txt';
'Indenter_tipNR.txt';
'Indenter_Lc.mat';
'Indenter_StartEnd.txt'};
deleted = {}; d = 1;
for b = 1:numel(basil)
for f = 1:size(toCheck,1)
if exist(fullfile(basilhome,num2str(basil(b)),toCheck{f}),'file')
delete(fullfile(basilhome,num2str(basil(b)),toCheck{f}));
deleted{d,1} = fullfile(basilhome,num2str(basil(b)),toCheck{f}); %#ok<AGROW>
d = d + 1;
end
end
end
end
\ No newline at end of file
......@@ -64,7 +64,7 @@ for b = 1:numel(basil)
~exist(fullfile(basilhome, num2str(basil(b)),'MRI_BG_loading.mat'),'file') || ...
~exist(fullfile(basilhome, num2str(basil(b)),'MRI_BG_postload.mat'),'file') ...
|| overwrite == 1
bas_maskBG(basil(b),[1:3],basilhome);
bas_maskBG(basil(b),1:3,basilhome);
end
if ~exist(fullfile(basilhome, num2str(basil(b)),'contour_skin_preload.mat'),'file') ...
......@@ -112,7 +112,7 @@ for b = 1:numel(basil)
if ~exist(fullfile(basilhome, num2str(basil(b)),'Bone_preload_loading.txt'),'file') ...
|| ~exist(fullfile(basilhome, num2str(basil(b)),'Bone_preload_postload.txt'),'file') ...
|| overwrite == 1
[bonePreDuring, bonePrePost] = bas_mapBone(basil(b), basilhome) %#ok<NOPRT,NASGU>
[bonePreDuring, bonePrePost] = bas_mapBone(basil(b), basilhome) %#ok<ASGLU,NOPRT,NASGU>
end
fprintf('bone movements mapped, proceeding\n');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment