2929
3030package net .imagej .ops .deconvolve ;
3131
32- import java .util .Arrays ;
3332import java .util .List ;
3433import java .util .concurrent .ExecutorService ;
3534import 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