Skip to content

Commit da47cdc

Browse files
committed
Do not privilege the TARGET_CHANNEL setting
Before this commit, the target channel was set in the main window of the GUI, and used for all detectors and trackers. But some detectors do not need it, or specify it another way. It makes no sense to separate it from the other parameters. It adds clutter and confusion. Now the modules that require the TARGET_CHANNEL must specify it as a parameter, that can be sweeped upon as well.
1 parent fd9f1fe commit da47cdc

23 files changed

Lines changed: 146 additions & 149 deletions

src/main/java/fiji/plugin/trackmate/helper/HelperRunner.java

Lines changed: 29 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
* it under the terms of the GNU General Public License as
99
* published by the Free Software Foundation, either version 3 of the
1010
* License, or (at your option) any later version.
11-
*
11+
*
1212
* This program is distributed in the hope that it will be useful,
1313
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1414
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1515
* GNU General Public License for more details.
16-
*
16+
*
1717
* You should have received a copy of the GNU General Public
1818
* License along with this program. If not, see
1919
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -74,8 +74,6 @@ public class HelperRunner implements Runnable, Cancelable
7474

7575
private final ParameterSweepModel model;
7676

77-
private int targetChannel;
78-
7977
private final String savePath;
8078

8179
private Logger batchLogger;
@@ -98,7 +96,6 @@ private HelperRunner(
9896
final ImagePlus imp,
9997
final ParameterSweepModel model,
10098
final String modelPath,
101-
final int targetChannel,
10299
final String savePath,
103100
final Logger batchLogger,
104101
final Logger trackmateLogger,
@@ -109,7 +106,6 @@ private HelperRunner(
109106
this.imp = imp;
110107
this.model = model;
111108
this.modelPath = modelPath;
112-
this.targetChannel = targetChannel;
113109
this.savePath = savePath;
114110
this.batchLogger = batchLogger;
115111
this.trackmateLogger = trackmateLogger;
@@ -133,7 +129,7 @@ private HelperRunner(
133129
/**
134130
* Exposes the crawler of this runner that monitors result files appearing
135131
* in the save folder.
136-
*
132+
*
137133
* @return the {@link ResultsCrawler}.
138134
*/
139135
public ResultsCrawler getCrawler()
@@ -143,7 +139,7 @@ public ResultsCrawler getCrawler()
143139

144140
/**
145141
* Exposes the settings model that will be used by this runner.
146-
*
142+
*
147143
* @return the {@link ParameterSweepModel}.
148144
*/
149145
public ParameterSweepModel getModel()
@@ -155,7 +151,7 @@ public ParameterSweepModel getModel()
155151
* Returns the path to the file that stores the settings model that will be
156152
* used by this runner. This path is used to save the model to a file when
157153
* modified.
158-
*
154+
*
159155
* @return the path to the settings model.
160156
*/
161157
public String getModelPath()
@@ -165,7 +161,7 @@ public String getModelPath()
165161

166162
/**
167163
* Exposes the input image this runner is configured to run on.
168-
*
164+
*
169165
* @return the image.
170166
*/
171167
public ImagePlus getImage()
@@ -176,7 +172,7 @@ public ImagePlus getImage()
176172
/**
177173
* Returns the path to the ground-truth file or folder this runner is
178174
* configured to use.
179-
*
175+
*
180176
* @return the path to the ground-truth.
181177
*/
182178
public String getGroundTruthPath()
@@ -186,7 +182,7 @@ public String getGroundTruthPath()
186182

187183
/**
188184
* Returns the type of tracking metrics this runner is configured to use.
189-
*
185+
*
190186
* @return the tracking metrics type.
191187
*/
192188
public TrackingMetricsType getType()
@@ -196,7 +192,7 @@ public TrackingMetricsType getType()
196192

197193
/**
198194
* Sets the logger to use to log progress of the run.
199-
*
195+
*
200196
* @param batchLogger
201197
* a {@link Logger} instance.
202198
*/
@@ -208,7 +204,7 @@ public void setBatchLogger( final Logger batchLogger )
208204
/**
209205
* Sets the logger to use to log individual tracking tests. This is only
210206
* useful for debugging.
211-
*
207+
*
212208
* @param trackmateLogger
213209
* a {@link Logger} instance.
214210
*/
@@ -217,24 +213,11 @@ public void setTrackmateLogger( final Logger trackmateLogger )
217213
this.trackmateLogger = trackmateLogger;
218214
}
219215

220-
/**
221-
* Sets the index of the channel in the input image to use for tracking.
222-
* Channels are here 1-numbered, meaning that "1" is the first available
223-
* channel.
224-
*
225-
* @param targetChannel
226-
* the channel index
227-
*/
228-
public void setTargetChannel( final int targetChannel )
229-
{
230-
this.targetChannel = targetChannel;
231-
}
232-
233216
/**
234217
* Sets whether TrackMate results XML files will be saved for every test.
235218
* <p>
236219
* This can consume a lot off disk space if there are many tests to run.
237-
*
220+
*
238221
* @param saveTrackMateFiles
239222
* whether TrackMate XML files will be saved for every test.
240223
*/
@@ -265,7 +248,7 @@ public void run()
265248
/**
266249
* Iterates over possible several detector configurations, and adds them to
267250
* the specified base settings, then loop over spot filter configurations.
268-
*
251+
*
269252
* @param base
270253
* the {@link Settings} base. Must be fully configured except for
271254
* detector settings, spot filters, tracker settings and track
@@ -284,7 +267,7 @@ private int loopDetectorSettings( final Settings base, final IterationData itera
284267
{
285268
MAIN_LOOP: for ( final DetectorSweepModel detectorModel : model.getActiveDetectors() )
286269
{
287-
final Iterator< Settings > detectorIterator = detectorModel.iterator( base, targetChannel );
270+
final Iterator< Settings > detectorIterator = detectorModel.iterator( base );
288271
while ( detectorIterator.hasNext() )
289272
{
290273
if ( isCanceled() )
@@ -307,7 +290,7 @@ private int loopDetectorSettings( final Settings base, final IterationData itera
307290
/**
308291
* Iterates over possible several spot filter configurations, and adds them
309292
* to the specified base settings, then loop over tracker configurations.
310-
*
293+
*
311294
* @param base
312295
* the {@link Settings} base. Must be fully configured except for
313296
* spot filters, tracker settings and track filters.
@@ -353,7 +336,7 @@ private int loopSpotFilterSettings( final Settings base, final IterationData ite
353336
/**
354337
* Iterates over possible several tracker configurations, and adds them to
355338
* the specified base settings, then loop over track filters configurations.
356-
*
339+
*
357340
* @param base
358341
* the {@link Settings} base. Must be fully configured except for
359342
* tracker settings and track filters.
@@ -372,7 +355,7 @@ private int loopTrackerSettings( final Settings base, final IterationData iterat
372355
{
373356
MAIN_LOOP: for ( final TrackerSweepModel trackerModel : model.getActiveTracker() )
374357
{
375-
final Iterator< Settings > trackerIterator = trackerModel.iterator( base, targetChannel );
358+
final Iterator< Settings > trackerIterator = trackerModel.iterator( base );
376359
while ( trackerIterator.hasNext() )
377360
{
378361
if ( isCanceled() )
@@ -394,7 +377,7 @@ private int loopTrackerSettings( final Settings base, final IterationData iterat
394377
* Iterates over possible several track filter configurations, and adds them
395378
* to the specified base settings, then execute the tracking and metrics
396379
* measurements.
397-
*
380+
*
398381
* @param base
399382
* the {@link Settings} base. Must be fully configured except for
400383
* track filters.
@@ -444,7 +427,7 @@ private int loopTrackFilterSettings( final Settings base, final IterationData it
444427
/**
445428
* Execute the full tracking process using the fully configured
446429
* {@link Settings}.
447-
*
430+
*
448431
* @param settings
449432
* the settings to use to run TrackMate.
450433
* @param iterationData
@@ -667,8 +650,6 @@ public static final class Builder
667650

668651
private String runSettingsPath;
669652

670-
private int targetChannel = 1;
671-
672653
private String savePath;
673654

674655
private Logger batchLogger = Logger.DEFAULT_LOGGER;
@@ -687,7 +668,7 @@ public static final class Builder
687668

688669
/**
689670
* Sets the tracking metrics type to use.
690-
*
671+
*
691672
* @param type
692673
* the tracking metrics type.
693674
* @return this builder.
@@ -704,7 +685,7 @@ public Builder trackingMetricsType( final TrackingMetricsType type )
704685
* Sets the tracking metrics type to use with a string. Currently
705686
* supported types are "CTC" (Cell-Tracking-Challenge) and "SPT"
706687
* (Single-Particle Tracking Challenge).
707-
*
688+
*
708689
* @param type
709690
* the tracking metrics type as a string.
710691
* @return this builder.
@@ -724,7 +705,7 @@ public Builder trackingMetricsType( final String type )
724705
* Sets the path to the ground-truth file or folder.
725706
* <p>
726707
* The files need to comply to the tracking metrics.
727-
*
708+
*
728709
* @param groundTruth
729710
* path to the ground-truth file or folder.
730711
* @return this builder.
@@ -745,7 +726,7 @@ public Builder groundTruth( final String groundTruth )
745726
* The config file is used to specify what parameters to test. It is a
746727
* JSon file named <code>helperrunnersettings.json</code>. Use the GUI
747728
* to set it.
748-
*
729+
*
749730
* @param runSettings
750731
* path to the helper runner configuration file.
751732
* @return this builder.
@@ -760,7 +741,7 @@ public Builder runSettings( final String runSettings )
760741

761742
/**
762743
* Sets the path to the folder in which runner results will be saved.
763-
*
744+
*
764745
* @param savePath
765746
* path to the save folder.
766747
* @return this builder.
@@ -775,7 +756,7 @@ public Builder savePath( final String savePath )
775756

776757
/**
777758
* Sets the path to the image file to use as input.
778-
*
759+
*
779760
* @param imagePath
780761
* path to the image file to use as input.
781762
* @return this builder.
@@ -790,7 +771,7 @@ public Builder imagePath( final String imagePath )
790771

791772
/**
792773
* Sets the path to the image to use as input.
793-
*
774+
*
794775
* @param image
795776
* path to the image to use as input.
796777
* @return this builder.
@@ -803,26 +784,9 @@ public Builder image( final ImagePlus image )
803784
return this;
804785
}
805786

806-
/**
807-
* Sets the index of the channel in the input image to use for tracking.
808-
* Channels are here 1-numbered, meaning that "1" is the first available
809-
* channel.
810-
*
811-
* @param targetChannel
812-
* the channel index
813-
* @return this builder.
814-
*/
815-
public Builder targetChannel( final int targetChannel )
816-
{
817-
if ( this.targetChannel != targetChannel )
818-
this.targetChannel = targetChannel;
819-
820-
return this;
821-
}
822-
823787
/**
824788
* Sets the logger to use to log progress of the run.
825-
*
789+
*
826790
* @param batchLogger
827791
* a {@link Logger} instance.
828792
* @return this builder.
@@ -838,7 +802,7 @@ public Builder batchLogger( final Logger batchLogger )
838802
/**
839803
* Sets the logger to use to log individual tracking tests. This is only
840804
* useful for debugging.
841-
*
805+
*
842806
* @param trackmateLogger
843807
* a {@link Logger} instance.
844808
* @return this builder.
@@ -856,7 +820,7 @@ public Builder trackmateLogger( final Logger trackmateLogger )
856820
* test.
857821
* <p>
858822
* This can consume a lot off disk space if there are many tests to run.
859-
*
823+
*
860824
* @param saveTrackMateFiles
861825
* whether TrackMate XML files will be saved for every test.
862826
* @return this builder
@@ -875,7 +839,7 @@ public Builder saveTrackMateFiles( final boolean saveTrackMateFiles )
875839
* <p>
876840
* Only affect the SPT metrics type, if it is specified via the string
877841
* method {@link #trackingMetricsType(String)} of this builder.
878-
*
842+
*
879843
* @param maxDist
880844
* the max pairing distance.
881845
* @return this builder.
@@ -1025,7 +989,6 @@ else if ( typeStr.equals( "SPT" ) )
1025989
imp,
1026990
model,
1027991
runSettingsPath,
1028-
targetChannel,
1029992
savePath,
1030993
batchLogger,
1031994
trackmateLogger,

src/main/java/fiji/plugin/trackmate/helper/model/AbstractSweepModelBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected AbstractSweepModelBase( final String name, final Map< String, Abstract
4848
this.models = models;
4949
}
5050

51-
public abstract Iterator< Settings > iterator( final Settings base, final int targetChannel );
51+
public abstract Iterator< Settings > iterator( final Settings base );
5252

5353
public String getName()
5454
{

src/main/java/fiji/plugin/trackmate/helper/model/ParameterSweepModel.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,11 @@ public int count()
206206
*/
207207
public int countTrackerSettings()
208208
{
209-
final int targetChannel = 1;
210209
final Settings base = new Settings( null );
211210
int count = 0;
212211
for ( final TrackerSweepModel trackerModel : getActiveTracker() )
213212
{
214-
final Iterator< Settings > tit = trackerModel.iterator( base, targetChannel );
213+
final Iterator< Settings > tit = trackerModel.iterator( base );
215214
while ( tit.hasNext() )
216215
{
217216
tit.next();
@@ -229,12 +228,11 @@ public int countTrackerSettings()
229228
*/
230229
public int countDetectorSettings()
231230
{
232-
final int targetChannel = 1;
233231
final Settings base = new Settings( null );
234232
int count = 0;
235233
for ( final DetectorSweepModel detectorModel : getActiveDetectors() )
236234
{
237-
final Iterator< Settings > dit = detectorModel.iterator( base, targetChannel );
235+
final Iterator< Settings > dit = detectorModel.iterator( base );
238236
while ( dit.hasNext() )
239237
{
240238
dit.next();

0 commit comments

Comments
 (0)