Skip to content

Commit

Permalink
Use headleass project model instead of normal project model in FitEll…
Browse files Browse the repository at this point in the history
…ipsoidPluginTest
  • Loading branch information
stefanhahmann committed Oct 26, 2023
1 parent 691faec commit 5f29d5b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.junit.Test;
import org.mastodon.collection.RefObjectMap;
import org.mastodon.mamut.fitting.ellipsoid.Ellipsoid;
import org.mastodon.mamut.model.ModelGraph;
import org.mastodon.mamut.model.Spot;
import org.scijava.Context;

Expand All @@ -56,18 +57,20 @@ public void testFitEllipsoidPlugin() {
final ArtificialData data = new ArtificialData( new Context() );
final StopWatch watch = StopWatch.createAndStart();
final FitEllipsoidPlugin plugin = new FitEllipsoidPlugin();
plugin.setAppPluginModel( data.getAppModel() );
plugin.setHeadlessProjectModel( data.getHeadlessProjectModel() );
plugin.fitSelectedVertices();
System.out.println( watch );
final int success = countCorrectEllipsoids( data );
assertEquals( "Not all ellipsoids were fitted correctly.", data.getAppModel().getModel().getGraph().vertices().size(), success );
ModelGraph graph = data.getHeadlessProjectModel().getModel().getGraph();
assertEquals( "Not all ellipsoids were fitted correctly.", graph.vertices().size(), success );
}

private static int countCorrectEllipsoids( final ArtificialData data )
{
int success = 0;
final RefObjectMap< Spot, Ellipsoid > expectedEllipsoids = data.getExpectedEllipsoids();
for( final Spot spot : data.getAppModel().getModel().getGraph().vertices() ) {
for ( final Spot spot : data.getHeadlessProjectModel().getModel().getGraph().vertices() )
{
final Ellipsoid actualEllipsoid = asEllipsoid( spot );
final Ellipsoid expectedEllipsoid = expectedEllipsoids.get( spot );
final boolean equal = isEllipsoidEqual( expectedEllipsoid, actualEllipsoid );
Expand Down

0 comments on commit 5f29d5b

Please sign in to comment.