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

Addition of slight dilation in z dimension to the amplitude mask

parent 4e591fea
No related branches found
No related tags found
1 merge request!10Surface reconstruction Refactoring
......@@ -164,6 +164,21 @@ public class AmplitudeBackgroundForeGroundClassification
run();
}
public static < T extends RealType< T > & NativeType< T > > boolean isForeground( IntervalView< T > intervalView, double sizePercent )
{
double sum = 0;
Cursor< T > cursor = intervalView.cursor();
while ( cursor.hasNext() )
{
cursor.fwd();
if ( cursor.get().getRealDouble() != 0 )
{
sum++;
}
}
return ( sum ) > ( intervalView.dimension( 0 ) * intervalView.dimension( 1 ) * sizePercent );
}
public void run()
{
long X = source.dimension( 0 );
......@@ -179,22 +194,9 @@ public class AmplitudeBackgroundForeGroundClassification
int foreground = isForeground( viewSource, sizePercent ) ? 1 : 0;
viewOutput.forEach( pixel -> pixel.setReal( foreground ) );
}
// Slight dilatation in z dimension
Utils.gaussConvolution( output.copy(), output, new double[]{ 0, 0, 1 } );
}
public static < T extends RealType< T > & NativeType< T > > boolean isForeground( IntervalView< T > intervalView, double sizePercent )
{
double sum = 0;
Cursor< T > cursor = intervalView.cursor();
while ( cursor.hasNext() )
{
cursor.fwd();
if ( cursor.get().getRealDouble() != 0 )
{
sum++;
}
}
return ( sum ) > ( intervalView.dimension( 0 ) * intervalView.dimension( 1 ) * sizePercent );
}
public Img< FloatType > getOutput()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment