	final public void run( final String args )
	{
		if ( IJ.versionLessThan( "1.41n" ) ) return;
		final ImagePlus imp = WindowManager.getCurrentImage();
		if ( imp == null )  { System.err.println( "There are no images open" ); return; }
		GenericDialog gd = new GenericDialog( "Generate optic flow" );
		gd.addNumericField( "sigma :", sigma, 2, 6, "px" );
		gd.addNumericField( "maximal_distance :", maxDistance, 0, 6, "px" );
		gd.addCheckbox( "show_color_map", showColors );
		gd.showDialog();
		if (gd.wasCanceled()) return;
		sigma = ( float )gd.getNextNumber();
		maxDistance = ( byte )gd.getNextNumber();
		showColors = gd.getNextBoolean();
		if ( showColors )
		{
			ColorProcessor ipColor = new ColorProcessor( imp.getWidth(), imp.getHeight() );
			colorCircle( ipColor );
			ImagePlus impColor = new ImagePlus( "Color", ipColor );
			impColor.show();
		}
		ImageStack seq = imp.getStack();
		ImageStack seqOpticFlow = new ImageStack( seq.getWidth(), seq.getHeight() );
		FloatProcessor ip1;
		FloatProcessor ip2 = ( FloatProcessor )seq.getProcessor( 1 ).convertToFloat();
		ImagePlus impOpticFlow = null;
		for ( int i = 1; i < seq.getSize(); ++i )
		{
			ip1 = ip2;
			ip2 = ( FloatProcessor )seq.getProcessor( i + 1 ).convertToFloat();
			IJ.log( "Processing slice " + i );
			seqOpticFlow.addSlice( "" + i, createOpticFlow( ip1, ip2 ) );
			if ( seqOpticFlow.getSize() == 1 )
			{
				impOpticFlow = new ImagePlus( imp.getTitle() + " optic flow", seqOpticFlow );
				impOpticFlow.show();
			}
			else
				impOpticFlow.setStack( null, seqOpticFlow );
			IJ.showProgress( i, seq.getSize() );
			impOpticFlow.setSlice( i );
			imp.setSlice( i + 1 );
		}
	}

	final public void run( final String args )
	{
		if ( IJ.versionLessThan( "1.41n" ) ) return;
		final ImagePlus imp = WindowManager.getCurrentImage();
		if ( imp == null )  { IJ.error( "There are no images open" ); return; }
		GenericDialog gd = new GenericDialog( "Generate optic flow" );
		gd.addNumericField( "sigma :", sigma, 2, 6, "px" );
		gd.addNumericField( "maximal_distance :", maxDistance, 0, 6, "px" );
		gd.addCheckbox( "show_color_map", showColors );
		gd.showDialog();
		if (gd.wasCanceled()) return;
		sigma = ( float )gd.getNextNumber();
		maxDistance = ( byte )gd.getNextNumber();
		showColors = gd.getNextBoolean();
		if ( showColors )
		{
			ColorProcessor ipColor = new ColorProcessor( imp.getWidth(), imp.getHeight() );
			colorCircle( ipColor );
			ImagePlus impColor = new ImagePlus( "Color", ipColor );
			impColor.show();
		}
		ImageStack seq = imp.getStack();
		ImageStack seqOpticFlow = new ImageStack( seq.getWidth(), seq.getHeight() );
		FloatProcessor ip1;
		FloatProcessor ip2 = ( FloatProcessor )seq.getProcessor( 1 ).convertToFloat();
		ImagePlus impOpticFlow = null;
		for ( int i = 1; i < seq.getSize(); ++i )
		{
			ip1 = ip2;
			ip2 = ( FloatProcessor )seq.getProcessor( i + 1 ).convertToFloat();
			IJ.log( "Processing slice " + i );
			seqOpticFlow.addSlice( "" + i, createOpticFlow( ip1, ip2 ) );
			if ( seqOpticFlow.getSize() == 1 )
			{
				impOpticFlow = new ImagePlus( imp.getTitle() + " optic flow", seqOpticFlow );
				impOpticFlow.show();
			}
			else
				impOpticFlow.setStack( null, seqOpticFlow );
			IJ.showProgress( i, seq.getSize() );
			impOpticFlow.setSlice( i );
			imp.setSlice( i + 1 );
		}
	}
