ij.gui.Toolbar Java Examples

The following examples show how to use ij.gui.Toolbar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PointSelectionBehavior.java    From SNT with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void doProcess(final MouseEvent me) {
	if (me.isConsumed() || Toolbar.getToolId() != Toolbar.WAND)
		return;
	final int mouseEventID = me.getID();
	/*
	 * It's nice to still be able to zoom with the mouse wheel, so don't
	 * consume this event.
	 */
	if (mouseEventID == MouseEvent.MOUSE_WHEEL)
		return;
	me.consume();
	if (mouseEventID != MouseEvent.MOUSE_CLICKED)
		return;
	final Picker picker = univ.getPicker();
	final Content c = picker.getPickedContent(me.getX(), me.getY());
	if (null == c)
		return;

	final Point3d point = picker.getPickPointGeometry(c, me.getX(), me.getY());

	final boolean mac = IJ.isMacintosh();

	final boolean shift_key_down = (me.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
	final boolean joiner_modifier_down = mac ? ((me.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0)
			: ((me.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0);

	SwingUtilities.invokeLater(new Runnable() {
		@Override
		public void run() {
			tracerPlugin.clickForTrace(point, joiner_modifier_down);
		}
	});
}
 
Example #2
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
static public void keyPressed(KeyEvent ke) {
	switch (ke.getKeyCode()) {
		case KeyEvent.VK_F1:
			setTool(Toolbar.RECTANGLE);
			break;
		case KeyEvent.VK_F2:
			setTool(Toolbar.POLYGON);
			break;
		case KeyEvent.VK_F3:
			setTool(Toolbar.FREEROI);
			break;
		case KeyEvent.VK_F4:
			setTool(Toolbar.TEXT);
			break;
		case KeyEvent.VK_F5:
			setTool(Toolbar.MAGNIFIER);
			break;
		case KeyEvent.VK_F6:
			setTool(Toolbar.HAND);
			break;
		case KeyEvent.VK_F7:
			break;
		case KeyEvent.VK_F8:
			break;
		case KeyEvent.VK_F9:
			setTool(SELECT);
			break;
		case KeyEvent.VK_F10:
			setTool(PENCIL);
			break;
		case KeyEvent.VK_F11:
			setTool(PEN);
			break;
		case KeyEvent.VK_F12:
			setTool(BRUSH);
			break;
	}
}
 
Example #3
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
/** Change the brush size by the given length increment (in pixel units). A lower limit of 1 pixel is preserved. Returns the value finally accepted for brush size.*/
static public int setBrushSize(int inc) {
	int brushSize = 15;
	try {
		java.lang.reflect.Field f = Toolbar.class.getDeclaredField("brushSize");
		f.setAccessible(true);
		brushSize = ((Integer)f.get(Toolbar.getInstance())).intValue();
		if (brushSize + inc < 1) brushSize = 1;
		else brushSize += inc;
		f.setInt(Toolbar.getInstance(), brushSize);
	} catch (Exception e) {}
	return brushSize;
}
 
Example #4
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
/** Hacks on the ij.gui.Toolbar to get the proper value, and defaults to 15 if the value is absurd. */
static public int getBrushSize() {
	int brushSize = 15;
	try {
		java.lang.reflect.Field f = Toolbar.class.getDeclaredField("brushSize");
		f.setAccessible(true);
		brushSize = ((Integer)f.get(Toolbar.getInstance())).intValue();
		if (brushSize < 1) brushSize = 15;
	} catch (Exception e) {}
	return brushSize;
}
 
Example #5
Source File: DisplayCanvas.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
/** Sets the cursor based on the current tool and cursor location. */
@Override
public void setCursor(final int sx, final int sy, final int ox, final int oy) {
	// copy of ImageCanvas.setCursor without the win==null
	xMouse = ox;
	yMouse = oy;
	final Roi roi = imp.getRoi();
	/*
	 * ImageWindow win = imp.getWindow(); if (win==null) return;
	 */
	if (IJ.spaceBarDown()) {
		setCursor(handCursor);
		return;
	}
	switch (Toolbar.getToolId()) {
	case Toolbar.MAGNIFIER:
		if (IJ.isMacintosh())
			setCursor(defaultCursor);
		else
			setCursor(moveCursor);
		break;
	case Toolbar.HAND:
		setCursor(handCursor);
		break;
	case ProjectToolbar.SELECT:
	case ProjectToolbar.PENCIL:
		setCursor(defaultCursor);
		break;
	default: // selection tool

		if (roi != null && roi.getState() != Roi.CONSTRUCTING && roi.isHandle(sx, sy) >= 0)
			setCursor(handCursor);
		else if (Prefs.usePointerCursor || (roi != null && roi.getState() != Roi.CONSTRUCTING && roi.contains(ox, oy)))
			setCursor(defaultCursor);
		else
			setCursor(crosshairCursor);
		break;
	}
}
 
Example #6
Source File: DisplayCanvas.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void mouseMoved(final MouseEvent me) {
	super.flags = me.getModifiers();
	final int tool = Toolbar.getToolId();
	switch (tool) {
	case Toolbar.POLYLINE:
	case Toolbar.POLYGON:
	case Toolbar.ANGLE:
		super.mouseMoved(me);
		repaint();
		return;
	}
	mouse_moved.dispatch(me);
}
 
Example #7
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 4 votes vote down vote up
/** The luminance of the foreground color. */
static public final int getForegroundColorValue() {
	return Utils.luminance(Toolbar.getForegroundColor());
}
 
Example #8
Source File: ThresholderOrbit.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
public void applyThreshold(ImagePlus imp) {
	imp.deleteRoi();
	ImageProcessor ip = imp.getProcessor();
	ip.resetBinaryThreshold();
	int type = imp.getType();
	if (type==ImagePlus.GRAY16 || type==ImagePlus.GRAY32) {
		applyShortOrFloatThreshold(imp);
		return;
	}
	if (!imp.lock()) return;
	double saveMinThreshold = ip.getMinThreshold();
	double saveMaxThreshold = ip.getMaxThreshold();
	autoThreshold = saveMinThreshold==ImageProcessor.NO_THRESHOLD;

	boolean useBlackAndWhite = true;
	boolean noArgMacro =IJ.macroRunning() && Macro.getOptions()==null;
	if (skipDialog)
		fill1 = fill2 = useBlackAndWhite = true;
	else if (!(autoThreshold||noArgMacro)) {
		GenericDialog gd = new GenericDialog("Make Binary");
		gd.addCheckbox("Thresholded pixels to foreground color", fill1);
		gd.addCheckbox("Remaining pixels to background color", fill2);
		gd.addMessage("");
		gd.addCheckbox("Black foreground, white background", useBW);
		gd.showDialog();
		if (gd.wasCanceled())
		{imp.unlock(); return;}
		fill1 = gd.getNextBoolean();
		fill2 = gd.getNextBoolean();
		useBW = useBlackAndWhite = gd.getNextBoolean();
	} else {
		fill1 = fill2 = true;
		convertToMask = true;
	}

	if (type!=ImagePlus.GRAY8)
		convertToByte(imp);
	ip = imp.getProcessor();

	if (autoThreshold)
		autoThreshold(ip);
	else {
		if (Recorder.record && !Recorder.scriptMode() && (!IJ.isMacro()||Recorder.recordInMacros))
			Recorder.record("setThreshold", (int)saveMinThreshold, (int)saveMaxThreshold);
		minThreshold = saveMinThreshold;
		maxThreshold = saveMaxThreshold;
	}

	if (convertToMask && ip.isColorLut())
		ip.setColorModel(ip.getDefaultColorModel());
	int fcolor, bcolor;
	ip.resetThreshold();
	int savePixel = ip.getPixel(0,0);
	if (useBlackAndWhite)
		ip.setColor(Color.black);
	else
		ip.setColor(Toolbar.getForegroundColor());
	ip.drawPixel(0,0);
	fcolor = ip.getPixel(0,0);
	if (useBlackAndWhite)
		ip.setColor(Color.white);
	else
		ip.setColor(Toolbar.getBackgroundColor());
	ip.drawPixel(0,0);
	bcolor = ip.getPixel(0,0);
	ip.setColor(Toolbar.getForegroundColor());
	ip.putPixel(0,0,savePixel);

	int[] lut = new int[256];
	for (int i=0; i<256; i++) {
		if (i>=minThreshold && i<=maxThreshold)
			lut[i] = fill1?fcolor:(byte)i;
		else {
			lut[i] = fill2?bcolor:(byte)i;
		}
	}
	if (imp.getStackSize()>1)
		new StackProcessor(imp.getStack(), ip).applyTable(lut);
	else
		ip.applyTable(lut);
	if (convertToMask) {
		if (!imp.isInvertedLut()) {
			setInvertedLut(imp);
			fcolor = 255 - fcolor;
			bcolor = 255 - bcolor;
		}
		if (Prefs.blackBackground)
			ip.invertLut();
	}
	if (fill1 && fill2 && ((fcolor==0&&bcolor==255)||(fcolor==255&&bcolor==0)))
		imp.getProcessor().setThreshold(fcolor, fcolor, ImageProcessor.NO_LUT_UPDATE);
	imp.updateAndRepaintWindow();
	imp.unlock();
}
 
Example #9
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 4 votes vote down vote up
public void mousePressed(MouseEvent me) {
	int ij_tool = Toolbar.getToolId();
	Utils.log2("Tool: " + ij_tool);
}
 
Example #10
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 4 votes vote down vote up
static public int getToolId() {
	int tool = Toolbar.getToolId();
	if (Toolbar.WAND == tool) return ProjectToolbar.WAND;
	return tool;
}
 
Example #11
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 4 votes vote down vote up
static public void setTool(final int t) {
	SwingUtilities.invokeLater(new Runnable() { public void run() {
		Toolbar.getInstance().setTool(t);
	}});
	Display.repaintToolbar();
}
 
Example #12
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 4 votes vote down vote up
/** Restore ImageJ's toolbar. */
static public void setImageJToolbar() {
	// remove mouse listener
	MouseListener[] ml = Toolbar.getInstance().getMouseListeners();
	for (int i=0; i<ml.length; i++) {
		if (ml[i].equals(instance)) {
			Toolbar.getInstance().removeMouseListener(instance);
			break;
		}
	}
	// try to fetch the macros folder
	// The code below does the same as:
	// 	IJ.run("Install...", "install="+IJ.getDirectory("macros")+"StartupMacros.txt");
	// but checking whether the startupmacros.txt file exists
	if (null == startup_macros) {
		String macros_path = ij.Menus.getMacrosPath();
		if (null != macros_path) {
			File f = new File(macros_path);
			if (f.isDirectory()) {
				String[] mf = f.list();
				for (int i=0; i<mf.length; i++) {
					if (mf[i].toLowerCase().equals("startupmacros.txt")) {
						startup_macros = Utils.openTextFile(macros_path + "/" + mf[i]);
						break;
					}
				}
			}
		}
	}
	// else, try to run
	if (null == startup_macros && ImageJ.VERSION.compareTo("1.38a") >= 0) {
		try {
			/* // works locally, but won't on registered applets or java web start
			Toolbar tb = Toolbar.getInstance();
			Field f_sp = Toolbar.class.getDeclaredField("switchPopup");
			f_sp.setAccessible(true);
			PopupMenu popup = (PopupMenu)f_sp.get(tb);
			MenuItem item = null;
			for (int i=popup.getItemCount() -1; i>-1; i--) {
				item = popup.getItem(i);
				if (item.getLabel().equals("StartupMacros*")) {
					break;
				}
			}
			// simulate click
			ItemEvent event = new ItemEvent((ItemSelectable)item,(int)System.currentTimeMillis(),item,1);
			tb.itemStateChanged(event);
			*/
			// Wayne Rasband's solution:
			MacroInstaller mi = new MacroInstaller();
			String path = "/macros/StartupMacros.txt";
			//mi.installFromIJJar(path); // fails absurdly on IJ < 1.38a despite the 'if' clause
			java.lang.reflect.Method m = MacroInstaller.class.getDeclaredMethod("installFromIJJar", new Class[]{});
			m.invoke(mi, new Object[]{path});
			return;
		} catch (Exception e) {
			//e.printStackTrace();
			if (null != IJ.getInstance() && IJ.getInstance().quitting()) {
				Utils.log("Failed to restore ImageJ toolbar");
			}
		}
	}
	if (null != startup_macros) {
		new MacroInstaller().install(startup_macros);
	}
}
 
Example #13
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 4 votes vote down vote up
/** Set macro buttons for TrakEM2 in ImageJ's toolbar */
static synchronized public void setProjectToolbar() {
	if (null == instance) instance = new ProjectToolbar();
	// check if macros are installed already
	MacroInstaller installer = new MacroInstaller();
	boolean toolbar_present = false;
	try {
		java.awt.event.ActionListener[] al = ij.Menus.getMacrosMenu().getActionListeners();
		MacroInstaller minst = null;
		for (int j=al.length -1; j>-1; j--) {
			if (al[j] instanceof MacroInstaller) {
				minst = (MacroInstaller)al[j];
				break;
			}
		}
		if (null != minst) {
			java.lang.reflect.Field f_macroNames = MacroInstaller.class.getDeclaredField("macroNames");
			f_macroNames.setAccessible(true);
			Object ob = f_macroNames.get(minst);
			if (null != ob) {	
				String[] macroNames = (String[])ob;
				if (null == macroNames) return;
				if (macroNames.length > 3
				 && null != macroNames[0] && 0 == macroNames[0].indexOf("Select and Transform")
				 && null != macroNames[1] && 0 == macroNames[1].indexOf("Freehand")
				 && null != macroNames[2] && 0 == macroNames[2].indexOf("Pen")
				 && null != macroNames[3] && 0 == macroNames[3].indexOf("Align")
				) {
					toolbar_present = true;
				}
			}
		}
	} catch (Exception e) {
		// the above is not thread safe, will fail many times because the Display being show is also trying to set the toolbar
		Utils.log2("Can't check if toolbar is in place.");
		//IJError.print(e);
		// if it fails, toolbar_present still is false and thus will result in the macros being installed again.
	}

	// sort of a constructor: an embedded macro set
	if (!toolbar_present) {
		int tool = Toolbar.getToolId();
		final StringBuilder sb_tools = new StringBuilder();
		sb_tools.append("macro 'Select and Transform Tool-C000L2242L2363L3494L35b5L46c6L4797L48a8L49b9L5a6aL8acaL5b6bL9bdbL5c5cLacdcLbdcd' {\ncall('ini.trakem2.utils.ProjectToolbar.toolChanged', 'SELECT');\n}\n")
			.append("macro 'Freehand Tool-C000Lb0c0La1d1L92e2L83f3L74f4L65e5L56d6L47c7L38b8L29a9L2a2aL4a9aL1b2bL5b8bL1c1cL6c7cL0d1dL5d6dL0e0eL3e5eL0f3f' {\ncall('ini.trakem2.utils.ProjectToolbar.toolChanged', 'PENCIL');\n}\n")
			.append("macro 'Pen Tool-C000L8080L7191L7292L6363L8383La3a3L6464L8484Lb4b4L5555L8585Lb5b5L4646L8686Lc6c6L4747Lc7c7L3838Ld8d8L4949Lc9c9L4a4aLcacaL5b5bLbbbbL5c5cLbcbcL4dcdL5e5eLbebeL5fbf' {\ncall('ini.trakem2.utils.ProjectToolbar.toolChanged', 'PEN');\n}\n")
			.append("macro 'Brush Tool - C037La077Ld098L6859L4a2fL2f4fL3f99L5e9bL9b98L6888L5e8dL888c' {\ncall('ini.trakem2.utils.ProjectToolbar.toolChanged', 'BRUSH');\n}\n")
		;

		installer.install(sb_tools.toString()); // another call to install erases the previous, so it needs all at the same time
		Toolbar.getInstance().setTool(tool);
	}
}
 
Example #14
Source File: InteractiveMorphologicalReconstruction3D.java    From MorphoLibJ with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Apply the current filter settings to process the given image.
 */
public void run( String arg )
{
	ImagePlus image = WindowManager.getCurrentImage();
	if ( image == null || image.getImageStackSize() < 2 )
	{
		IJ.error( "Interactive Geodesic Reconstruction 3D",
				"Need at least one 3D image to work" );
		return;
	}

	// select point tool for manual introduction of markers
	Toolbar.getInstance().setTool( Toolbar.POINT );

	// create the dialog
	gd = new NonBlockingGenericDialog( "Interactive Geodesic "
			+ "Reconstruction 3D" );

	gd.addChoice("Type of Reconstruction",
			Operation.getAllLabels(),
			operation.label);
	gd.addChoice("Connectivity",
			Conn3D.getAllLabels(),
			connectivity.label);
	gd.addHelp( "http://imagej.net/MorphoLibJ" );
	gd.showDialog();

	if (gd.wasCanceled())
		return;

	// set up current parameters
	operation = Operation.fromLabel( gd.getNextChoice() );
	connectivity = Conn3D.fromLabel( gd.getNextChoice() );

	long t0 = System.currentTimeMillis();

	// Compute geodesic reconstruction
	final ImagePlus result = process( image, image.getRoi() );

	if( null == result )
		return;

	if (result.getBitDepth() != 24)
	{
		Images3D.optimizeDisplayRange( result );
	}
	
	// Display the result image
	result.setSlice( image.getCurrentSlice() );
	result.show();

	long t1 = System.currentTimeMillis();
	IJUtils.showElapsedTime( operation.toString(), t1 - t0, image );
}
 
Example #15
Source File: InteractiveGeodesicDistanceMap.java    From MorphoLibJ with GNU Lesser General Public License v3.0 4 votes vote down vote up
public int showDialog(
		ImagePlus imp,
		String command,
		final PlugInFilterRunner pfr )
{
	if( !BinaryImages.isBinaryImage( imp ) )
	{
		IJ.error( "Interactive Geodesic Distance Map", "Input image is not"
				+ " binary (8-bit with only 0 or 255 values)" );
		return DONE;
	}

	// Store user data
	this.imagePlus = imp;
	this.baseImage = imp.getProcessor().duplicate();
	this.pfr = pfr;

	/** ROI listener to update plugin when new ROIs are added */
	this.listener = new RoiListener() {
		@Override
		public void roiModified( ImagePlus imp, int id ) {

			if( imp == imagePlus )
			{
				// set preview to false to restart plugin filter runner
				gd.getPreviewCheckbox().setState( false );

				pfr.dialogItemChanged( gd,
						new ActionEvent( gd.getPreviewCheckbox(),
								ActionEvent.ACTION_PERFORMED, "Preview" ) );
			}
		}
	};
	Roi.addRoiListener( listener );

	// select point tool for manual introduction of markers
	Toolbar.getInstance().setTool( Toolbar.POINT );

	// create the dialog
	gd = new NonBlockingGenericDialog( "Interactive Geodesic "
					+ "Distance Map" );
	// Set Chessknight weights as default
	gd.addChoice( "Distances", ChamferWeights.getAllLabels(),
			weights.toString() );
	String[] outputTypes = new String[] { "32 bits", "16 bits" };
	gd.addChoice( "Output Type", outputTypes,
			outputTypes[ resultAsFloat ? 0:1 ] );
	gd.addCheckbox( "Normalize weights", normalize );
	gd.addPreviewCheckbox( pfr );
	gd.addDialogListener(this);
	previewing = true;
	gd.addHelp( "http://imagej.net/MorphoLibJ#Utilities_for_binary_images" );
	gd.showDialog();
	previewing = false;

	if (gd.wasCanceled())
		return DONE;

	// identify which weights should be used
	weights = ChamferWeights.fromLabel(
			gd.getNextChoice());
	resultAsFloat = gd.getNextChoiceIndex() == 0;
	normalize = gd.getNextBoolean();

	return flags;
}
 
Example #16
Source File: InteractiveMorphologicalReconstruction.java    From MorphoLibJ with GNU Lesser General Public License v3.0 4 votes vote down vote up
public int showDialog(
		ImagePlus imp,
		String command,
		final PlugInFilterRunner pfr )
{
	// Store user data
	this.imagePlus = imp;
	this.baseImage = imp.getProcessor().duplicate();
	this.pfr = pfr;

	/** ROI listener to update plugin when new ROIs are added */
	this.listener = new RoiListener() {
		@Override
		public void roiModified(ImagePlus imp, int id) {

			if( imp == imagePlus )
			{
				// set preview to false to restart plugin filter runner
				gd.getPreviewCheckbox().setState( false );

				pfr.dialogItemChanged( gd,
						new ActionEvent( gd.getPreviewCheckbox(),
								ActionEvent.ACTION_PERFORMED, "Preview" ) );
			}
		}
	};
	Roi.addRoiListener( listener );

	// select point tool for manual introduction of markers
	Toolbar.getInstance().setTool( Toolbar.POINT );

	// create the dialog
	gd = new NonBlockingGenericDialog( "Interactive Morphological "
			+ "Reconstruction");

	gd.addChoice("Type of Reconstruction",
			Operation.getAllLabels(),
			operation.label );
	gd.addChoice("Connectivity",
			Conn2D.getAllLabels(),
			connectivity.label );
	gd.addPreviewCheckbox( pfr );
	gd.addDialogListener(this);
	previewing = true;
	gd.addHelp( "http://imagej.net/MorphoLibJ" );
	gd.showDialog();
	previewing = false;

	if (gd.wasCanceled())
		return DONE;

	// set up current parameters
	operation = Operation.fromLabel(gd.getNextChoice());
	connectivity = Conn2D.fromLabel(gd.getNextChoice());

	return flags;
}
 
Example #17
Source File: LabelEdition.java    From MorphoLibJ with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Plug-in run method
 * 
 * @param arg plug-in arguments
 */
public void run(String arg) 
{
	if ( IJ.getVersion().compareTo("1.48a") < 0 )
	{
		IJ.error( "Label Edition", "ERROR: detected ImageJ version "
				+ IJ.getVersion() + ".\nLabel Edition requires"
				+ " version 1.48a or superior, please update ImageJ!" );
		return;
	}

	// get current image
	if ( null == WindowManager.getCurrentImage() )
	{
		inputImage = IJ.openImage();
		if ( null == inputImage )
			return; // user canceled open dialog
	}
	else
		inputImage = WindowManager.getCurrentImage();

	// Check if input image is a label image
	if( LabelImages.isLabelImageType( inputImage ) == false )
	{
		IJ.error( "Label Edition", "This plugin only works on"
			+ " label images.\nPlease convert it to 8, 16 or 32-bit." );
		return;
	}
	
	// select point tool for manual label merging
	Toolbar.getInstance().setTool( Toolbar.POINT );

	inputStackCopy = inputImage.getImageStack().duplicate();
	displayImage = new ImagePlus( inputImage.getTitle(), 
			inputStackCopy );
	displayImage.setTitle( "Label Edition" );
	displayImage.setSlice( inputImage.getCurrentSlice() );
	displayImage.setCalibration( inputImage.getCalibration() );

	// hide input image (to avoid accidental closing)
	inputImage.getWindow().setVisible( false );
	
	// set the 2D flag
	inputIs2D = inputImage.getImageStackSize() == 1;

	// correct Fiji error when the slices are read as frames
	if ( inputIs2D == false && 
			displayImage.isHyperStack() == false && 
			displayImage.getNSlices() == 1 )
	{
		// correct stack by setting number of frames as slices
		displayImage.setDimensions( 1, displayImage.getNFrames(), 1 );
	}

	// Build GUI
	SwingUtilities.invokeLater(
			new Runnable() {
				public void run() {
					win = new CustomWindow( displayImage );
					win.pack();
				}
			});
}