Java Code Examples for net.imglib2.img.display.imagej.ImageJFunctions#show()
The following examples show how to use
net.imglib2.img.display.imagej.ImageJFunctions#show() .
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: Downsample.java From SPIM_Registration with GNU General Public License v2.0 | 6 votes |
public static void main( String[] args ) { final Img< FloatType > img; //img = OpenImg.open( "/Users/preibischs/Documents/Microscopy/SPIM/HisYFP-SPIM/img_Angle0.tif", new ArrayImgFactory< FloatType >() ); img = new ArrayImgFactory< FloatType >().create( new long[]{ 515, 231, 15 }, new FloatType() ); final Cursor< FloatType > c = img.localizingCursor(); while ( c.hasNext() ) { c.next().set( c.getIntPosition( 0 ) % 10 + c.getIntPosition( 1 ) % 13 + c.getIntPosition( 2 ) % 3 ); } new ImageJ(); ImageJFunctions.show( img ); ImageJFunctions.show( simple2x( img, img.factory(), new boolean[]{ true, true, true } ) ); }
Example 2
Source File: BlendingRealRandomAccess.java From SPIM_Registration with GNU General Public License v2.0 | 6 votes |
public static void main( String[] args ) { new ImageJ(); Img< FloatType > img = ArrayImgs.floats( 500, 500 ); BlendingRealRandomAccess blend = new BlendingRealRandomAccess( img, new float[]{ 100, 0 }, new float[]{ 12, 150 } ); Cursor< FloatType > c = img.localizingCursor(); while ( c.hasNext() ) { c.fwd(); blend.setPosition( c ); c.get().setReal( blend.get().getRealFloat() ); } ImageJFunctions.show( img ); }
Example 3
Source File: WeightNormalizer.java From SPIM_Registration with GNU General Public License v2.0 | 6 votes |
public static void main( String[] args ) { new ImageJ(); Img< FloatType > img = ArrayImgs.floats( 500, 500 ); BlendingRealRandomAccess blend = new BlendingRealRandomAccess( img, new float[]{ 100, 0 }, new float[]{ 12, 150 } ); Cursor< FloatType > c = img.localizingCursor(); while ( c.hasNext() ) { c.fwd(); blend.setPosition( c ); c.get().setReal( blend.get().getRealFloat() ); } ImageJFunctions.show( img ); }
Example 4
Source File: BlendingRealRandomAccess.java From BigStitcher with GNU General Public License v2.0 | 6 votes |
public static void main( String[] args ) { new ImageJ(); Img< FloatType > img = ArrayImgs.floats( 500, 500 ); BlendingRealRandomAccess blend = new BlendingRealRandomAccess( img, new float[]{ 100, 0 }, new float[]{ 12, 150 } ); Cursor< FloatType > c = img.localizingCursor(); while ( c.hasNext() ) { c.fwd(); blend.setPosition( c ); c.get().setReal( blend.get().getRealFloat() ); } ImageJFunctions.show( img ); }
Example 5
Source File: FastFusionTools.java From BigStitcher with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { final ImagePlus imp = IJ.openImage( "/Users/david/Desktop/stable HelaK-GFP-H2A.Z20000.tif" ); new ImageJ(); RandomAccessibleInterval< ? extends RealType > img = ImageJFunctions.wrapReal( imp ); ArrayImg< FloatType, FloatArray > f = ArrayImgs.floats( 1024, 1024 ); ArrayImg< FloatType, FloatArray > w = ArrayImgs.floats( 1024, 1024 ); RandomAccessibleInterval< FloatType > interp = (RandomAccessibleInterval< FloatType >) getLinearInterpolation( img, new FloatType(), new float[] {0.5f,0.5f}, Executors.newSingleThreadExecutor() ).getA(); RandomAccessibleInterval< FloatType > weight = new ArrayImgFactory( new FloatType() ).create( interp ); applyWeights( interp, weight, new float[] {0.5f,0.5f}, new float[] {0,0}, new float[] {20,20}, false, Executors.newSingleThreadExecutor() ); addTranslated( Views.iterable( interp ), f, new int[] {500, 700}, Executors.newSingleThreadExecutor() ); addTranslated( Views.iterable( interp ), f, new int[] {400, 500}, Executors.newSingleThreadExecutor() ); addTranslated( Views.iterable( weight ), w, new int[] {500, 700}, Executors.newSingleThreadExecutor() ); addTranslated( Views.iterable( weight ), w, new int[] {400, 500}, Executors.newSingleThreadExecutor() ); normalizeWeights( f, w, Executors.newSingleThreadExecutor() ); ImageJFunctions.show( f ); }
Example 6
Source File: Fusion.java From Stitching with GNU General Public License v2.0 | 5 votes |
public static void main( String[] args ) { new ImageJ(); // test blending ImgFactory< FloatType > f = new ArrayImgFactory< FloatType >(); Img< FloatType > img = f.create( new int[] { 400, 400 }, new FloatType() ); Cursor< FloatType > c = img.localizingCursor(); final int numDimensions = img.numDimensions(); final double[] tmp = new double[ numDimensions ]; // for blending final long[] dimensions = new long[ numDimensions ]; img.dimensions( dimensions ); final float percentScaling = 0.2f; final double[] border = new double[ numDimensions ]; while ( c.hasNext() ) { c.fwd(); for ( int d = 0; d < numDimensions; ++d ) tmp[ d ] = c.getFloatPosition( d ); c.get().set( (float)BlendingPixelFusion.computeWeight( tmp, dimensions, border, percentScaling ) ); } ImageJFunctions.show( img ); Log.debug( "done" ); }
Example 7
Source File: LinearIntensityMap.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public static void main( final String[] args ) { new ImageJ(); final double[] coefficients = new double[]{ 0, 2, 4, 8, 1, 1, 1, 1, 1, 10, 5, 1, 1, 1, 1, 1, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150 }; final LinearIntensityMap< DoubleType > transform = new LinearIntensityMap< DoubleType >( ArrayImgs.doubles( coefficients, 4, 4, 2 ) ); //final ImagePlus imp = new ImagePlus( "http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png" ); final ImagePlus imp1 = new ImagePlus( "http://fly.mpi-cbg.de/~saalfeld/Pictures/norway.jpg"); final ArrayImg< FloatType, FloatArray > image1 = ArrayImgs.floats( ( float[] )imp1.getProcessor().convertToFloatProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); final ArrayImg< UnsignedByteType, ByteArray > image2 = ArrayImgs.unsignedBytes( ( byte[] )imp1.getProcessor().convertToByteProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); final ArrayImg< UnsignedShortType, ShortArray > image3 = ArrayImgs.unsignedShorts( ( short[] )imp1.getProcessor().convertToShortProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); final ArrayImg< ARGBType, IntArray > image4 = ArrayImgs.argbs( ( int[] )imp1.getProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() ); ImageJFunctions.show( ArrayImgs.doubles( coefficients, 4, 4, 2 ) ); transform.run( image1 ); transform.run( image2 ); transform.run( image3 ); transform.run( image4 ); ImageJFunctions.show( image1 ); ImageJFunctions.show( image2 ); ImageJFunctions.show( image3 ); ImageJFunctions.show( image4 ); }
Example 8
Source File: MinFilterThreshold.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
public static void main( final String[] args ) { new ImageJ(); ImagePlus imp = new ImagePlus( "/Users/preibischs/workspace/TestLucyRichardson/src/resources/dros-1.tif" ); Img< FloatType > img = ImageJFunctions.convertFloat( imp ); ImageJFunctions.show( img.copy() ); ImageJFunctions.show( computeLazyMinFilter( img, 5 ) ); }
Example 9
Source File: Block.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
public static void main( String[] args ) { // define the blocksize so that it is one single block final RandomAccessibleInterval< FloatType > block = ArrayImgs.floats( 384, 384 ); final long[] blockSize = new long[ block.numDimensions() ]; block.dimensions( blockSize ); final RandomAccessibleInterval< FloatType > image = ArrayImgs.floats( 1024, 1024 ); final long[] imgSize = new long[ image.numDimensions() ]; image.dimensions( imgSize ); // whatever the kernel size is (extra size/2 in general) final long[] kernelSize = new long[]{ 16, 32 }; final BlockGeneratorFixedSizePrecise blockGenerator = new BlockGeneratorFixedSizePrecise( blockSize ); final Block[] blocks = blockGenerator.divideIntoBlocks( imgSize, kernelSize ); int i = 0; for ( final Block b : blocks ) { // copy data from the image to the block (including extra space for outofbounds/real image data depending on kernel size) b.copyBlock( Views.extendMirrorDouble( image ), block ); // do something with the block (e.g. also multithreaded, cluster, ...) for ( final FloatType f : Views.iterable( block ) ) f.set( i ); ++i; // write the block back (use a temporary image if multithreaded or in general not all are copied first) b.pasteBlock( image, block ); } ImageJFunctions.show( image ); }
Example 10
Source File: ImgLib2Util.java From BigStitcher with GNU General Public License v2.0 | 5 votes |
public static void main( String[] args ) { new ImageJ(); final Img< FloatType > img = openAs32Bit( new File( "src/main/resources/mri-stack.tif" ) ); //final Img< FloatType > img = openAs32Bit( new File( "src/main/resources/bridge.png" ) ); ImageJFunctions.show( img ); }
Example 11
Source File: MinFilterThreshold.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
public boolean run() { // fuse the dataset final ProcessFusion process; if ( loadSequentially ) process = new ProcessSequential( spimData, viewIdsToProcess, bb, false, false, 1 ); else process = new ProcessParalell( spimData, viewIdsToProcess, bb, false, false ); Img< FloatType > img = process.fuseStack( new FloatType(), new NearestNeighborInterpolatorFactory<FloatType>(), timepoint, channel ); final float[] minmax = FusionHelper.minMax( img ); final int effR = Math.max( radiusMin / bb.getDownSampling(), 1 ); final double threshold = (minmax[ 1 ] - minmax[ 0 ]) * ( background / 100.0 ) + minmax[ 0 ]; IOFunctions.println( "Fused image minimum: " + minmax[ 0 ] ); IOFunctions.println( "Fused image maximum: " + minmax[ 1 ] ); IOFunctions.println( "Threshold: " + threshold ); IOFunctions.println( "Computing minimum filter with effective radius of " + effR + " (downsampling=" + bb.getDownSampling() + ")" ); img = computeLazyMinFilter( img, effR ); if ( displaySegmentationImage ) ImageJFunctions.show( img ); this.min = new int[ img.numDimensions() ]; this.max = new int[ img.numDimensions() ]; if ( !computeBoundingBox( img, threshold, min, max ) ) return false; IOFunctions.println( "Bounding box dim scaled: [" + Util.printCoordinates( min ) + "] >> [" + Util.printCoordinates( max ) + "]" ); // adjust bounding box for downsampling and global coordinates for ( int d = 0; d < img.numDimensions(); ++d ) { // downsampling min[ d ] *= bb.getDownSampling(); max[ d ] *= bb.getDownSampling(); // global coordinates min[ d ] += bb.min( d ); max[ d ] += bb.min( d ); // effect of the min filter + extra space min[ d ] -= radiusMin * 3; max[ d ] += radiusMin * 3; } IOFunctions.println( "Bounding box dim global: [" + Util.printCoordinates( min ) + "] >> [" + Util.printCoordinates( max ) + "]" ); return true; }
Example 12
Source File: PhaseCorrelation2.java From BigStitcher with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { new ImageJ(); Img<FloatType> img1 = ImgLib2Util.openAs32Bit(new File("src/main/resources/img1singleplane.tif")); Img<FloatType> img2 = ImgLib2Util.openAs32Bit(new File("src/main/resources/img2singleplane.tif")); ExecutorService service = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); RandomAccessibleInterval<FloatType> pcm = calculatePCM(img1, img2, new ArrayImgFactory<FloatType>(), new FloatType(), new ArrayImgFactory<ComplexFloatType>(), new ComplexFloatType(), service ); PhaseCorrelationPeak2 shiftPeak = getShift(pcm, img1, img2); RandomAccessibleInterval<FloatType> res = PhaseCorrelation2Util.dummyFuse(img1, img2, shiftPeak,service); ImageJFunctions.show(res); }
Example 13
Source File: Align.java From BigStitcher with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { Img< FloatType > a = ImgLib2Util.openAs32Bit( new File( "73.tif.zip" ) ); Img< FloatType > b = ImgLib2Util.openAs32Bit( new File( "74.tif.zip" ) ); TranslationGet t1 = new Translation3D(); TranslationGet t2 = new Translation3D(460, 0, 0); ArrayList< Pair< RealInterval, AffineGet > > views = new ArrayList<Pair<RealInterval, AffineGet>>(); views.add( new ValuePair< RealInterval, AffineGet >( a, t1 ) ); views.add( new ValuePair< RealInterval, AffineGet >( b, t2 ) ); RealInterval overlap = BoundingBoxMaximalGroupOverlap.getMinBoundingIntervalSingle( views ); final RealInterval transformed1 = TransformTools.applyTranslation( a, t1, new boolean[] {false, false, false} ); final RealInterval transformed2 = TransformTools.applyTranslation( b, t2, new boolean[] {false, false, false} ); // get overlap in images' coordinates final RealInterval localOverlap1 = TransformTools.getLocalOverlap( transformed1, overlap ); final RealInterval localOverlap2 = TransformTools.getLocalOverlap( transformed2, overlap ); // round to integer interval final Interval interval1 = TransformTools.getLocalRasterOverlap( localOverlap1 ); final Interval interval2 = TransformTools.getLocalRasterOverlap( localOverlap2 ); //final WarpFunction warp = new TranslationWarp(3); final WarpFunction warp = new RigidWarp(3); //final WarpFunction warp = new AffineWarp( 3 ); // rotate second image AffineTransform3D rot = new AffineTransform3D(); rot.rotate( 2, 2 * Math.PI / 180 ); RandomAccessibleInterval< FloatType > rotated = Views.interval( RealViews.affine( Views.interpolate( Views.extendBorder( Views.zeroMin( Views.interval( b, interval2 ) ) ), new NLinearInterpolatorFactory<>() ), rot.copy() ), interval2); // show input new ImageJ(); ImageJFunctions.show( Views.interval( a, interval1 ), "target" ); ImageJFunctions.show( rotated, "in"); // downsample input RandomAccessibleInterval< FloatType > simple2x1 = Downsample.simple2x( Views.zeroMin( Views.interval( a, interval1 ) ), new ArrayImgFactory<>(), new boolean[] {true, true, false} ); RandomAccessibleInterval< FloatType > simple2x2 = Downsample.simple2x( Views.zeroMin( Views.interval( rotated, interval2 ) ), new ArrayImgFactory<>(), new boolean[] {true, true, false} ); // align //Align< FloatType > lk = new Align<>( Views.zeroMin( Views.interval( a, interval1 ) ), new ArrayImgFactory<>(), warp ); Align< FloatType > lk = new Align<>( simple2x1, new ArrayImgFactory<>(), warp ); //System.out.println( Util.printCoordinates( lk.align( Views.zeroMin( Views.interval( b, interval2 ) ), 100, 0.01 ).getRowPackedCopy() ) ); //final AffineTransform transform = lk.align( Views.zeroMin( rotated ), 100, 0.01 ); final AffineTransform transform = lk.align( simple2x2, 100, 0.01 ); final AffineTransform scale = new AffineTransform( 3 ); scale.set( 2, 0, 0 ); scale.set( 1, 1, 1 ); transform.preConcatenate( scale ); // transformation matrix System.out.println( Util.printCoordinates( transform.getRowPackedCopy() ) ); // correct input and show RandomAccessibleInterval< FloatType > backRotated = Views.interval( RealViews.affine( Views.interpolate( Views.extendBorder( Views.zeroMin( Views.interval( b, interval2 ) ) ), new NLinearInterpolatorFactory<>() ), rot.copy().preConcatenate( transform ).copy() ), interval2); ImageJFunctions.show( backRotated, "out" ); // constructor needs column packed matrix, therefore the transpose Matrix mt = new Matrix( transform.getRowPackedCopy(), 4).transpose(); Matrix rigid = mt.getMatrix( 0, 2, 0, 2 ); // check whether result is rotation matrix (det == +-1, orthogonal) System.out.println( rigid.det() ); System.out.println( Util.printCoordinates( rigid.times( rigid.transpose() ).getRowPackedCopy() ) ); }
Example 14
Source File: RigidWarp.java From BigStitcher with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { RandomAccessibleInterval< FloatType > a = ImgLib2Util.openAs32Bit( new File( "73.tif.zip" ) ); RandomAccessibleInterval< FloatType > b = ImgLib2Util.openAs32Bit( new File( "74.tif.zip" ) ); long slice = 40; ImageJFunctions.show( a ); a = Views.zeroMin( Views.hyperSlice( a, 2, slice )); b = Views.zeroMin( Views.hyperSlice( b, 2, slice )); TranslationGet t1 = new Translation2D(); TranslationGet t2 = new Translation2D(460, 0); ArrayList< Pair< RealInterval, AffineGet > > views = new ArrayList<Pair<RealInterval, AffineGet>>(); views.add( new ValuePair< RealInterval, AffineGet >( a, t1 ) ); views.add( new ValuePair< RealInterval, AffineGet >( b, t2 ) ); RealInterval overlap = BoundingBoxMaximalGroupOverlap.getMinBoundingIntervalSingle( views ); final RealInterval transformed1 = TransformTools.applyTranslation( a, t1, new boolean[] {false, false} ); final RealInterval transformed2 = TransformTools.applyTranslation( b, t2, new boolean[] {false, false} ); // get overlap in images' coordinates final RealInterval localOverlap1 = TransformTools.getLocalOverlap( transformed1, overlap ); final RealInterval localOverlap2 = TransformTools.getLocalOverlap( transformed2, overlap ); // round to integer interval final Interval interval1 = TransformTools.getLocalRasterOverlap( localOverlap1 ); final Interval interval2 = TransformTools.getLocalRasterOverlap( localOverlap2 ); //final WarpFunction warp = new TranslationWarp(3); final WarpFunction warp = new RigidWarp(2); //final WarpFunction warp = new AffineWarp( 3 ); // rotate second image AffineTransform2D rot = new AffineTransform2D(); rot.rotate( 1.4 * Math.PI / 180 ); RandomAccessibleInterval< FloatType > rotated = Views.interval( RealViews.affine( Views.interpolate( Views.extendMirrorSingle( Views.zeroMin( Views.interval( b, interval2 ) ) ), new NLinearInterpolatorFactory<>() ), rot.copy() ), interval2); // show input new ImageJ(); ImageJFunctions.show( Views.interval( a, interval1 ) ); ImageJFunctions.show( rotated ); // downsample input RandomAccessibleInterval< FloatType > simple2x1 = Downsample.simple2x( Views.zeroMin( Views.interval( a, interval1 ) ), new ArrayImgFactory<>(), new boolean[] {false, false} ); RandomAccessibleInterval< FloatType > simple2x2 = Downsample.simple2x( Views.zeroMin( Views.interval( rotated, interval2 ) ), new ArrayImgFactory<>(), new boolean[] {false, false} ); // align //Align< FloatType > lk = new Align<>( Views.zeroMin( Views.interval( a, interval1 ) ), new ArrayImgFactory<>(), warp ); Align< FloatType > lk = new Align<>( simple2x1, new ArrayImgFactory<>(), warp ); //System.out.println( Util.printCoordinates( lk.align( Views.zeroMin( Views.interval( b, interval2 ) ), 100, 0.01 ).getRowPackedCopy() ) ); //final AffineTransform transform = lk.align( Views.zeroMin( rotated ), 100, 0.01 ); final AffineTransform transform = lk.align( simple2x2, 100, 0.1 ); // transformation matrix System.out.println( Util.printCoordinates( transform.getRowPackedCopy() ) ); // correct input and show RandomAccessibleInterval< FloatType > backRotated = Views.interval( RealViews.affine( Views.interpolate( Views.extendMirrorSingle( Views.zeroMin( Views.interval( b, interval2 ) ) ), new NLinearInterpolatorFactory<>() ), rot.copy().preConcatenate( transform ).copy() ), interval2); ImageJFunctions.show( backRotated ); // constructor needs column packed matrix, therefore the transpose Matrix mt = new Matrix( transform.getRowPackedCopy(), 3).transpose(); Matrix rigid = mt.getMatrix( 0, 1, 0, 1 ); // check whether result is rotation matrix (det == +-1, orthogonal) System.out.println( rigid.det() ); System.out.println( Util.printCoordinates( rigid.times( rigid.transpose() ).getRowPackedCopy() ) ); }
Example 15
Source File: BlendedExtendedMirroredRandomAccesible2.java From BigStitcher with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { new ImageJ(); Img<FloatType> img1 = ImgLib2Util.openAs32Bit(new File("src/main/resources/img1.tif")); long[] dims = new long[img1.numDimensions()]; BlendedExtendedMirroredRandomAccesible2<FloatType> ext = new BlendedExtendedMirroredRandomAccesible2<FloatType>(img1, new int[]{100, 100, 10}); ext.getExtInterval().dimensions(dims); Img<FloatType> img2 = ArrayImgs.floats(dims); // TODO: For efficiency reasons we should now also iterate the BlendedExtendedMirroredRandomAccesible and not the image long start = System.currentTimeMillis(); Cursor<FloatType> c = img2.cursor(); for (FloatType e : Views.iterable(Views.interval(ext, ext.getExtInterval()))) { c.fwd(); c.get().set(e); } long end = System.currentTimeMillis(); System.out.println(end-start); ImageJFunctions.show(img2); //RandomAccessibleInterval<FloatType> img3 = Views.interval(ext, ext.getExtInterval()); //ImageJFunctions.show(img3); }
Example 16
Source File: ContentBased.java From SPIM_Registration with GNU General Public License v2.0 | 3 votes |
public static void main( String[] args ) throws IncompatibleTypeException { new ImageJ(); ImagePlus imp = new ImagePlus( "/Users/preibischs/workspace/TestLucyRichardson/src/resources/dros-1.tif" ); Img< FloatType > img = ImageJFunctions.wrap( imp ); final double[] sigma1 = new double[]{ 20, 20 }; final double[] sigma2 = new double[]{ 30, 30 }; ContentBased< FloatType > cb = new ContentBased<FloatType>( img, img.factory().imgFactory( new ComplexFloatType() ), sigma1, sigma2 ); ImageJFunctions.show( cb.getContentBasedImg() ); }
Example 17
Source File: DisplayOverlapTestPopup.java From BigStitcher with GNU General Public License v2.0 | 2 votes |
@Override public void actionPerformed(ActionEvent e) { final SpimData spimData = (SpimData)panel.getSpimData(); List<List< ViewId >> views = ((GroupedRowWindow) panel).selectedRowsViewIdGroups(); BoundingBoxMaximalGroupOverlap< ViewId > bbDet = new BoundingBoxMaximalGroupOverlap<>( views, spimData ); BoundingBox bbOverlap = bbDet.estimate( "max overlap" ); System.out.println( "Overlap BB: " + Util.printInterval( bbOverlap ) ); GenericDialog gd = new GenericDialog( "Virtual Fusion" ); gd.addNumericField( "Downsampling", 1, 0 ); gd.showDialog(); if ( gd.wasCanceled() ) return; double downsampling = gd.getNextNumber(); //DisplayImage.getImagePlusInstance( new FusedRandomAccessibleInterval( new FinalInterval( dim ), images, weights ), true, "Fused, Virtual", 0, 255 ).show(); List<RandomAccessibleInterval< FloatType >> raiOverlaps = new ArrayList<>(); for (List< ViewId > tileViews : views) { List<List< ViewId >> wrapped = tileViews.stream().map( v -> { ArrayList< ViewId > wrp = new ArrayList<ViewId>(); wrp.add( v ); return wrp;} ).collect( Collectors.toList() ); List< RandomAccessibleInterval< FloatType > > openFused = openVirtuallyFused( spimData.getSequenceDescription(), spimData.getViewRegistrations(), wrapped, bbOverlap, new double[]{downsampling,downsampling,downsampling} ); GroupedViewAggregator gva = new GroupedViewAggregator(); gva.addAction( ActionType.AVERAGE, Channel.class, null ); gva.addAction( ActionType.PICK_BRIGHTEST, Illumination.class, null ); RandomAccessibleInterval< FloatType > raiI = gva.aggregate( openFused, views.stream().map( v -> v.iterator().next() ).collect( Collectors.toList() ), spimData.getSequenceDescription() ); raiOverlaps.add(raiI); } for (RandomAccessibleInterval< FloatType > rai : raiOverlaps) ImageJFunctions.show( rai ); RandomAccessibleInterval< FloatType > rai1 = raiOverlaps.get(0); RandomAccessibleInterval< FloatType > rai2 = raiOverlaps.get(1); //rai1 = ImageJFunctions.wrapFloat( ImageJFunctions.show( rai1 ).duplicate()); //rai2 = ImageJFunctions.wrapFloat( ImageJFunctions.show( rai2 ).duplicate()); ExecutorService service = Executors.newFixedThreadPool( Runtime.getRuntime().availableProcessors() * 2 ); Pair< Translation, Double > shift = PairwiseStitching.getShift( rai1, rai2, new Translation( rai1.numDimensions() ), new Translation( rai1.numDimensions() ), PairwiseStitchingParameters.askUserForParameters(), service ); final double[] translation = shift.getA().getTranslationCopy(); System.out.println( Util.printCoordinates( translation ) ); System.out.println( shift.getB() ); for (int d = 0; d <translation.length; d++) translation[d] *= downsampling; System.out.println( spimData.getViewRegistrations().getViewRegistration( views.get( 1 ).get( 0 ) ).getModel().copy().concatenate( new Translation(translation) ) ); }