Skip to content

Commit

Permalink
Fix bug with low number of frames and frame rate reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhahmann committed Oct 10, 2023
1 parent 18f08cc commit 22d1244
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public void saveEllipsoidSegmentationToFile(
logger.info( "Save ellipsoid segmentation to file. Label options: {}, file: {}", labelOption, file.getAbsolutePath() );
long[] spatialDimensions = getDimensionsOfSource();
int numTimePoints = timePoints.size();
int frames = numTimePoints / frameRateReduction + 1;
int frames = numTimePoints / frameRateReduction;
if ( numTimePoints > frameRateReduction )
frames++;
logger.debug(
"number of timepoints: {}, frame rate reduction: {}, resulting frames: {}", numTimePoints, frameRateReduction, frames );
DiskCachedCellImg< IntType, ? > img = createCachedImage( spatialDimensions, frames );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;

public class SegmentUsingEllipsoidsControllerTest
Expand Down Expand Up @@ -80,6 +81,11 @@ public void testSaveEllipsoidSegmentationToFile() throws IOException
SCIFIOImgPlus< IntType > imgTrack = getIntTypeSCIFIOImgPlus( imgOpener, outputTrack );

// check that the spot id / branchSpot id / track id is used as value in the center of the spot
assertNotNull( imgSpot );
assertEquals( 3, imgSpot.dimensionsAsLongArray().length );
assertEquals( 100, imgSpot.dimension( 0 ) );
assertEquals( 100, imgSpot.dimension( 1 ) );
assertEquals( 100, imgSpot.dimension( 2 ) );
assertEquals( spot.getInternalPoolIndex() + SegmentUsingEllipsoidsController.LABEL_ID_OFFSET, imgSpot.getAt( center ).get() );
assertEquals(
branchSpot.getInternalPoolIndex() + SegmentUsingEllipsoidsController.LABEL_ID_OFFSET, imgBranchSpot.getAt( center ).get() );
Expand Down

0 comments on commit 22d1244

Please sign in to comment.