Java Doc for MosaicDescriptor.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » media » jai » operator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » javax.media.jai.operator 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.media.jai.OperationDescriptorImpl
      javax.media.jai.operator.MosaicDescriptor

MosaicDescriptor
public class MosaicDescriptor extends OperationDescriptorImpl (Code)
An OperationDescriptor describing the "Mosaic" operation in the rendered mode.

The "Mosaic" operation creates a mosaic of two or more source images. This operation could be used for example to assemble a set of overlapping geospatially rectified images into a contiguous image. It could also be used to create a montage of photographs such as a panorama.

All source images are assumed to have been geometrically mapped into a common coordinate space. The origin (minX, minY) of each image is therefore taken to represent the location of the respective image in the common coordinate system of the source images. This coordinate space will also be that of the destination image.

All source images must have the same data type and sample size for all bands. The destination will have the same data type, sample size, and number of bands and color components as the sources.

The destination layout may be specified by an ImageLayout hint provided via a RenderingHints supplied to the operation. If this hint contains a setting for the image bounds (origin and dimensions), it will be used even if it does not intersect the union of the bounds of the sources; otherwise the image bounds will be set to the union of all source image bounds. If the data type or sample size specified by the layout hint do not match those of the sources, then this portion of the hint will be ignored.

It is permissible that the number of source images be initially zero. In this case a non-null ImageLayout must be supplied with valid width and height and a non-null SampleModel. The destination data type, sample size, number of bands, and image bounds will all be determined by the ImageLayout.

If sourceAlpha is non-null, then any non- null elements of the array must be single-band images with the same data type and sample size as the sources.

The source threshold array parameter has maximum dimensions as double[NUM_SOURCES][NUM_BANDS]. Default values of the thresholds actually used are defined as follows:

  • The default value of sourceThreshold[0][0] is 1.0.
  • If sourceThreshold[i] != null and sourceThreshold[i].length < NUM_BANDS, then set sourceThreshold[i][j] = sourceThreshold[i][0] for all 1 <= j < NUM_BANDS.
  • If sourceThreshold[i] == null then set sourceThreshold[i] = sourceThreshold[0].

The background value array parameter has maximum dimensions as double[NUM_BANDS]. Default values of the background actually used are defined as follows:

  • The default value of backgroundValues[0] is 0.0.
  • If backgroundValues.length < NUM_BANDS, then set backgroundValues[j] = backgroundValues[0] for all 1 <= j < NUM_BANDS.
The default behavior therefore is to set the background to zero.

If a given destination position (x, y) is within the bounds of M source images, then the destination pixel value D(x, y) is computed using an algorithm selected on the basis of the mosaicType parameter value. If the destination position is not within any source image, then the destination pixel value is set to the specified background value.

If the mosaicType parameter value is MOSAIC_TYPE_BLEND, then the destination pixel value is computed as:

 double[][][] s; // source pixel values
 double[][][] w; // derived source weight values
 double[][] d;   // destination pixel values
 double weightSum = 0.0;
 for(int i = 0; i < M; i++) {
 weightSum += w[i][x][y];
 }
 if(weightSum != 0.0) {
 double sourceSum = 0.0;
 for(int i = 0; i < M; i++) {
 sourceSum += s[i][x][y]*w[i][x][y];
 }
 d[x][y] = sourceSum / weightSum;
 } else {
 d[x][y] = background;
 }
 
where the index i is over the sources which contain (x, y). The destination pixel value is therefore a blend of the source pixel values at the same position.

If the mosaicType parameter value is MOSAIC_TYPE_OVERLAY, then the destination pixel value is computed as:

 d[x][y] = background;
 for(int i = 0; i < M; i++) {
 if(w[i][x][y] != 0.0) {
 d[x][y] = s[i][x][y];
 break;
 }
 }
 
The destination pixel value is therefore the value of the first source pixel at the same position for which the derived weight value at the same position is non-zero.

