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

Code cleanup

parent ead56ef2
Branches
No related tags found
1 merge request!41Resolve "Consider rescaling (binning) large images"
...@@ -28,19 +28,27 @@ ...@@ -28,19 +28,27 @@
*/ */
package fr.pasteur.ida.zellige.steps.selection.pretreatment; package fr.pasteur.ida.zellige.steps.selection.pretreatment;
import io.scif.img.ImgOpener;
import net.imglib2.RandomAccessible; import net.imglib2.RandomAccessible;
import net.imglib2.RandomAccessibleInterval; import net.imglib2.RandomAccessibleInterval;
import net.imglib2.algorithm.convolution.fast_gauss.FastGauss;
import net.imglib2.algorithm.fft2.FFTConvolution;
import net.imglib2.algorithm.gauss3.Gauss3; import net.imglib2.algorithm.gauss3.Gauss3;
import net.imglib2.algorithm.stats.Normalize; import net.imglib2.algorithm.stats.Normalize;
import net.imglib2.converter.Converters; import net.imglib2.converter.Converters;
import net.imglib2.converter.RealTypeConverters;
import net.imglib2.converter.readwrite.RealFloatSamplerConverter; import net.imglib2.converter.readwrite.RealFloatSamplerConverter;
import net.imglib2.img.Img; import net.imglib2.img.Img;
import net.imglib2.img.ImgFactory; import net.imglib2.img.ImgFactory;
import net.imglib2.img.array.ArrayImgFactory; import net.imglib2.img.array.ArrayImgFactory;
import net.imglib2.type.NativeType; import net.imglib2.type.NativeType;
import net.imglib2.type.Type;
import net.imglib2.type.numeric.RealType; import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.complex.ComplexFloatType;
import net.imglib2.type.numeric.real.FloatType; import net.imglib2.type.numeric.real.FloatType;
import net.imglib2.util.ImgUtil; import net.imglib2.util.ImgUtil;
import net.imglib2.util.RealSum;
import net.imglib2.view.IntervalView;
import net.imglib2.view.Views; import net.imglib2.view.Views;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -92,8 +100,9 @@ public class Pretreatment< T extends RealType< T > & NativeType< T > > ...@@ -92,8 +100,9 @@ public class Pretreatment< T extends RealType< T > & NativeType< T > >
* @return a new Img with normalize pixel intensity values. * @return a new Img with normalize pixel intensity values.
*/ */
private static < T extends RealType< T > & NativeType< T > > Img< T > normalizeImage( private static < T extends RealType< T > & NativeType< T > > Img< T > normalizeImage(
Img< T > image, ImgFactory< T > factory ) RandomAccessibleInterval< T > image, ImgFactory< T > factory )
{ {
LOGGER.debug( "Staring normalization." );
Img< T > normalizedImage = factory.create( image ); Img< T > normalizedImage = factory.create( image );
ImgUtil.copy( image, normalizedImage ); ImgUtil.copy( image, normalizedImage );
T min = normalizedImage.firstElement().createVariable(); T min = normalizedImage.firstElement().createVariable();
...@@ -101,6 +110,7 @@ public class Pretreatment< T extends RealType< T > & NativeType< T > > ...@@ -101,6 +110,7 @@ public class Pretreatment< T extends RealType< T > & NativeType< T > >
T max = normalizedImage.firstElement().copy().createVariable(); T max = normalizedImage.firstElement().copy().createVariable();
max.setReal( 255 ); max.setReal( 255 );
Normalize.normalize( normalizedImage, min, max ); Normalize.normalize( normalizedImage, min, max );
LOGGER.debug( "End of normalization." );
return normalizedImage; return normalizedImage;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment