InverseTampere / TreeQSM

Quantitative Structure Models of Single Trees from Laser Scanner Data
Other
148 stars 46 forks source link

Issue with select_optimum.m #6

Closed zoeschindler closed 1 year ago

zoeschindler commented 2 years ago

Hello everyone,

when trying to use select_optimum() I ran into some problems and wanted to ask for advice. I tried the following:

myTree = 'C:\Daten\Arbeit\Test_TreeQSM\tree';
TreeQSMs = make_models_parallel(myTree, 'parallel', 5, inputs);
[qsm_TreeData,qsm_OptModels,qsm_OptInputs] = select_optimum(TreeQSMs);

However, I got errors:

Undefined function 'dist' for input arguments of type 'double'.
Error in select_optimum (line 304)
    [~,T] = min(dist(ind,best));
Error in Example_Script_QSMreconstruction_ (line 143)
[qsm_TreeData,qsm_OptModels,qsm_OptInputs] = select_optimum(TreeQSMs);

When looking into the code of the select_optimum() function, I saw that in lines 304 + 316 + 326, a variable called dist is called without ever being created. Is it maybe supposed to be Data.CylDist? (Using distM or OptDist did not work, but replacing it with Data.CylDist actually did work.)

zoeschindler commented 2 years ago

For anyone else having the same issue: I contacted the author of the package. The solution is to replace all three occurrences of [~,T] = min(dist(ind,best)); with [~,T] = min(Data.CylDist(ind,best));. Apparently, this bug did not impact the selection of the optimal input parameters, but only the choice of the single best QSM.