The derived weight values for the ith source are determined from the corresponding sourceAlpha, sourceROI, and sourceThreshold parameters as follows where for illustration purposes it is assumed that any alpha values range over [0.0, 1.0] with 1.0 being opaque:

 // Set flag indicating whether to interpret alpha values as bilevel.
 boolean isAlphaBitmask =
 !(mosaicType.equals(MOSAIC_TYPE_BLEND) &&
 sourceAlpha != null &&
 !(sourceAlpha.length < NUM_SOURCES));
 if(!isAlphaBitmask) {
 for(int i = 0; i < NUM_SOURCES; i++) {
 if(sourceAlpha[i] == null) {
 isAlphaBitmask = true;
 break;
 }
 }
 }
 // Derive source weights from the supplied parameters.
 w[i][x][y] = 0.0;
 if(sourceAlpha != null && sourceAlpha[i] != null) {
 w[i][x][y] = sourceAlpha[i][x][y];
 if(isAlphaBitmask && w[i][x][y] > 0.0) {
 w[i][x][y] = 1.0;
 }
 } else if(sourceROI != null && sourceROI[i] != null &&
 sourceROI[i].contains(x,y)) {
 w[i][x][y] = 1.0;
 } else if(s[i][x][y] >= sourceThreshold[i]) { // s[i][x][y] = source value
 w[i][x][y] = 1.0;
 }
 

As illustrated above, the interpretation of the alpha values will vary depending on the values of the parameters supplied to the operation. If and only if mosaicType equals MOSAIC_TYPE_BLEND and an alpha mask is available for each source will the alpha values be treated as arbitrary values as for Transparency.TRANSLUCENT . In all other cases the alpha values will be treated as bilevel values as for Transparency.BITMASK .

It should be remarked that the MOSAIC_TYPE_BLEND algorithm applied when the weights are treated as bilevel values is equivalent to averaging all non-transparent source pixels at a given position. This in effect intrinsically provides a third category of mosaicking. The available categories are summarized in the following table.
Mosaic Categories
Mosaic Type Transparency Type Category
MOSAIC_TYPE_BLEND BITMASK Average
MOSAIC_TYPE_BLEND TRANSLUCENT Alpha Blend
MOSAIC_TYPE_OVERLAY BITMASK || TRANSLUCENT Superposition

Resource List
Name Value
GlobalName Mosaic
LocalName Mosaic
Vendor com.sun.media.jai
Description Creates a mosaic of two or more rendered images.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/MosaicDescriptor.html
Version 1.0
arg0Desc Mosaicking type.
arg1Desc Source alpha masks.
arg2Desc Source region of interest masks.
arg3Desc Source threshold values.
arg4Desc Destination background value.

Parameter List
Name Class Type Default Value
mosaicType javax.media.jai.operator.MosaicType MOSAIC_TYPE_OVERLAY
sourceAlpha javax.media.jai.PlanarImage[] null
sourceROI javax.media.jai.ROI[] null
sourceThreshold double[][] double[][] {{1.0}}
backgroundValues double[] double[] {0.0}


since:
   JAI 1.1.2


Field Summary
final public static  MosaicTypeMOSAIC_TYPE_BLEND
     Destination pixel equals alpha blend of source pixels.
final public static  MosaicTypeMOSAIC_TYPE_OVERLAY
     Destination pixel equals first opaque source pixel.

Constructor Summary
public  MosaicDescriptor()
     Constructor.

Method Summary
public static  RenderedOpcreate(RenderedImage[] sources, MosaicType mosaicType, PlanarImage[] sourceAlpha, ROI[] sourceROI, double[][] sourceThreshold, double[] backgroundValues, RenderingHints hints)
     Creates a mosaic of two or more rendered images.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(StringParameterBlockRenderingHints) .
See Also:   JAI
See Also:   ParameterBlockJAI
See Also:   RenderedOp
Parameters:
  sources - RenderedImage sources.
Parameters:
  mosaicType - Mosaicking type.May be null.
Parameters:
  sourceAlpha - May be null.
Parameters:
  sourceAlpha - Source alpha masks.May be null.
Parameters:
  sourceROI - Source region of interest masks.May be null.
Parameters:
  sourceThreshold - Source threshold values.May be null.
Parameters:
  backgroundValues - Destination background value.May be null.
Parameters:
  hints - The RenderingHints to use.May be null.


