Skip to content

Commit a44173a

Browse files
committed
ADD: BIO measures rely on the new reuseOrCreateAndCalculateNewCache()
1 parent 54c1150 commit a44173a

File tree

4 files changed

+8
-56
lines changed

4 files changed

+8
-56
lines changed

src/main/java/net/celltrackingchallenge/measures/BCi.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,8 @@ public double calculate(final String gtPath, final String resPath,
180180
final TrackDataCache _cache)
181181
throws IOException, ImgIOException
182182
{
183-
//invalidate own cache
184-
cache = null;
185-
186-
//check we got some hint/cache
187-
//and if it fits our input, then use it
188-
if (_cache != null && _cache.validFor(gtPath,resPath)) cache = _cache;
189-
190-
//if no cache is available after all, compute it
191-
if (cache == null)
192-
{
193-
//do the upper stage
194-
cache = new TrackDataCache(log);
195-
cache.calculate(gtPath,resPath);
196-
}
183+
//obtain a cache
184+
cache = TrackDataCache.reuseOrCreateAndCalculateNewCache(_cache,gtPath,resPath,log);
197185

198186
//do the bottom stage
199187
//DEBUG//log.info("Computing the BCi bottom part...");

src/main/java/net/celltrackingchallenge/measures/CCA.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,8 @@ public double calculate(final String gtPath, final String resPath,
9393
final TrackDataCache _cache)
9494
throws IOException, ImgIOException
9595
{
96-
//invalidate own cache
97-
cache = null;
98-
99-
//check we got some hint/cache
100-
//and if it fits our input, then use it
101-
if (_cache != null && _cache.validFor(gtPath,resPath)) cache = _cache;
102-
103-
//if no cache is available after all, compute it
104-
if (cache == null)
105-
{
106-
//do the upper stage
107-
cache = new TrackDataCache(log);
108-
cache.calculate(gtPath,resPath);
109-
}
96+
//obtain a cache
97+
cache = TrackDataCache.reuseOrCreateAndCalculateNewCache(_cache,gtPath,resPath,log);
11098

11199
//do the bottom stage
112100
//DEBUG//log.info("Computing the CCA bottom part...");

src/main/java/net/celltrackingchallenge/measures/CT.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,8 @@ public double calculate(final String gtPath, final String resPath,
155155
final TrackDataCache _cache)
156156
throws IOException, ImgIOException
157157
{
158-
//invalidate own cache
159-
cache = null;
160-
161-
//check we got some hint/cache
162-
//and if it fits our input, then use it
163-
if (_cache != null && _cache.validFor(gtPath,resPath)) cache = _cache;
164-
165-
//if no cache is available after all, compute it
166-
if (cache == null)
167-
{
168-
//do the upper stage
169-
cache = new TrackDataCache(log);
170-
cache.calculate(gtPath,resPath);
171-
}
158+
//obtain a cache
159+
cache = TrackDataCache.reuseOrCreateAndCalculateNewCache(_cache,gtPath,resPath,log);
172160

173161
//do the bottom stage
174162
//DEBUG//log.info("Computing the CT bottom part...");

src/main/java/net/celltrackingchallenge/measures/TF.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -236,20 +236,8 @@ public double calculate(final String gtPath, final String resPath,
236236
final TrackDataCache _cache)
237237
throws IOException, ImgIOException
238238
{
239-
//invalidate own cache
240-
cache = null;
241-
242-
//check we got some hint/cache
243-
//and if it fits our input, then use it
244-
if (_cache != null && _cache.validFor(gtPath,resPath)) cache = _cache;
245-
246-
//if no cache is available after all, compute it
247-
if (cache == null)
248-
{
249-
//do the upper stage
250-
cache = new TrackDataCache(log);
251-
cache.calculate(gtPath,resPath);
252-
}
239+
//obtain a cache
240+
cache = TrackDataCache.reuseOrCreateAndCalculateNewCache(_cache,gtPath,resPath,log);
253241

254242
//do the bottom stage
255243
//DEBUG//log.info("Computing the TF bottom part...");

0 commit comments

Comments
 (0)