Source Code Cross Referenced for MeanDescriptor.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: MeanDescriptor.java,v $
003:         *
004:         * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * Use is subject to license terms.
007:         *
008:         * $Revision: 1.1 $
009:         * $Date: 2005/02/11 04:57:39 $
010:         * $State: Exp $
011:         */
012:        package javax.media.jai.operator;
013:
014:        import java.awt.RenderingHints;
015:        import java.awt.image.RenderedImage;
016:        import java.awt.image.renderable.ParameterBlock;
017:        import javax.media.jai.JAI;
018:        import javax.media.jai.OperationDescriptorImpl;
019:        import javax.media.jai.ParameterBlockJAI;
020:        import javax.media.jai.ROI;
021:        import javax.media.jai.RenderedOp;
022:        import javax.media.jai.registry.RenderedRegistryMode;
023:
024:        /**
025:         * An <code>OperationDescriptor</code> describing the "Mean" operation.
026:         *
027:         * <p> The Mean operation scans a specific region of a rendered image
028:         * and computes the mean pixel value for each band within that region
029:         * of the image. The image data pass through this operation unchanged.
030:         *
031:         * <p>The region-wise mean pixel value for each band may be
032:         * retrieved by calling the <code>getProperty</code> method on this
033:         * operation with "mean" as the property name. The return value has
034:         * type <code>double[#bands]</code>.
035:         *
036:         * <p>The region of interest (ROI) does not have to be a rectangle.
037:         * It may be <code>null</code>, in which case the entire image is
038:         * scanned to find the image-wise mean pixel value for each band.
039:         *
040:         * <p>The set of pixels scanned may be further reduced by
041:         * specifying the "xPeriod" and "yPeriod" parameters that represent
042:         * the sampling rate along each axis. These variables may not be
043:         * less than 1. However, they may be <code>null</code>, in which
044:         * case the sampling rate is set to 1; that is, every pixel in the
045:         * ROI is processed.
046:         *
047:         * <p><table border=1>
048:         * <caption>Resource List</caption>
049:         * <tr><th>Name</th>        <th>Value</th></tr>
050:         * <tr><td>GlobalName</td>  <td>Mean</td></tr>
051:         * <tr><td>LocalName</td>   <td>Mean</td></tr>
052:         * <tr><td>Vendor</td>      <td>com.sun.media.jai</td></tr>
053:         * <tr><td>Description</td> <td>Calculates the region-wise mean pixel value
054:         *                              for each band of an image.</td></tr>
055:         * <tr><td>DocURL</td>      <td>http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/MeanDescriptor.html</td></tr>
056:         * <tr><td>Version</td>     <td>1.0</td></tr>
057:         * <tr><td>arg0Desc</td>    <td>The region of the image to scan.</td></tr>
058:         * <tr><td>arg1Desc</td>    <td>The horizontal sampling rate,
059:         *                              may not be less than 1.</td></tr>
060:         * <tr><td>arg2Desc</td>    <td>The vertical sampling rate,
061:         *                              may not be less than 1.</td></tr>
062:         * </table></p>
063:         *
064:         * <p><table border=1>
065:         * <caption>Parameter List</caption>
066:         * <tr><th>Name</th>          <th>Class Type</th>
067:         *                            <th>Default Value</th></tr>
068:         * <tr><td>roi</td>           <td>javax.media.jai.ROI</td>
069:         *                            <td>null</td>
070:         * <tr><td>xPeriod</td>       <td>java.lang.Integer</td>
071:         *                            <td>1</td>
072:         * <tr><td>yPeriod</td>       <td>java.lang.Integer</td>
073:         *                            <td>1</td>
074:         * </table></p>
075:         *
076:         * @see javax.media.jai.ROI
077:         * @see javax.media.jai.OperationDescriptor
078:         */
079:        public class MeanDescriptor extends OperationDescriptorImpl {
080:
081:            /**
082:             * The resource strings that provide the general documentation
083:             * and specify the parameter list for this operation.
084:             */
085:            private static final String[][] resources = {
086:                    { "GlobalName", "Mean" },
087:                    { "LocalName", "Mean" },
088:                    { "Vendor", "com.sun.media.jai" },
089:                    { "Description", JaiI18N.getString("MeanDescriptor0") },
090:                    {
091:                            "DocURL",
092:                            "http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/MeanDescriptor.html" },
093:                    { "Version", JaiI18N.getString("DescriptorVersion") },
094:                    { "arg0Desc", JaiI18N.getString("MeanDescriptor1") },
095:                    { "arg1Desc", JaiI18N.getString("MeanDescriptor2") },
096:                    { "arg2Desc", JaiI18N.getString("MeanDescriptor3") } };
097:
098:            /** The parameter name list for this operation. */
099:            private static final String[] paramNames = { "roi", "xPeriod",
100:                    "yPeriod" };
101:
102:            /** The parameter class list for this operation. */
103:            private static final Class[] paramClasses = {
104:                    javax.media.jai.ROI.class, java.lang.Integer.class,
105:                    java.lang.Integer.class };
106:
107:            /** The parameter default value list for this operation. */
108:            private static final Object[] paramDefaults = { null,
109:                    new Integer(1), new Integer(1) };
110:
111:            /** Constructor. */
112:            public MeanDescriptor() {
113:                super (resources, 1, paramClasses, paramNames, paramDefaults);
114:            }
115:
116:            /**
117:             * Returns the minimum legal value of a specified numeric parameter
118:             * for this operation.
119:             */
120:            public Number getParamMinValue(int index) {
121:                if (index == 0) {
122:                    return null;
123:                } else if (index == 1 || index == 2) {
124:                    return new Integer(1);
125:                } else {
126:                    throw new ArrayIndexOutOfBoundsException();
127:                }
128:            }
129:
130:            /**
131:             * Calculates the image-wise mean pixel value for each band of an image.
132:             *
133:             * <p>Creates a <code>ParameterBlockJAI</code> from all
134:             * supplied arguments except <code>hints</code> and invokes
135:             * {@link JAI#create(String,ParameterBlock,RenderingHints)}.
136:             *
137:             * @see JAI
138:             * @see ParameterBlockJAI
139:             * @see RenderedOp
140:             *
141:             * @param source0 <code>RenderedImage</code> source 0.
142:             * @param roi The region of the image to scan.
143:             * May be <code>null</code>.
144:             * @param xPeriod The horizontal sampling rate, may not be less than 1.
145:             * May be <code>null</code>.
146:             * @param yPeriod The vertical sampling rate, may not be less than 1.
147:             * May be <code>null</code>.
148:             * @param hints The <code>RenderingHints</code> to use.
149:             * May be <code>null</code>.
150:             * @return The <code>RenderedOp</code> destination.
151:             * @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
152:             */
153:            public static RenderedOp create(RenderedImage source0, ROI roi,
154:                    Integer xPeriod, Integer yPeriod, RenderingHints hints) {
155:                ParameterBlockJAI pb = new ParameterBlockJAI("Mean",
156:                        RenderedRegistryMode.MODE_NAME);
157:
158:                pb.setSource("source0", source0);
159:
160:                pb.setParameter("roi", roi);
161:                pb.setParameter("xPeriod", xPeriod);
162:                pb.setParameter("yPeriod", yPeriod);
163:
164:                return JAI.create("Mean", pb, hints);
165:            }
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.