/** * Transforms an ROI using an imaging operation. The operation is * specified by a <code>RenderedImageFactory</code>. The * operation's <code>ParameterBlock</code>, minus the image source * itself is supplied, along with an index indicating where to * insert the ROI image. The <code>renderHints</code> argument * allows rendering hints to be passed in. * * @param RIF A <code>RenderedImageFactory</code> that will be used * to create the op. * @param paramBlock A <code>ParameterBlock</code> containing all * sources and parameters for the op except for the ROI itself. * @param sourceIndex The index of the <code>ParameterBlock</code>'s * sources where the ROI is to be inserted. * @param renderHints A <code>RenderingHints</code> object containing * rendering hints, or null. * @throws IllegalArgumentException if RIF is null. * @throws IllegalArgumentException if paramBlock is null. */ public ROI performImageOp(RenderedImageFactory RIF, ParameterBlock paramBlock, int sourceIndex, RenderingHints renderHints) { if ( RIF == null || paramBlock == null ) { throw new IllegalArgumentException(JaiI18N.getString("Generic0")); } // Clone the ParameterBlock and insert a source ParameterBlock pb = (ParameterBlock) paramBlock.clone(); Vector sources = pb.getSources(); sources.insertElementAt(this.getAsImage(), sourceIndex); // Create a new RenderedImage based on the RIF // and ParameterBlock. RenderedImage im = RIF.create(pb, renderHints); return new ROI(im, threshold); }
public synchronized static void register( final boolean force ) { if (!registered || force) { final OperationRegistry registry = JAI.getDefaultInstance().getOperationRegistry(); final RenderedImageFactory rif = new WarpRIF(); registry.registerFactory( RenderedRegistryMode.MODE_NAME, "Warp", "it.geosolutions.jaiext", rif); registered = true; } }
/** * Registers a RIF with a particular product and operation. * * @param operationName the operation name as a String. * @param productName the product name, as a String. * @param RIF the <code>RenderedImageFactory</code> to be registered. * * @deprecated as of JAI 1.1 in favor of <code>RIFRegistry.register(...) * </code>. This is currently equivalent to <code> * RIFRegistry.register(this, operationName, productName, RIF)</code> * * @see #registerFactory registerFactory - for list of exceptions thrown. * @see RIFRegistry#register */ public void registerRIF(String operationName, String productName, RenderedImageFactory RIF) { registerFactory(RenderedRegistryMode.MODE_NAME, operationName, productName, RIF); }
/** * Unregisters a RIF from a particular product and operation. * * @param operationName the operation name as a String. * @param productName the product name, as a String. * @param RIF the <code>RenderedImageFactory</code> to be unregistered. * * @deprecated as of JAI 1.1 in favor of <code>RIFRegistry.unregister(...) * </code>. This is currently equivalent to <code> * RIFRegistry.unregister(this, operationName, productName, RIF)</code> * * @see #unregisterFactory unregisterFactory - for list of exceptions thrown. * @see RIFRegistry#unregister */ public void unregisterRIF(String operationName, String productName, RenderedImageFactory RIF) { unregisterFactory(RenderedRegistryMode.MODE_NAME, operationName, productName, RIF); }
/** * Sets a preference between two RIFs within the same product. Any * attempt to set a preference between a RIF and itself will be * ignored. * * @param operationName the operation name as a String. * @param productName the name of the product. * @param preferredRIF the preferred <code>RenderedImageFactory</code>. * @param otherRIF the other <code>RenderedImageFactory</code>. * * @deprecated as of JAI 1.1 in favor of <code>RIFRegistry.setPreference(...) * </code>. This is currently equivalent to <code> * RIFRegistry.setPreference(this, operationName, productName, * preferredRIF, otherRIF)</code> * * @see #setFactoryPreference setFactoryPreference - for list of exceptions thrown. * @see RIFRegistry#setPreference */ public void setRIFPreference(String operationName, String productName, RenderedImageFactory preferredRIF, RenderedImageFactory otherRIF) { setFactoryPreference(RenderedRegistryMode.MODE_NAME, operationName, productName, preferredRIF, otherRIF); }
/** * Removes a preference between two RIFs within the same product. * * @param operationName the operation name as a String. * @param productName the name of the product. * @param preferredRIF the formerly preferred * <code>RenderedImageFactory</code>. * @param otherRIF the other <code>RenderedImageFactory</code>. * * @deprecated as of JAI 1.1 in favor of <code>RIFRegistry.unsetPreference(...) * </code>. This is currently equivalent to <code> * RIFRegistry.unsetPreference(this, operationName, productName, * preferredRIF, otherRIF)</code> * * @see #unsetFactoryPreference unsetFactoryPreference - for list of exceptions thrown. * @see RIFRegistry#unsetPreference */ public void unsetRIFPreference(String operationName, String productName, RenderedImageFactory preferredRIF, RenderedImageFactory otherRIF) { unsetFactoryPreference(RenderedRegistryMode.MODE_NAME, operationName, productName, preferredRIF, otherRIF); }
/** * Register a RIF with a particular product and operation * against a specified mode. This is JAI 1.0.x equivalent * of <code>registry.registerRIF(...)</code> * * @param registry the <code>OperationRegistry</code> to register with. * if this is <code>null</code>, then <code> * JAI.getDefaultInstance().getOperationRegistry()</code> * will be used. * @param operationName the operation name as a <code>String</code> * @param productName the product name as a <code>String</code> * @param rif the <code>RenderedImageFactory</code> to be registered * * @throws IllegalArgumentException if operationName, productName, * or rif is <code>null</code> * @throws IllegalArgumentException if there is no <code> * OperationDescriptor</code> registered against * the <code>operationName</code> */ public static void register(OperationRegistry registry, String operationName, String productName, RenderedImageFactory rif) { registry = (registry != null) ? registry : JAI.getDefaultInstance().getOperationRegistry(); registry.registerFactory(MODE_NAME, operationName, productName, rif); }
/** * Unregister a RIF previously registered with a product * and operation against the specified mode. * * @param registry the <code>OperationRegistry</code> to unregister from. * if this is <code>null</code>, then <code> * JAI.getDefaultInstance().getOperationRegistry()</code> * will be used. * @param operationName the operation name as a <code>String</code> * @param productName the product name as a <code>String</code> * @param rif the <code>RenderedImageFactory</code> to be unregistered * * @throws IllegalArgumentException if operationName, productName, * or rif is <code>null</code> * @throws IllegalArgumentException if there is no <code> * OperationDescriptor</code> registered against * the <code>operationName</code> * @throws IllegalArgumentException if the rif was not previously * registered against operationName and productName */ public static void unregister(OperationRegistry registry, String operationName, String productName, RenderedImageFactory rif) { registry = (registry != null) ? registry : JAI.getDefaultInstance().getOperationRegistry(); registry.unregisterFactory(MODE_NAME, operationName, productName, rif); }
/** * Sets a preference between two rifs for a given operation under a * specified product. * * @param registry the <code>OperationRegistry</code> to use. * if this is <code>null</code>, then <code> * JAI.getDefaultInstance().getOperationRegistry()</code> * will be used. * @param operationName the operation name as a <code>String</code> * @param productName the product name as a <code>String</code> * @param preferredRIF the preferred rif * @param otherRIF the other rif * * @throws IllegalArgumentException if operationName, productName, * preferredRIF or otherRIF is <code>null</code> * @throws IllegalArgumentException if there is no <code> * OperationDescriptor</code> registered against * the <code>operationName</code> * @throws IllegalArgumentException if either of the rifs * were not previously registered against * operationName and productName */ public static void setPreference(OperationRegistry registry, String operationName, String productName, RenderedImageFactory preferredRIF, RenderedImageFactory otherRIF) { registry = (registry != null) ? registry : JAI.getDefaultInstance().getOperationRegistry(); registry.setFactoryPreference(MODE_NAME, operationName, productName, preferredRIF, otherRIF); }
/** * Unsets a preference between two rifs for a given operation under * a specified product. * * @param registry the <code>OperationRegistry</code> to use. * if this is <code>null</code>, then <code> * JAI.getDefaultInstance().getOperationRegistry()</code> * will be used. * @param operationName the operation name as a <code>String</code> * @param productName the product name as a <code>String</code> * @param preferredRIF the factory object formerly preferred * @param otherRIF the other factory object * * @throws IllegalArgumentException if operationName, productName, * preferredRIF or otherRIF is <code>null</code> * @throws IllegalArgumentException if there is no <code> * OperationDescriptor</code> registered against * the <code>operationName</code> * @throws IllegalArgumentException if either of the rifs * were not previously registered against * operationName and productName */ public static void unsetPreference(OperationRegistry registry, String operationName, String productName, RenderedImageFactory preferredRIF, RenderedImageFactory otherRIF) { registry = (registry != null) ? registry : JAI.getDefaultInstance().getOperationRegistry(); registry.unsetFactoryPreference(MODE_NAME, operationName, productName, preferredRIF, otherRIF); }
/** * Returns the the most preferred <code>RenderedImageFactory</code> * object registered against the operation name. This * method will return the first object that would be * encountered by the <code>Iterator</code> returned by the * <code>getIterator()</code> method. * * @param registry the <code>OperationRegistry</code> to use. * if this is <code>null</code>, then <code> * JAI.getDefaultInstance().getOperationRegistry()</code> * will be used. * @param operationName the operation name as a <code>String</code> * * @return a registered <code>RenderedImageFactory</code> object * * @throws IllegalArgumentException if operationName is <code>null</code> * @throws IllegalArgumentException if there is no <code> * OperationDescriptor</code> registered against * the <code>operationName</code> */ public static RenderedImageFactory get(OperationRegistry registry, String operationName) { registry = (registry != null) ? registry : JAI.getDefaultInstance().getOperationRegistry(); return (RenderedImageFactory) registry.getFactory(MODE_NAME, operationName); }