public void run(String arg) {
		
		// 1 - Obtain the currently active image if necessary:
		ImagePlus imp = IJ.getImage();
		if (null == imp) return;

		int stackSize = imp.getStackSize();

                // 2 - Ask for parameters:
		boolean whiteParticles =Prefs.blackBackground, addTop = true, addRight = true, addBottom, addLeft = true, doIstack = false;
		GenericDialog gd = new GenericDialog("Add Borders");
		gd.addMessage("Add Borders v 1.1");
		gd.addCheckbox("Top border", true);
		gd.addCheckbox("Right border", true);
		gd.addCheckbox("Bottom border", true);
		gd.addCheckbox("Left border", true);
		gd.addCheckbox("White borders", whiteParticles);
		if (stackSize>1) 
			gd.addCheckbox("Stack",false);

		gd.showDialog();
		if (gd.wasCanceled()) return
;
		// 3 - Retrieve parameters from the dialog
		addTop = gd.getNextBoolean();
		addRight = gd.getNextBoolean();
		addBottom = gd.getNextBoolean();
		addLeft = gd.getNextBoolean();
		whiteParticles = gd.getNextBoolean();
		if (stackSize>1) 
			doIstack = gd.getNextBoolean ();

		 // 4 - Execute!
		if (stackSize>1 && doIstack){
			for (int j=1; j<=stackSize; j++){
				imp.setSlice(j);
				Object[] result = exec(imp, addTop, addRight, addBottom, addLeft, whiteParticles);
			}
			imp.setSlice(1);
		}
		else {
			Object[] result = exec(imp, addTop, addRight, addBottom, addLeft, whiteParticles);
			}
		// 5 - If all went well, show the image:
		imp.updateAndDraw();
	}