tomdoel / pulmonarytoolkit

Lung medical image analysis and visualisation software for Matlab.
GNU General Public License v3.0
84 stars 57 forks source link

Error using "lung" tool #54

Open Gweiqi opened 2 years ago

Gweiqi commented 2 years ago

Dear Developers, When I use the "lung" tool, I encounter the following error, _Error in PTKWatershedFromStartingPoints(PTK1.0.1) : PTKWatershedMeyerFromStartingPoints has not been compiled. You must compile using mex PTKWatershedFromStartingPoints. Alternatively, use the slower Matlab equivalent function mex PTKWatershedFromStartingPointsMatlab(). Stack:PTKWatershedFromStartingPoints(12); SeparateLungs(186); PTKSeparateAndLabelLungs(30); PTKGetLeftAndRightLungs(16); PTKLeftAndRightLungsInitialiser.RunPlugin(55); MimContextHierarchy.GetResultRecursive(192); MimDatasetResults.GetResult(126); MimDatasetCallback.GetResult(87); PTKLeftAndRightLungs.RunPlugin(50); MimContextHierarchy.GetResultRecursive(192); MimDatasetResults.GetResult(126); MimDataset.GetResultWithCacheInfo(148); MimGuiDataset.RunPluginTryCatchBlock(683); MimGuiDataset.RunPlugin(449); MimGuiBase.RunPluginCallback(604); PTKSegmentLungs.RunGuiPlugin(33); MimGuiBase.RunGuiPluginCallback(581); MimGuiPluginWrapper.RunPlugin(21); @(varargin)tool_wrapper.RunPlugin(varargin{:})(255); MimPluginLabelButton.ButtonClickedCallback(48); @(varargin)obj.ButtonClickedCallback(varargin{:})(40); GemButton.ButtonClickedCallback(134); @(varargin)obj.ButtonClickedCallback(varargin{:})(109); \n_

I look forward to your help, thank you very much! Guo Weiqi

tomdoel commented 2 years ago

Hi,

You need to install a Matlab-compatible C++ compiler.

Some of PTK's functions are written as C++ mex files and they need to be compiled before use. PTK will normally do this automatically, but only if Matlab is able to find a compatible C++ compiler for your system.

This is covered in section 2 of the PTK installation instructions although please note the suggested compiler information was written several years ago so is not up to date. You should follow the recommended compiler installation instructions from Mathworks for your particular version of Matlab.

Mathworks provide a list of supported compilers for current and previous versions of Matab.

Once you have installed a compiler, you can verify that Matlab can find your C++ compiler, by running the following on the Matlab command window:

>> mex -setup

If Matlab can find your C++ compiler, you can instruct PTK to try recompiling the mex files:

>> ptk_main = PTKMain();
>> ptk_main.Recompile();