Skip to content

Commit

Permalink
Add the track id option to the getLabelId() method
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhahmann committed Sep 20, 2023
1 parent 6afe5c5 commit f63043c
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,22 @@ private static long[] addTimeDimension( long[] dimensions, int timepoints )

private int getLabelId( final Spot spot, final LabelOptions option )
{
if ( labelOptions.equals( LabelOptions.SPOT_ID ) )
switch ( option )
{
case SPOT_ID:
return spot.getInternalPoolIndex();
BranchSpot ref = model.getBranchGraph().vertexRef();
int branchSpotId = model.getBranchGraph().getBranchVertex( spot, ref ).getInternalPoolIndex();
model.getBranchGraph().releaseRef( ref ); // NB: optional, but increases performance, when this method is called often
return branchSpotId;
case BRANCH_SPOT_ID:
BranchSpot ref = model.getBranchGraph().vertexRef();
int branchSpotId = model.getBranchGraph().getBranchVertex( spot, ref ).getInternalPoolIndex();
model.getBranchGraph().releaseRef( ref ); // NB: optional, but increases performance, when this method is called often
return branchSpotId;
case TRACK_ID:
if ( trackIdProjection == null )
trackIdProjection = getTrackIDFeatureProjection( context, model );
return ( int ) trackIdProjection.value( spot );
default:
throw new IllegalArgumentException( "Unknown label option: " + option );
}
}

private static ImgPlus< IntType > createImgPlus( final Img< IntType > img )
Expand Down

0 comments on commit f63043c

Please sign in to comment.