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

Feature

- handles a bin value at 1.
parent 7251c2eb
Branches
No related tags found
1 merge request!41Resolve "Consider rescaling (binning) large images"
......@@ -5,7 +5,6 @@ import net.imagej.ImageJ;
import net.imglib2.RandomAccess;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.Img;
import net.imglib2.img.ImgFactory;
import net.imglib2.img.display.imagej.ImageJFunctions;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
......@@ -31,14 +30,17 @@ public class Unbinning< T extends RealType< T > & NativeType< T > >
/**
*
* @param input a binned image
* @param factory the input image factory
* @param bin the bin size
* @return the input image unbinned
* @param <T> input and output image type
*/
public static < T extends RealType< T > & NativeType< T> > Img<T> run( RandomAccessibleInterval<T> input, ImgFactory<T> factory, int bin)
public static < T extends RealType< T > & NativeType< T> > Img<T> run( Img <T> input, int bin)
{
Img <T> output = factory.create( input.dimension( 0 ) * bin, input.dimension( 1 ) * bin);
if (bin == 1)
{
return input;
}
Img <T> output = input.factory().create( input.dimension( 0 ) * bin, input.dimension( 1 ) * bin);
Unbinning<T> unbinning = new Unbinning<>( input, bin, output );
unbinning.run();
return output;
......@@ -113,7 +115,7 @@ public class Unbinning< T extends RealType< T > & NativeType< T > >
ImageJFunctions.show( kernel, "original" );
double time1 = System.currentTimeMillis();
int bin = 4;
Img< UnsignedByteType > output = Binning.binning( kernel, bin);
Img< UnsignedByteType > output = Binning.binning( kernel, bin );
double time2 = System.currentTimeMillis();
LOGGER.debug( "Multithreading time = {}s", ( time2 - time1 ) / 1000 );
assert output != null;
......@@ -131,7 +133,7 @@ public class Unbinning< T extends RealType< T > & NativeType< T > >
}
}
Img<UnsignedByteType> output_unbinned = Unbinning.run(i, i.factory(), bin);
Img<UnsignedByteType> output_unbinned = Unbinning.run(i, bin);
ImageJFunctions.show( output_unbinned, "unbinned 1" );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment