@Override public NativeImg< T, ShortArray > createShortInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ShortImagePlus< T >( dimensions, entitiesPerPixel ); }
public static ShortImagePlus<UnsignedShortType> wrapShort( final ImagePlus imp ) { if ( imp.getType() != ImagePlus.GRAY16) return null; final ShortImagePlus< UnsignedShortType > container = new ShortImagePlus< UnsignedShortType >( imp ); // create a Type that is linked to the container final UnsignedShortType linkedType = new UnsignedShortType( container ); // pass it to the DirectAccessContainer container.setLinkedType( linkedType ); return container; }