1 /**
2 * Copyright (c) 2011, The University of Southampton and the individual contributors.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * * Neither the name of the University of Southampton nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 package org.openimaj.image.analysis.pyramid;
31
32 import org.openimaj.image.FImage;
33 import org.openimaj.image.Image;
34 import org.openimaj.image.processor.SinglebandImageProcessor;
35
36 /**
37 * Basic options for constructing a pyramid
38 *
39 * @author Jonathon Hare (jsh2@ecs.soton.ac.uk)
40 *
41 * @param <OCTAVE> type of underlying octave
42 * @param <IMAGE> type of underlying image.
43 */
44 public class PyramidOptions<
45 OCTAVE extends Octave<?,?,IMAGE>,
46 IMAGE extends Image<?,IMAGE> & SinglebandImageProcessor.Processable<Float,FImage,IMAGE>>
47 {
48 /**
49 * Should the Pyramid hold onto its octaves?
50 */
51 protected boolean keepOctaves = false;
52
53 /**
54 * An OctaveProcessor to apply to each octave of the pyramid.
55 */
56 protected OctaveProcessor<OCTAVE,IMAGE> octaveProcessor;
57
58 /**
59 * PyramidProcessor for processing the pyramid after construction.
60 * Setting a PyramidProcessor will cause the Pyramid to hold onto
61 * its entire set of octaves.
62 */
63 protected PyramidProcessor<IMAGE> pyramidProcessor = null;
64
65 /**
66 * Get an OctaveProcessor to apply to each octave of the pyramid or null
67 * if none is set.
68 *
69 * @return the octaveProcessor or null
70 */
71 public OctaveProcessor<OCTAVE,IMAGE> getOctaveProcessor() {
72 return octaveProcessor;
73 }
74
75 /**
76 * Gets the currently set PyramidProcessor or null if none is set.
77 *
78 * PyramidProcessors process the pyramid after construction.
79 * Setting a PyramidProcessor will cause the Pyramid to hold onto
80 * its entire set of octaves.
81 *
82 * @return the pyramidProcessor or null
83 */
84 public PyramidProcessor<IMAGE> getPyramidProcessor() {
85 return pyramidProcessor;
86 }
87
88 /**
89 * Determine whether the Pyramid should retain its octaves.
90 * Value is overridden if a PyramidProcessor is set.
91 * @return the keepOctaves
92 */
93 public boolean isKeepOctaves() {
94 return keepOctaves;
95 }
96
97 /**
98 * Set whether the Pyramid should retain its octaves.
99 * Default value is false, but is overridden if a PyramidProcessor
100 * is set.
101 *
102 * @param keepOctaves the keepOctaves to set
103 */
104 public void setKeepOctaves(boolean keepOctaves) {
105 this.keepOctaves = keepOctaves;
106 }
107
108 /**
109 * Get an OctaveProcessor to apply to each octave of the pyramid.
110 * Setting the OctaveProcessor to null disables it.
111 *
112 * @param octaveProcessor the octaveProcessor to set
113 */
114 public void setOctaveProcessor(OctaveProcessor<OCTAVE,IMAGE> octaveProcessor) {
115 this.octaveProcessor = octaveProcessor;
116 }
117
118 /**
119 * Sets the PyramidProcessor.
120 *
121 * PyramidProcessors for process the pyramid after construction.
122 * Setting a PyramidProcessor will cause the Pyramid to hold onto
123 * its entire set of octaves.
124 *
125 * Setting the PyramidProcessor to null disables it.
126 *
127 * @param pyramidProcessor the pyramidProcessor to set
128 */
129 public void setPyramidProcessor(PyramidProcessor<IMAGE> pyramidProcessor) {
130 this.pyramidProcessor = pyramidProcessor;
131 }
132 }