Java Code Examples for net.imglib2.img.array.ArrayImg#copy()
The following examples show how to use
net.imglib2.img.array.ArrayImg#copy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MVDeconFFT.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
public static ArrayImg< FloatType, ? > computeExponentialKernel( final ArrayImg< FloatType, ? > kernel, final int numViews ) { final ArrayImg< FloatType, ? > exponentialKernel = kernel.copy(); for ( final FloatType f : exponentialKernel ) f.set( pow( f.get(), numViews ) ); return exponentialKernel; }
Example 2
Source File: MVDeconFFT.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
public static ArrayImg< FloatType, ? > computeInvertedKernel( final ArrayImg< FloatType, ? > kernel ) { final ArrayImg< FloatType, ? > invKernel = kernel.copy(); for ( int d = 0; d < invKernel.numDimensions(); ++d ) Mirror.mirror( invKernel, d, Threads.numThreads() ); return invKernel; }
Example 3
Source File: ExtractPSF.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
/** * * @param filenames * @return */ public static < T extends RealType< T > & NativeType< T > > ExtractPSF< T > loadAndTransformPSFs( final ArrayList< Pair< Pair< Angle, Illumination >, String > > filenames, final ArrayList< ViewDescription > viewDesc, final T type, final HashMap< ViewId, AffineTransform3D > models ) { final ExtractPSF< T > extractPSF = new ExtractPSF< T >(); for ( final ViewDescription vd : viewDesc ) { final File file = getFileNameForViewId( vd, filenames ); // extract the PSF for this one IOFunctions.println( "Loading PSF file '" + file.getAbsolutePath() ); final ImagePlus imp = new Opener().openImage( file.getAbsolutePath() ); if ( imp == null ) throw new RuntimeException( "Could not load '" + file + "' using ImageJ (should be a TIFF file)." ); final ImageStack stack = imp.getStack(); final int width = imp.getWidth(); final int sizeZ = imp.getNSlices(); ArrayImg< T, ? > psfImage = new ArrayImgFactory< T >().create( new long[]{ width, imp.getHeight(), sizeZ }, type ); for ( int z = 0; z < sizeZ; ++z ) { final Cursor< T > cursor = Views.iterable( Views.hyperSlice( psfImage, 2, z ) ).localizingCursor(); final ImageProcessor ip = stack.getProcessor( z + 1 ); while ( cursor.hasNext() ) { cursor.fwd(); cursor.get().setReal( ip.getf( cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ) ); } } final ArrayImg< T, ? > psf; if ( models != null ) { IOFunctions.println( "Transforming PSF for viewid " + vd.getViewSetupId() + ", file=" + file.getName() ); psf = ExtractPSF.transformPSF( psfImage, models.get( vd ) ); } else { IOFunctions.println( "PSF for viewid " + vd.getViewSetupId() + ", file=" + file.getName() + " will not be transformed." ); psf = psfImage.copy(); } extractPSF.viewIds.add( vd ); extractPSF.pointSpreadFunctions.put( vd, psf ); extractPSF.originalPSFs.put( vd, psfImage ); } return extractPSF; }