@Override public NativeImg< T, LongArray > createLongInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ImagePlusImg< T, LongArray >( new LongArray( 1 ), dimensions, entitiesPerPixel ); }
protected ImagePlusImg( final int width, final int height, final int depth, final int frames, final int channels, final int entitiesPerPixel ) { super( reduceDimensions( new long[] { width, height, channels, depth, frames } ), entitiesPerPixel ); this.width = width; this.height = height; this.depth = depth; this.frames = frames; this.channels = channels; }
final ImagePlus outImp = ((ImagePlusImg<?,?>)outputSlice).getImagePlus(); final FileSaver fs = new FileSaver( outImp ); fs.saveAsTiff( new File( outputDirectory, "img_t" + lz( t, numTimePoints ) + "_z" + lz( slice+1, numSlices ) + "_c" + lz( c, numChannels ) ).getAbsolutePath() );
protected static < T extends Type< T > > Img< FloatType > convertToFloat( final Img< T > input, final Converter< T, FloatType > c ) { final ImagePlusImg< FloatType, ? > output = new ImagePlusImgFactory< FloatType >().create( input, new FloatType() ); final Cursor< T > in = input.cursor(); final Cursor< FloatType > out = output.cursor(); while ( in.hasNext() ) { in.fwd(); out.fwd(); c.convert(in.get(), out.get()); } return output; } }
fusionImp[0] = ((ImagePlusImg<?, ?>) output).getImagePlus(); fusionImp[0].setTitle("fusing..."); fusionImp[0].show();
try final ImagePlus outImp = ((ImagePlusImg<?,?>)out).getImagePlus(); for ( int z = 1; z <= out.dimension( 2 ); ++z ) stack.addSlice( imp.getTitle(), outImp.getStack().getProcessor( z ) );
@Override public NativeImg< T, BitArray > createBitInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ImagePlusImg< T, BitArray >( new BitArray( 1 ), dimensions, entitiesPerPixel ); }
/** * Compute the minimal required number of dimensions for a given * {@link ImagePlus}, whereas width and height are always first. * * E.g. a gray-scale 2d time series would have three dimensions * [width,height,frames], a gray-scale 3d stack [width,height,depth] and a * 2d composite image [width,height,channels] as well. A composite 3d * stack has four dimensions [width,height,channels,depth], as a time * series five [width,height,channels,depth,frames]. */ protected static long[] reduceDimensions( final ImagePlus imp ) { final int[] dimensions = imp.getDimensions(); final long[] impDimensions = new long[ dimensions.length ]; for ( int d = 0; d < dimensions.length; ++d ) impDimensions[ d ] = dimensions[ d ]; return reduceDimensions( impDimensions ); }
fusionImp = ((ImagePlusImg<?, ?>) output).getImagePlus(); fusionImp.setTitle( "fusing..." ); fusionImp.show();
@Override public NativeImg< T, CharArray > createCharInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ImagePlusImg< T, CharArray >( new CharArray( 1 ), dimensions, entitiesPerPixel ); }
@SuppressWarnings("unchecked") public static < T extends RealType< T > & NativeType< T > > ImagePlus getImagePlusInstance( final RandomAccessibleInterval< T > img, final boolean virtualDisplay, final String title, final double min, final double max ) { ImagePlus imp = null; if ( img instanceof ImagePlusImg ) try { imp = ((ImagePlusImg<T, ?>)img).getImagePlus(); } catch (ImgLibException e) {} if ( imp == null ) { if ( virtualDisplay ) imp = ImageJFunctions.wrap( img, title, DeconViews.createExecutorService() ); else imp = ImageJFunctions.wrap( img, title, DeconViews.createExecutorService() ).duplicate(); } final double[] minmax = getFusionMinMax( img, min, max ); imp.setTitle( title ); imp.setDimensions( 1, (int)img.dimension( 2 ), 1 ); imp.setDisplayRange( minmax[ 0 ], minmax[ 1 ] ); return imp; }
@Override public NativeImg< T, DoubleArray > createDoubleInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ImagePlusImg< T, DoubleArray >( new DoubleArray( 1 ), dimensions, entitiesPerPixel ); }
img.getImagePlus().show();
try impVis = img.getImagePlus(); ipVis = ( ColorProcessor )impVis.getProcessor(); while ( ipVis.getWidth() > meshResolution * minGridSize )
final ImagePlus outImp = ((ImagePlusImg<?, ?>)out).getImagePlus(); for ( int z = 1; z <= out.dimension( 2 ); ++z ) stack.addSlice( "", outImp.getStack().getProcessor( z ) );
final ImagePlus outImp = ((ImagePlusImg<?,?>)out).getImagePlus(); for ( int z = 1; z <= out.dimension( 2 ); ++z ) stack.addSlice( imp.getTitle(), outImp.getStack().getProcessor( z ) );