pulmonarytoolkit icon indicating copy to clipboard operation
pulmonarytoolkit copied to clipboard

Error using "lung" tool

Open Gweiqi opened this issue 3 years ago • 1 comments

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

Gweiqi avatar Jan 12 '22 13:01 Gweiqi

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();

tomdoel avatar Jan 17 '22 11:01 tomdoel