Hi again @imagejan, thank you very much!
Five minutes ago I did the same thing you suggested except for the last part.
%% Instantiate the TrackMate only to get the optimla values of the features.
trackmate = fiji.plugin.trackmate.TrackMate(model, settings);
% Part of trackmate.process(), that will be done later mus to be done now
% to get the optimal values.
%% Process necessary to get optimal values of the features
trackFeatureValues = model.getFeatureModel.getTrackFeatureValues();
featureValues = trackFeatureValues.get('NUMBER_SPOTS');
optimalNumberSpots = fiji.plugin.trackmate.util.TMUtils.otsuThreshold(featureValues);
featureValues = trackFeatureValues.get('NUMBER_GAPS');
optimalNumberGaps = fiji.plugin.trackmate.util.TMUtils.otsuThreshold(featureValues);
% Configure track filters
filter2 = fiji.plugin.trackmate.features.FeatureFilter('NUMBER_SPOTS', optimalNumberSpots, true);
filter3 = fiji.plugin.trackmate.features.FeatureFilter('NUMBER_GAPS', optimalNumberGaps, false);
Later I call
trackmate.process() to redo everything again.
Ok, this solve my problem but I have some doubts about this and other things I saw in the code:
1- Does TrackMate really calculate all features for all filters even though the used dont want it?
2- Is this the only way to solve my problem? I mean, having to calculate almost everything just to get two values?
3- If I do not set the
filter3 the trackmate will run normally, since I’m setting the automic values?
PS: I checked the third question. The result will be totally different without those filters.
Thank you @imagejan and all people in the forum…