Field Detail
MOSAIC_TYPE_BLEND
final public static MosaicType MOSAIC_TYPE_BLEND(Code)
Destination pixel equals alpha blend of source pixels.



MOSAIC_TYPE_OVERLAY
final public static MosaicType MOSAIC_TYPE_OVERLAY(Code)
Destination pixel equals first opaque source pixel.




Constructor Detail
MosaicDescriptor
public MosaicDescriptor()(Code)
Constructor.




Method Detail
create
public static RenderedOp create(RenderedImage[] sources, MosaicType mosaicType, PlanarImage[] sourceAlpha, ROI[] sourceROI, double[][] sourceThreshold, double[] backgroundValues, RenderingHints hints)(Code)
Creates a mosaic of two or more rendered images.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(StringParameterBlockRenderingHints) .
See Also:   JAI
See Also:   ParameterBlockJAI
See Also:   RenderedOp
Parameters:
  sources - RenderedImage sources.
Parameters:
  mosaicType - Mosaicking type.May be null.
Parameters:
  sourceAlpha - May be null.
Parameters:
  sourceAlpha - Source alpha masks.May be null.
Parameters:
  sourceROI - Source region of interest masks.May be null.
Parameters:
  sourceThreshold - Source threshold values.May be null.
Parameters:
  backgroundValues - Destination background value.May be null.
Parameters:
  hints - The RenderingHints to use.May be null. The RenderedOp destination.
throws:
  IllegalArgumentException - if any source is null.




Fields inherited from javax.media.jai.OperationDescriptorImpl
final protected String[][] resources(Code)(Java Doc)
final protected String[] sourceNames(Code)(Java Doc)
final protected String[] supportedModes(Code)(Java Doc)

Methods inherited from javax.media.jai.OperationDescriptorImpl
public boolean arePropertiesSupported()(Code)(Java Doc)
protected static Class getDefaultSourceClass(String modeName)(Code)(Java Doc)
public Class getDestClass(String modeName)(Code)(Java Doc)
public Class getDestClass()(Code)(Java Doc)
public Object getInvalidRegion(String modeName, ParameterBlock oldParamBlock, RenderingHints oldHints, ParameterBlock newParamBlock, RenderingHints newHints, OperationNode node)(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public int getNumParameters()(Code)(Java Doc)
public int getNumSources()(Code)(Java Doc)
public Class[] getParamClasses()(Code)(Java Doc)
public Object getParamDefaultValue(int index)(Code)(Java Doc)
public Object[] getParamDefaults()(Code)(Java Doc)
public Number getParamMaxValue(int index)(Code)(Java Doc)
public Number getParamMinValue(int index)(Code)(Java Doc)
public String[] getParamNames()(Code)(Java Doc)
public ParameterListDescriptor getParameterListDescriptor(String modeName)(Code)(Java Doc)
public PropertyGenerator[] getPropertyGenerators(String modeName)(Code)(Java Doc)
public PropertyGenerator[] getPropertyGenerators()(Code)(Java Doc)
public Class getRenderableDestClass()(Code)(Java Doc)
public Class[] getRenderableSourceClasses()(Code)(Java Doc)
public ResourceBundle getResourceBundle(Locale locale)(Code)(Java Doc)
public String[][] getResources(Locale locale)(Code)(Java Doc)
public Class[] getSourceClasses(String modeName)(Code)(Java Doc)
public Class[] getSourceClasses()(Code)(Java Doc)
public String[] getSourceNames()(Code)(Java Doc)
public String[] getSupportedModes()(Code)(Java Doc)
public boolean isImmediate()(Code)(Java Doc)
public boolean isModeSupported(String modeName)(Code)(Java Doc)
public boolean isRenderableSupported()(Code)(Java Doc)
public boolean isRenderedSupported()(Code)(Java Doc)
protected static Class[][] makeDefaultSourceClassList(String[] supportedModes, int numSources)(Code)(Java Doc)
public boolean validateArguments(String modeName, ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
public boolean validateArguments(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateParameters(String modeName, ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateParameters(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
public boolean validateRenderableArguments(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateRenderableSources(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateSources(String modeName, ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateSources(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.