Skip to content

Commit d40aa7b

Browse files
committed
Remove deconvolution debugging code
1 parent ae8b058 commit d40aa7b

File tree

3 files changed

+0
-49
lines changed

3 files changed

+0
-49
lines changed

src/main/java/net/imagej/ops/deconvolve/NonCirculantFirstGuess.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ public RandomAccessibleInterval<O> apply(RandomAccessibleInterval<I> in, final O
8787

8888
final Img<O> firstGuess = create.apply(in, outType);
8989

90-
RichardsonLucyC.dump(firstGuess, "firstGuess-initial");
91-
9290
// set first guess to be a constant = to the average value
9391

9492
// so first compute the sum...
@@ -110,7 +108,6 @@ public RandomAccessibleInterval<O> apply(RandomAccessibleInterval<I> in, final O
110108
type.setReal(average);
111109
}
112110

113-
RichardsonLucyC.dump(firstGuess, "firstGuess-result");
114111
return firstGuess;
115112
}
116113
}

src/main/java/net/imagej/ops/deconvolve/NonCirculantNormalizationFactor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,11 @@ protected void createNormalizationImageSemiNonCirculant(Interval fastFFTInterval
216216

217217
final Img<O> tempImg = create.apply(fd, type);
218218

219-
RichardsonLucyC.dump(normalization, "normalization-preCorrelate");
220-
221219
// 3. correlate psf with the output of step 2.
222220
correlater.compute(normalization, null, fftInput, fftKernel, true, false, es, tempImg);
223221

224222
normalization = tempImg;
225223

226-
RichardsonLucyC.dump(normalization, "normalization-postCorrelate");
227-
228224
final Cursor<O> cursorN = normalization.cursor();
229225

230226
while (cursorN.hasNext()) {
@@ -235,7 +231,5 @@ protected void createNormalizationImageSemiNonCirculant(Interval fastFFTInterval
235231

236232
}
237233
}
238-
239-
RichardsonLucyC.dump(normalization, "normalization-final");
240234
}
241235
}

src/main/java/net/imagej/ops/deconvolve/RichardsonLucyC.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
package net.imagej.ops.deconvolve;
3131

32-
import java.util.Arrays;
3332
import java.util.List;
3433
import java.util.concurrent.ExecutorService;
3534
import java.util.function.BiFunction;
@@ -160,69 +159,50 @@ public void compute(RandomAccessibleInterval<I> in, RandomAccessibleInterval<K>
160159
// setFFTKernel(getCreateOp().calculate(in));
161160
// }
162161

163-
dump(Views.flatIterable(in), "initial");
164-
165162
// if a starting point for the estimate was not passed in then create
166163
// estimate Img and use the input as the starting point
167164
if (raiExtendedEstimate == null) {
168165

169166
raiExtendedEstimate = createOp.apply(in, Util.getTypeFromInterval(out));
170167

171168
copyOp.compute(in, raiExtendedEstimate);
172-
173-
dump(Views.flatIterable(raiExtendedEstimate), "postCopy");
174169
}
175-
dump(Views.flatIterable(raiExtendedEstimate), "initialEE");
176170

177171
// create image for the reblurred
178172
RandomAccessibleInterval<O> raiExtendedReblurred = createOp.apply(in, Util.getTypeFromInterval(out));
179173

180174
// perform fft of psf
181175
fftKernelOp.compute(kernel, es, fftKernel);
182176

183-
dump(Views.flatIterable(fftKernel), "fftKernel");
184-
185177
// -- perform iterations --
186178

187179
for (int i = 0; i < maxIterations; i++) {
188180

189-
dump(Views.flatIterable(raiExtendedEstimate), i + "-preConvolve");
190-
191181
// create reblurred by convolving kernel with estimate
192182
// NOTE: the FFT of the PSF of the kernel has been passed in as a
193183
// parameter. when the op was set up, and computed above, so we can use
194184
// compute
195185
convolverOp.compute(raiExtendedEstimate, null, fftInput, fftKernel, true, false, es,
196186
raiExtendedReblurred);
197187

198-
dump(Views.flatIterable(raiExtendedReblurred), i + "-preCorrection");
199-
200188
// compute correction factor
201189
rlCorrectionOp.compute(in, raiExtendedReblurred, fftInput, fftKernel, es, raiExtendedReblurred);
202190

203-
dump(Views.flatIterable(raiExtendedReblurred), i + "-preUpdate");
204-
205191
// perform update to calculate new estimate
206192
updateOp.compute(raiExtendedReblurred, raiExtendedEstimate);
207193

208-
dump(Views.flatIterable(raiExtendedEstimate), i + "-postUpdate");
209-
210194
// apply post processing
211195
if (iterativePostProcessingOps != null) {
212196
for (Inplace<RandomAccessibleInterval<O>> pp : iterativePostProcessingOps) {
213197
pp.mutate(raiExtendedEstimate);
214198
}
215-
dump(Views.flatIterable(raiExtendedEstimate), i + "-postPostProc");
216199
}
217200

218201
// accelerate the algorithm by taking a larger step
219202
// TODO: do we need the nullcheck?
220203
if (accelerator != null) {
221204
accelerator.mutate(raiExtendedEstimate);
222-
dump(Views.flatIterable(raiExtendedEstimate), i + "-postAccel");
223205
}
224-
225-
dump(Views.flatIterable(raiExtendedEstimate), i + "-final");
226206
}
227207

228208
// -- copy crop padded back to original size
@@ -237,24 +217,4 @@ public void compute(RandomAccessibleInterval<I> in, RandomAccessibleInterval<K>
237217

238218
copy2Op.compute(Views.interval(raiExtendedEstimate, new FinalInterval(start, end)), out);
239219
}
240-
241-
public static void dump(Iterable<?> image, String fileName) {
242-
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
243-
java.io.PrintWriter pout = new java.io.PrintWriter(baos);
244-
int count = 0;
245-
for (Object item : image) {
246-
count++;
247-
pout.println(count + ": " + item);
248-
}
249-
pout.println("--END--");
250-
pout.flush();
251-
byte[] sjBytes = baos.toByteArray();
252-
try {
253-
org.scijava.util.FileUtils.writeFile(new java.io.File("/Users/curtis/sj-" + fileName + ".txt"), sjBytes);
254-
final byte[] ijBytes = org.scijava.util.FileUtils.readFile(new java.io.File("/Users/curtis/ij-" + fileName + ".txt"));
255-
final boolean same = Arrays.equals(sjBytes, ijBytes);
256-
System.out.println(fileName + " WRITTEN" + (same ? "" : " --> DIVERGED"));
257-
}
258-
catch (java.io.IOException exc) { exc.printStackTrace(); }
259-
}
260220
}

0 commit comments

Comments
 (0)