Skip to content
Snippets Groups Projects
Commit 21234c06 authored by Céline  TREBEAU's avatar Céline TREBEAU
Browse files

genericity enforcement

parent d70a676b
No related branches found
No related tags found
1 merge request!20Version for release
......@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import static fr.pasteur.ida.zellige.constructionMethods.pixelSelection.util.Derivative.FORWARD;
import static fr.pasteur.ida.zellige.constructionMethods.pixelSelection.util.Derivative.CENTRAL;
public class ReferenceSurfaceExtraction< T extends RealType< T > & NativeType< T > >
......@@ -61,7 +61,8 @@ public class ReferenceSurfaceExtraction< T extends RealType< T > & NativeType< T
private int SS_OS_count;
private int SS_smallSurfaces;
private int SS_goodSurfaces;
private static final String derivativeMethod = FORWARD;
private static final String derivativeMethod = CENTRAL;
public ReferenceSurfaceExtraction( RandomAccessibleInterval< T > input, ImgFactory< T > factory,
PixelSelectionParameters parameters, ProjectionParameters projectionParameters,
......@@ -133,6 +134,7 @@ public class ReferenceSurfaceExtraction< T extends RealType< T > & NativeType< T
{
// displaySurface( surface );
Img< UnsignedShortType > processedZMap = processedZMap( surface );
// ImageJFunctions.show(processedZMap, "process z map "+ index);
ReferenceSurface< T > referenceSurface = new ReferenceSurface<>( input, factory, processedZMap, index++ );
referenceSurfaces.add( referenceSurface );
}
......
......@@ -10,7 +10,8 @@ import fr.pasteur.ida.zellige.utils.ZelligePipelineAnalyse;
import ij.ImageJ;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.Img;
import net.imglib2.type.numeric.real.FloatType;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import org.junit.Ignore;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
......@@ -24,16 +25,15 @@ import java.io.IOException;
import java.util.ArrayList;
public class ParameterSweep
public class ParameterSweep< T extends RealType< T > & NativeType< T >, R extends RealType< R > & NativeType< R > >
{
private final static Logger LOGGER = LoggerFactory.getLogger( ParameterSweep.class );
static ArrayList< Img< FloatType > > ref;
static Img< FloatType > tested;
ArrayList< Img< T > > ref;
Img< R > tested;
private static CSVWriter writer;
@BeforeAll
static void init() throws IOException
public ParameterSweep() throws IOException
{
String imagePath = "C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\STK_Mouche_c01_f0001_p013.tif";
final String[] refImagePath = new String[]{
......@@ -42,7 +42,7 @@ public class ParameterSweep
"C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\GT\\Ground truth Height map_3.tif",
"C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\GT\\Ground truth Height map_4.tif"
};
ParameterSweepFiles files = new ParameterSweepFiles( refImagePath, imagePath, "centralDerivative_noSmooth_STK_Mouche_c01_f0001_p013" );
ParameterSweepFiles files = new ParameterSweepFiles( refImagePath, imagePath, "test_mouche" );
ref = files.getRefs();
tested = files.getTested();
writer = new CSVWriter( files.getPath() );
......@@ -53,7 +53,31 @@ public class ParameterSweep
"FS_good", "FS_small", "FS_finalised",
"SS_good", "SS_small", "SS_finalised", "OptimizedSet" };
writer.writeToFile( header );
RMSEAndCoverageComputation.setSubtract( - 1 );
RMSEAndCoverageComputation.setSubtract( 0 );
}
@BeforeAll
static void init() throws IOException
{
// String imagePath = "C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\STK_Mouche_c01_f0001_p013.tif";
// final String[] refImagePath = new String[]{
// "C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\GT\\Ground truth Height map_1.tif",
// "C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\GT\\Ground truth Height map_2.tif",
// "C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\GT\\Ground truth Height map_3.tif",
// "C:\\Users\\ctrebeau\\Desktop\\Zellige analysis\\files\\Mouche_c01_f0001_p013\\GT\\Ground truth Height map_4.tif"
// };
// ParameterSweepFiles files = new ParameterSweepFiles( refImagePath, imagePath, "test_mouche" );
// ref = files.getRefs();
// tested = files.getTested();
// writer = new CSVWriter( files.getPath() );
// String[] header = { "Parameter1", "Parameter1Value",
// "GroundTruthNb", "SelectedPixelNb", "RMSE", "Coverage", "SelectionPT", "ConstructionPT",
// "FS_OS_PT", "FS_surface_PT", "SS_OS_PT", "SS_surface_PT", "Total_PT",
// "FS_OS_count", "FS_startingOS_count", "SS_OS_count", "SS_startingOS_count",
// "FS_good", "FS_small", "FS_finalised",
// "SS_good", "SS_small", "SS_finalised", "OptimizedSet" };
// writer.writeToFile( header );
// RMSEAndCoverageComputation.setSubtract( 0 );
}
@AfterAll
......@@ -81,7 +105,7 @@ public class ParameterSweep
double adequacy = 1;
ReferenceSurfaceExtraction.setAdequacy( adequacy );
parameters.print();
ZelligePipelineAnalyse analyse = new ZelligePipelineAnalyse();
ZelligePipelineAnalyse< T, R > analyse = new ZelligePipelineAnalyse();
analyse.run( parameters, tested, ref );
for ( RMSEAndCoverageComputation r : analyse.getErrorList() )
{
......@@ -110,7 +134,7 @@ public class ParameterSweep
@Ignore
@ParameterizedTest
@CsvSource( value = "Amplitude;0.2;GaussianBlur;2;0.8;0.1;4;10;5;1;0.7;10;0.8;0.1;10;0.9;YES",
@CsvSource( value = "Amplitude;0.2;GaussianBlur;2;0.8;0.1;4;30;5;1;0.7;10;0.8;0.1;10;0.9;YES",
delimiterString = ";" )
void parameterSweepSingle( String testedParameter, String testedParameterValue, String filter, int filterParameter,
double amplitudeThreshold, double otsuThreshold,
......@@ -130,7 +154,7 @@ public class ParameterSweep
double adequacy = 1;
ReferenceSurfaceExtraction.setAdequacy( adequacy );
parameters.print();
ZelligePipelineAnalyse analyse = new ZelligePipelineAnalyse();
ZelligePipelineAnalyse< T, R > analyse = new ZelligePipelineAnalyse();
analyse.run( parameters, tested, ref );
for ( RMSEAndCoverageComputation r : analyse.getErrorList() )
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment