1.首先通過這個瞭解如何通過控制檯命令行調用V3D程序
https://blog.csdn.net/jujiyu6446/article/details/92843403?tdsourcetag=s_pctim_aiomsg
2.嘗試通過matlab調用控制檯程序從而達到調用V3D的目的。
需要自己做的事情是在matlab中通過 -i -o -p 等輸入信息
%V3D的路徑 需要自己修改
V3DPath='"D:\v3d_external\bin\vaa3d_msvc.exe" ';
pluginName='"D:\v3d_external\bin\plugins\SwcProcess\SwcProcess.dll"';
funcName='"Optimal"';
%判斷輸入文件是否存在
if ~exist(imgName,'file')
disp([imgName ' file not exist'])
return
end
%判讀是否輸入參數 給定參數默認值
if ~exist('weight_tip', 'var') || isempty(weight_tip)
% opt_normalize 參數爲空,或者不以變量的形式存在;
weight_tip= 1;
end
%判斷是否輸入錯誤的參數
if final_threthold<=0
disp(['error final_threthold :' num2str(final_threthold)])
return
end
%給定根據輸入參數不同而不用的輸出參數名
if ~exist('outPutSwcName', 'var') || isempty(outPutSwcName)
outPutSwcName=[inputSwc '_w_tip_' num2str(weight_tip) end_out_swcName];
if exist(outPutSwcName, 'file')
disp([outPutSwcName ' already exist']);
return;
end
end
%這個是核心
%數字的參數必須先num2str
cmd=[V3DPath ' /x ' pluginName ' /f ' funcName ' /i "' imgName '" /p "' inputSwc '" '" /o "' outPutSwcName '"' ];
if isNoshow
NoshowFileName=[num2str( randi(20)) '_noshow.txt'];
cmd=[cmd ' > ' NoshowFileName];
end
dos(cmd);
disp(cmd)
if isNoshow
if exist(NoshowFileName, 'file')
delete(NoshowFileName)
end
end