Revision 43862 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.impl/src/main/java/org/gvsig/raster/lib/legend/impl/operations/pansharpening/PansharpeningOperation.java
PansharpeningOperation.java | ||
---|---|---|
57 | 57 |
* |
58 | 58 |
*/ |
59 | 59 |
public PansharpeningOperation(OperationFactory factory) { |
60 |
this.factory = factory;
|
|
60 |
super(factory);
|
|
61 | 61 |
} |
62 | 62 |
|
63 | 63 |
@Override |
... | ... | |
65 | 65 |
super.preProcess(); |
66 | 66 |
BufferManager manager = BufferLocator.getBufferManager(); |
67 | 67 |
|
68 |
statistics = (Statistics)this.parameters.getDynValue(STATISTICS_PARAM);
|
|
68 |
statistics = (Statistics)this.getParameter(STATISTICS_PARAM,null);
|
|
69 | 69 |
|
70 |
int bands = this.buffer.getBandCount();
|
|
71 |
NoData[] noData = this.buffer.getBandNoData();
|
|
70 |
// int bands = this.getInputBuffer().getBandCount();
|
|
71 |
// NoData[] noData = this.getInputBuffer().getBandNoData();
|
|
72 | 72 |
|
73 | 73 |
try { |
74 |
this.outputBuffer = manager.createBuffer( |
|
75 |
this.buffer.getRows(), |
|
76 |
this.buffer.getColumns(), |
|
77 |
this.buffer.getBandTypes(), |
|
78 |
this.buffer.getBandNoData(), |
|
79 |
this.buffer.getProjection(), |
|
80 |
this.buffer.getEnvelope()); |
|
74 |
this.setOutputBuffer( |
|
75 |
manager.createBuffer( |
|
76 |
this.getInputBuffer().getRows(), |
|
77 |
this.getInputBuffer().getColumns(), |
|
78 |
this.getInputBuffer().getBandTypes(), |
|
79 |
this.getInputBuffer().getBandNoData(), |
|
80 |
this.getInputBuffer().getProjection(), |
|
81 |
this.getInputBuffer().getEnvelope())); |
|
81 | 82 |
} catch (LocatorException | BufferException | CreateEnvelopeException e) { |
82 | 83 |
throw new ProcessingOperationException(e); |
83 | 84 |
} |
... | ... | |
86 | 87 |
@Override |
87 | 88 |
public void process() throws ProcessingOperationException { |
88 | 89 |
super.process(); |
89 |
for (int band=0; band<this.buffer.getBandCount(); band++){
|
|
90 |
for (int band=0; band<this.getInputBuffer().getBandCount(); band++){
|
|
90 | 91 |
rowProcessor = new ByteRowProcessor(band); |
91 | 92 |
if (isRGBorGrayBand(band)) { |
92 |
Band bufferBand = this.buffer.getBand(band);
|
|
93 |
Band outputBufferBand = this.outputBuffer.getBand(band);
|
|
93 |
Band bufferBand = this.getInputBuffer().getBand(band);
|
|
94 |
Band outputBufferBand = this.getOutputBuffer().getBand(band);
|
|
94 | 95 |
|
95 |
for (int row = 0; row < this.buffer.getRows(); row++) {
|
|
96 |
for (int row = 0; row < this.getInputBuffer().getRows(); row++) {
|
|
96 | 97 |
Object rowBuffer = bufferBand.createRowBuffer(); |
97 | 98 |
bufferBand.fetchRow(row, rowBuffer); |
98 | 99 |
|
... | ... | |
105 | 106 |
} |
106 | 107 |
} else { |
107 | 108 |
try { |
108 |
this.outputBuffer.getBand(band).copyFrom(this.buffer.getBand(band));
|
|
109 |
this.getOutputBuffer().getBand(band).copyFrom(this.getInputBuffer().getBand(band));
|
|
109 | 110 |
} catch (BandException e) { |
110 | 111 |
throw new ProcessingOperationException(e); |
111 | 112 |
} |
... | ... | |
114 | 115 |
} |
115 | 116 |
|
116 | 117 |
private boolean isRGBorGrayBand(int band) { |
117 |
String bandColorInterpretation = colorInterpretation.get(band);
|
|
118 |
String bandColorInterpretation = getInputColorInterpretation().get(band);
|
|
118 | 119 |
return (bandColorInterpretation.equals(ColorInterpretation.RED_BAND) || |
119 | 120 |
bandColorInterpretation.equals(ColorInterpretation.GREEN_BAND) || |
120 | 121 |
bandColorInterpretation.equals(ColorInterpretation.BLUE_BAND) || |
... | ... | |
141 | 142 |
|
142 | 143 |
public AbstractRowProcessor(int band) { |
143 | 144 |
// this.band = band; |
144 |
noData = buffer.getBand(band).getNoData();
|
|
145 |
noData = getInputBuffer().getBand(band).getNoData();
|
|
145 | 146 |
if(noData.isDefined()) { |
146 | 147 |
minResult = (byte)1; |
147 | 148 |
} |
... | ... | |
170 | 171 |
return (byte)value; |
171 | 172 |
} |
172 | 173 |
|
173 |
int iValue = 0xFF & ((Byte) value).byteValue();
|
|
174 |
int iValue = 0xFF & ((Byte) value); |
|
174 | 175 |
int result = iValue; // + brightness; |
175 | 176 |
if(result>maxResult){ |
176 | 177 |
result = maxResult; |
Also available in: Unified diff