/***
 * Image/J Plugins
 * Copyright (C) 2002-2005 Jarek Sacha
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Latest release available at http://sourceforge.net/projects/ij-plugins/
 */
package net.sf.ij_plugins.filters;

import ij.ImagePlus;
import ij.plugin.filter.PlugInFilter;
import ij.process.FloatProcessor;
import ij.process.ImageProcessor;
import net.sf.ij_plugins.util.DialogUtil;
import net.sf.ij_plugins.util.progress.IJProgressBarAdapter;

/**
 * @author Jarek Sacha
 * @version $ Revision: $
 */

abstract public class AbstractAnisotropicDiffusionPlugin implements PlugInFilter {

    protected final String title;

    protected AbstractAnisotropicDiffusionPlugin(final String title) {
        this.title = title;
    }

    public int setup(String s, ImagePlus imagePlus) {
        return DOES_8G | DOES_16 | DOES_32 | DOES_STACKS | NO_CHANGES;
    }

    public void run(final ImageProcessor ip) {

        final FloatProcessor src = (FloatProcessor) ip.convertToFloat();
        final AbstractAnisotropicDiffusion filter = createFilter();
        final IJProgressBarAdapter progressBarAdapter = new IJProgressBarAdapter();
        filter.addProgressListener(progressBarAdapter);
        try {

            if (!DialogUtil.showGenericDialog(filter, title)) {
                return;
            }

            long start = System.currentTimeMillis();
            FloatProcessor dest = filter.process(src);
            long end = System.currentTimeMillis();

            new ImagePlus(title, dest).show();
//            IJ.showStatus("Filtering completed in " + (end - start) + "ms.");
        } finally {
            filter.removeProgressListener(progressBarAdapter);
        }
    }

    /**
     * Create instance of the filter wrapped by this plugin.
     *
     * @return filter used by this plugin.
     */
    abstract AbstractAnisotropicDiffusion createFilter();

}

@@ -1,12 +1,10 @@
 /*
-**
 %0A * Imag
@@ -40,17 +40,17 @@
 2002-200
-5
+8
  Jarek S
@@ -871,16 +871,19 @@
 lugins/%0A
+ *%0A
  */%0Apack
@@ -1156,53 +1156,90 @@
 %0A * 
-@author Jarek Sacha%0A * @version $ Revision: $
+Helper class for creating anisotropic diffusion plugins.%0A *%0A * @author Jarek Sacha
 %0A */
@@ -1486,16 +1486,22 @@
 t setup(
+final 
 String s
@@ -1501,16 +1501,22 @@
 tring s,
+ final
  ImagePl
@@ -2072,280 +2072,102 @@
     
-long start = System.currentTimeMillis();%0A            FloatProcessor dest = filter.process(src);%0A            long end = System.currentTimeMillis();%0A%0A            new ImagePlus(title, dest).show();%0A//            IJ.showStatus(%22Filtering completed in %22 + (end - start) + %22ms.%22
+final FloatProcessor dest = filter.process(src);%0A%0A            new ImagePlus(title, dest).show(
 );%0A 

Remove unused variables.