@Override public ImagePlusImgFactory< T > factory() { return new ImagePlusImgFactory< T >(); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public <S> ImgFactory<S> imgFactory( final S type ) throws IncompatibleTypeException { if ( NativeType.class.isInstance( type ) ) return new ImagePlusImgFactory(); throw new IncompatibleTypeException( this, type.getClass().getCanonicalName() + " does not implement NativeType." ); } }
/** * Create a {@link ByteImagePlus}<{@link UnsignedByteType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ByteProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ByteImagePlus< UnsignedByteType > unsignedBytes( final long... dim ) { return ( ByteImagePlus< UnsignedByteType > )new ImagePlusImgFactory< UnsignedByteType >().create( dim, new UnsignedByteType() ); }
/** * Create a {@link ByteImagePlus}<{@link ByteType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ByteProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ByteImagePlus< ByteType > bytes( final long... dim ) { return ( ByteImagePlus< ByteType > )new ImagePlusImgFactory< ByteType >().create( dim, new ByteType() ); }
/** * Create a {@link IntImagePlus}<{@link IntType}>. * * <p>(In ImageJ that would be a hyperstack of {@link ColorProcessor}s. * The integers, however, would be displayed as ARGB unsigned byte channels * and thus look weird.)</p> */ @SuppressWarnings( "unchecked" ) final static public IntImagePlus< IntType > ints( final long... dim ) { return ( IntImagePlus< IntType > )new ImagePlusImgFactory< IntType >().create( dim, new IntType() ); }
/** * Create an {@link IntImagePlus}<{@link ARGBType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ColorProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public IntImagePlus< ARGBType > argbs( final long... dim ) { return ( IntImagePlus< ARGBType > )new ImagePlusImgFactory< ARGBType >().create( dim, new ARGBType() ); }
/** * Create a {@link ShortImagePlus}<{@link ShortType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ShortProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ShortImagePlus< ShortType > shorts( final long... dim ) { return ( ShortImagePlus< ShortType > )new ImagePlusImgFactory< ShortType >().create( dim, new ShortType() ); }
/** * Create a {@link FloatImagePlus}<{@link ComplexFloatType}>. * * <p>(In ImageJ that would be a hyperstack of {@link FloatProcessor}s * with real and imaginary numbers interleaved in the plane. That means it * would look weird.)</p> */ @SuppressWarnings( "unchecked" ) final static public FloatImagePlus< ComplexFloatType > complexFloats( final long... dim ) { return ( FloatImagePlus< ComplexFloatType > )new ImagePlusImgFactory< ComplexFloatType >().create( dim, new ComplexFloatType() ); }
/** * Create a {@link ShortImagePlus}<{@link UnsignedShortType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ShortProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ShortImagePlus< UnsignedShortType > unsignedShorts( final long... dim ) { return ( ShortImagePlus< UnsignedShortType > )new ImagePlusImgFactory< UnsignedShortType >().create( dim, new UnsignedShortType() ); }
/** * Create a {@link IntImagePlus}<{@link UnsignedIntType}>. * * <p>(In ImageJ that would be a hyperstack of {@link ColorProcessor}s. * The integers, however, would be displayed as ARGB unsigned byte channels * and thus look weird.)</p> */ @SuppressWarnings( "unchecked" ) final static public IntImagePlus< UnsignedIntType > unsignedInts( final long... dim ) { return ( IntImagePlus< UnsignedIntType > )new ImagePlusImgFactory< UnsignedIntType >().create( dim, new UnsignedIntType() ); }
/** * Create an {@link FloatImagePlusImg}<{@link FloatType}>. * * <p>(in ImageJ that would be a hyperstack of {@link FloatProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public FloatImagePlus< FloatType > floats( final long... dim ) { return ( FloatImagePlus< FloatType > )new ImagePlusImgFactory< FloatType >().create( dim, new FloatType() ); }
final RandomAccessibleInterval< FloatType > fusedImg = FusionTools.copyImg( virtual, new ImagePlusImgFactory<>(), new FloatType(), null, true );
public static ImagePlus display( final RandomAccessibleInterval< FloatType > input, final ImgDataType imgType, final double min, final double max, final int[] cellDim, final int maxCacheSize ) { final RandomAccessibleInterval< FloatType > img; if ( imgType == ImgDataType.CACHED ) img = cacheRandomAccessibleInterval( input, maxCacheSize, new FloatType(), cellDim ); else if ( imgType == ImgDataType.PRECOMPUTED ) img = copyImg( input, new ImagePlusImgFactory<>(), new FloatType(), null, true ); else img = input; // set ImageJ title according to fusion type final String title = imgType == ImgDataType.CACHED ? "Fused, Virtual (cached) " : (imgType == ImgDataType.VIRTUAL ? "Fused, Virtual" : "Fused" ); return DisplayImage.getImagePlusInstance( img, true, title, min, max ); }
bb.dimensions( size ); final RandomAccessibleInterval< FloatType > fusedImg = FusionTools.copyImg( virtual, new ImagePlusImgFactory<>(), new FloatType(), null, true ); final RandomAccessibleInterval< FloatType > fusedBalancedImg = FusionTools.copyImg( virtualBalanced, new ImagePlusImgFactory<>(), new FloatType(), null, true );
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; } }
final ImgFactory<T> f = new ImagePlusImgFactory< T >();
protected static < T extends RealType< T > & NativeType< T > > boolean export( final RandomAccessibleInterval< T > output, final ExecutorService taskExecutor, final T type, final QualityGUI quality, final ImgExport exporter, final Group< ViewDescription > group, final double[] minmax ) { final RandomAccessibleInterval< T > processedOutput = FusionTools.copyImg( output, new ImagePlusImgFactory< T >(), type, taskExecutor, true ); final String title = Image_Fusion.getTitle( quality.getSplittingType(), group ); if ( minmax == null ) return exporter.exportImage( processedOutput, quality.getBoundingBox(), quality.getDownsampling(), quality.getAnisotropyFactor(), title, group ); else return exporter.exportImage( processedOutput, quality.getBoundingBox(), quality.getDownsampling(), quality.getAnisotropyFactor(), title, group, minmax[ 0 ], minmax[ 1 ] ); }
protected static < T extends RealType< T > & NativeType< T > > boolean cacheAndExport( final RandomAccessibleInterval< T > output, final ExecutorService taskExecutor, final T type, final FusionGUI fusion, final ImgExport exporter, final Group< ViewDescription > group, final double[] minmax ) { final RandomAccessibleInterval< T > processedOutput; if ( fusion.getCacheType() == 0 ) // Virtual processedOutput = output; else if ( fusion.getCacheType() == 1 ) // Cached processedOutput = FusionTools.cacheRandomAccessibleInterval( output, FusionGUI.maxCacheSize, type, FusionGUI.cellDim ); else // Precomputed processedOutput = FusionTools.copyImg( output, new ImagePlusImgFactory< T >(), type, taskExecutor, true ); final String title = getTitle( fusion.getSplittingType(), group ); if ( minmax == null ) return exporter.exportImage( processedOutput, fusion.getBoundingBox(), fusion.getDownsampling(), fusion.getAnisotropyFactor(), title, group ); else return exporter.exportImage( processedOutput, fusion.getBoundingBox(), fusion.getDownsampling(), fusion.getAnisotropyFactor(), title, group, minmax[ 0 ], minmax[ 1 ] ); }
il.setImgFactory( new ImagePlusImgFactory< FloatType >());
final ImagePlusImgFactory< ARGBType > factory = new ImagePlusImgFactory< ARGBType >();