ij.gui.MultiLineLabel Java Examples

The following examples show how to use ij.gui.MultiLineLabel. 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: Multi_View_Fusion.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void run(String arg0) 
{
	// output to IJ.log
	IOFunctions.printIJLog = true;
	
	final GenericDialog gd = new GenericDialog( "Multi-view fusion" );
	
	gd.addChoice( "Select_channel type", fusionType, fusionType[ defaultFusionType ] );		
	gd.addMessage( "Please note that the Multi-view fusion is based on a publication.\n" +
					"If you use it successfully for your research please be so kind to cite our work:\n" +
					"Preibisch et al., Nature Methods (2010), 7(6):418-419\n" );

	MultiLineLabel text =  (MultiLineLabel) gd.getMessage();
	GUIHelper.addHyperLinkListener( text, paperURL );

	gd.showDialog();
	
	if ( gd.wasCanceled() )
		return;
	
	final int channelChoice = gd.getNextChoiceIndex();
	defaultFusionType = channelChoice;

	final SPIMConfiguration conf;
	if ( channelChoice == 0 )
		conf = getParameters( false );
	else 
		conf = getParameters( true );
	
	// cancelled
	if ( conf == null )
		return;
	
	conf.readSegmentation = true;
	conf.readRegistration = true;
	
	new Reconstruction( conf );
}
 
Example #2
Source File: Stitch_Multiple_Series_File.java    From Stitching with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run(String arg0)
{
	GenericDialogPlus gd = new GenericDialogPlus( "Stitch Multiple Series File" );
	
	gd.addFileField( "File", fileNameStatic, 50 );		
	gd.addCheckbox( "Compute_overlap (or trust coordinates in the file)", computeOverlapStatic );
	gd.addCheckbox( "Ignore_Calibration", ignoreCalibrationStatic );
	gd.addSlider( "Increase_overlap [%]", 0, 100, overlapStatic );
	gd.addCheckbox( "Invert_X coordinates", invertXStatic );
	gd.addCheckbox( "Invert_Y coordinates", invertYStatic );
	gd.addCheckbox("Ignore_Z_stage position", ignoreZStageStatic);
	             
	gd.addChoice( "Fusion_Method", methodListCollection, fusionMethodStatic );
	gd.addNumericField( "Fusion alpha", alphaStatic, 2 );
	gd.addNumericField( "Regression Threshold", thresholdRStatic, 2 );
	gd.addNumericField( "Max/Avg Displacement Threshold", thresholdDisplacementRelativeStatic, 2 );		
	gd.addNumericField( "Absolute Avg Displacement Threshold", thresholdDisplacementAbsoluteStatic, 2 );		
	gd.addCheckbox("Create_only_preview", previewOnlyStatic);
	gd.addMessage( "" );
	gd.addMessage( "This Plugin is developed by Stephan Preibisch\n" + myURL );

	MultiLineLabel text = (MultiLineLabel) gd.getMessage();
	addHyperLinkListener(text, myURL);

	gd.showDialog();
	if (gd.wasCanceled()) 
		return;

	String fileName = gd.getNextString();
	fileNameStatic = fileName;

	boolean computeOverlap = gd.getNextBoolean();
	computeOverlapStatic = computeOverlap;

	boolean ignoreCalibration = gd.getNextBoolean();
	ignoreCalibrationStatic = ignoreCalibration;
	
	double overlap = gd.getNextNumber();
	overlapStatic = overlap;

	boolean invertX = gd.getNextBoolean();
	invertXStatic = invertX;

	boolean invertY = gd.getNextBoolean();
	invertYStatic = invertY;

	boolean ignoreZStage = gd.getNextBoolean();
	ignoreZStageStatic = ignoreZStage;

	String fusionMethod = gd.getNextChoice();
	fusionMethodStatic = fusionMethod;
	
	this.alpha = gd.getNextNumber();
	alphaStatic = alpha;
	
	this.thresholdR = gd.getNextNumber();
	thresholdRStatic = thresholdR;
	
	this.thresholdDisplacementRelative = gd.getNextNumber();
	thresholdDisplacementRelativeStatic = thresholdDisplacementRelative;
	
	this.thresholdDisplacementAbsolute = gd.getNextNumber();
	thresholdDisplacementAbsoluteStatic = thresholdDisplacementAbsolute;
	
	boolean previewOnly = gd.getNextBoolean();
	previewOnlyStatic = previewOnly;

	ArrayList<ImageInformation> imageInformationList = parseMultiSeriesFile( fileName, overlap,  ignoreCalibration, invertX, invertY, ignoreZStage );
	
	if ( imageInformationList == null )
		return;
	
	for ( ImageInformation iI : imageInformationList )
	{
		Log.info( iI.imageName );
		
		String offset = "";
		for ( int d = 0; d < iI.offset.length; ++d )
			offset += iI.offset[ d ] + ", ";
		
		Log.info( offset );
	}

	final GridLayout gridLayout = new GridLayout();

	gridLayout.imageInformationList = imageInformationList;
	gridLayout.fusionMethod = fusionMethod;
	gridLayout.alpha = this.alpha;
	gridLayout.thresholdR = this.thresholdR;
	gridLayout.thresholdDisplacementRelative = this.thresholdDisplacementRelative;
	gridLayout.thresholdDisplacementAbsolute = this.thresholdDisplacementAbsolute;
	gridLayout.dim = imageInformationList.get( 0 ).dim;
	gridLayout.rgbOrder = rgbTypes[0];

	new Stitch_Image_Collection().work( gridLayout, previewOnly, computeOverlap, fileName + ".txt", true );
}
 
Example #3
Source File: Stitch_Image_Collection.java    From Stitching with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run(String arg0)
{
	GenericDialogPlus gd = new GenericDialogPlus("Stitch Image Collection");
	
	//gd.addStringField("Layout file", fileNameStatic, 50);
	gd.addFileField("Layout file", fileNameStatic, 50);		
	gd.addCheckbox("compute_overlap (otherwise use the coordinates given in the layout file)", computeOverlapStatic );
	gd.addChoice("Channels_for_Registration", colorList, handleRGBStatic);
	gd.addChoice("rgb_order", rgbTypes, rgbOrderStatic);
	gd.addChoice("Fusion_Method", methodListCollection, methodListCollection[LIN_BLEND]);
	gd.addNumericField("Fusion alpha", alphaStatic, 2);
	gd.addNumericField("Regression Threshold", thresholdRStatic, 2);
	gd.addNumericField("Max/Avg Displacement Threshold", thresholdDisplacementRelativeStatic, 2);		
	gd.addNumericField("Absolute Avg Displacement Threshold", thresholdDisplacementAbsoluteStatic, 2);		
	gd.addCheckbox("Create_only_Preview", previewOnlyStatic);
	gd.addMessage("");
	gd.addMessage("This Plugin is developed by Stephan Preibisch\n" + myURL);

	MultiLineLabel text = (MultiLineLabel) gd.getMessage();
	addHyperLinkListener(text, myURL);

	gd.showDialog();
	if (gd.wasCanceled()) return;

	String fileName = gd.getNextString();
	fileNameStatic = fileName;

	boolean computeOverlap = gd.getNextBoolean();
	computeOverlapStatic = computeOverlap;

	String handleRGB = gd.getNextChoice();
	handleRGBStatic = handleRGB;
	
	this.rgbOrder = gd.getNextChoice();
	rgbOrderStatic = rgbOrder;
	
	String fusionMethod = gd.getNextChoice();
	fusionMethodStatic = fusionMethod;
	
	this.alpha = gd.getNextNumber();
	alphaStatic = alpha;
	
	this.thresholdR = gd.getNextNumber();
	thresholdRStatic = thresholdR;
	
	this.thresholdDisplacementRelative = gd.getNextNumber();
	thresholdDisplacementRelativeStatic = thresholdDisplacementRelative;
	
	this.thresholdDisplacementAbsolute = gd.getNextNumber();
	thresholdDisplacementAbsoluteStatic = thresholdDisplacementAbsolute;
	
	boolean previewOnly = gd.getNextBoolean();
	previewOnlyStatic = previewOnly;
	
	work(fileName, previewOnly, computeOverlap, fusionMethod, handleRGB, true);		
}
 
Example #4
Source File: Stitch_Many_Images.java    From Stitching with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Manages the dialog for stitching a collection of images defined by a Tileconfiguration file
 */
public void stitchCollection()
{
	final GenericDialogPlus gd = new GenericDialogPlus("Stitch Image Collection");
	
	//gd.addStringField("Layout file", fileNameStatic, 50);
	gd.addFileField( "Layout file", fileNameStatic, 50 );		
	gd.addCheckbox( "compute_overlap (otherwise use the coordinates given in the layout file)", computeOverlapStatic );
	gd.addChoice( "Channels_for_Registration", colorList, handleRGBStatic );
	gd.addChoice( "rgb_order", rgbTypes, rgbOrderStatic );
	gd.addChoice( "Fusion_Method", methodListCollection, methodListCollection[LIN_BLEND] );
	gd.addNumericField( "Fusion alpha", alphaStatic, 2 );
	gd.addNumericField( "Regression Threshold", thresholdRStatic, 2 );
	gd.addNumericField( "Max/Avg Displacement Threshold", thresholdDisplacementRelativeStatic, 2 );		
	gd.addNumericField( "Absolute Avg Displacement Threshold", thresholdDisplacementAbsoluteStatic, 2 );		
	gd.addCheckbox( "Create_only_Preview", previewOnlyStatic );
	gd.addMessage( "");
	gd.addMessage( "This Plugin is developed by Stephan Preibisch\n" + myURL );

	MultiLineLabel text = (MultiLineLabel) gd.getMessage();
	addHyperLinkListener(text, myURL);

	gd.showDialog();
	if (gd.wasCanceled()) return;

	String fileName = gd.getNextString();
	fileNameStatic = fileName;

	boolean computeOverlap = gd.getNextBoolean();
	computeOverlapStatic = computeOverlap;

	String handleRGB = gd.getNextChoice();
	handleRGBStatic = handleRGB;
	
	String rgbOrder = gd.getNextChoice();
	rgbOrderStatic = rgbOrder;
	
	String fusionMethod = gd.getNextChoice();
	fusionMethodStatic = fusionMethod;
	
	double alpha = gd.getNextNumber();
	alphaStatic = alpha;
	
	double thresholdR = gd.getNextNumber();
	thresholdRStatic = thresholdR;
	
	double thresholdDisplacementRelative = gd.getNextNumber();
	thresholdDisplacementRelativeStatic = thresholdDisplacementRelative;
	
	double thresholdDisplacementAbsolute = gd.getNextNumber();
	thresholdDisplacementAbsoluteStatic = thresholdDisplacementAbsolute;
	
	boolean previewOnly = gd.getNextBoolean();
	previewOnlyStatic = previewOnly;	
	
	runStitching();
}
 
Example #5
Source File: Stitch_Image_Grid.java    From Stitching with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run(String arg0)
{
	GenericDialogPlus gd = new GenericDialogPlus("Stitch Image Grid");
	GridLayout gridLayout = new GridLayout();
	
	gd.addNumericField("grid_size_x", gridSizeXStatic, 0);
	gd.addNumericField("grid_size_y", gridSizeYStatic, 0);
	//gd.addChoice("order_of_storage", arrangement, arrangmentStatic );
	
	gd.addSlider("overlap [%]", 0, 100, overlapStatic);
	gd.addDirectoryField("directory", directoryStatic, 50);
	gd.addStringField("file_names", fileNamesStatic, 50);
	gd.addChoice("rgb_order", rgbTypes, rgbOrderStatic);
	gd.addStringField("Output_file_name", tileConfStatic, 50);
	gd.addCheckbox("Save_Only_Tile_Configuration", writeOnlyTileConfStatic);
	gd.addNumericField("start_x", startXStatic, 0);
	gd.addNumericField("start_y", startYStatic, 0);
	gd.addNumericField("start_i", startIStatic, 0);
	gd.addChoice("channels_for_registration", colorList, handleRGBStatic);
	gd.addChoice("fusion_method", methodListCollection, fusionMethodStatic);
	gd.addNumericField("fusion_alpha", alphaStatic, 2);
	gd.addNumericField("regression_threshold", thresholdRStatic, 2);
	gd.addNumericField("max/avg_displacement_threshold", thresholdDisplacementRelativeStatic, 2);		
	gd.addNumericField("absolute_displacement_threshold", thresholdDisplacementAbsoluteStatic, 2);		
	gd.addCheckbox("create_only_preview", previewOnlyStatic);
	gd.addCheckbox("compute_overlap (otherwise use the coordinates given in the layout file)", computeOverlapStatic );
	gd.addMessage("");
	gd.addMessage("This Plugin is developed by Stephan Preibisch\n" + myURL);

	MultiLineLabel text = (MultiLineLabel) gd.getMessage();
	addHyperLinkListener(text, myURL);

	gd.showDialog();
	if (gd.wasCanceled()) return;
	
	gridLayout.sizeX = (int)Math.round(gd.getNextNumber());
	gridLayout.sizeY = (int)Math.round(gd.getNextNumber());
	gridSizeXStatic = gridLayout.sizeX;
	gridSizeYStatic = gridLayout.sizeY;

	//gridLayout.arrangement = gd.getNextChoice();
	//arrangmentStatic = gridLayout.arrangement;
	
	double overlap = gd.getNextNumber()/100;
	overlapStatic = overlap*100;
	
	String directory = gd.getNextString();
	directoryStatic = directory;
	
	String filenames = gd.getNextString();
	fileNamesStatic = filenames;
	
	gridLayout.rgbOrder = gd.getNextChoice();
	rgbOrderStatic = gridLayout.rgbOrder;
	
	String output = gd.getNextString();
	tileConfStatic = output;
	
	boolean writeOnlyOutput = gd.getNextBoolean();
	writeOnlyTileConfStatic = writeOnlyOutput;
	
	int startX = (int)Math.round(gd.getNextNumber());
	startXStatic = startX;
	
	int startY = (int)Math.round(gd.getNextNumber());
	startYStatic = startY;
	
	int startI = (int)Math.round(gd.getNextNumber());
	startIStatic = startI;
	
	String handleRGB = gd.getNextChoice();
	handleRGBStatic = handleRGB;
	
	String fusionMethod = gd.getNextChoice();
	fusionMethodStatic = fusionMethod;
	
	gridLayout.alpha = gd.getNextNumber();
	alphaStatic = gridLayout.alpha;
	
	gridLayout.thresholdR = gd.getNextNumber();
	thresholdRStatic = gridLayout.thresholdR;
	
	gridLayout.thresholdDisplacementRelative = gd.getNextNumber();
	thresholdDisplacementRelativeStatic = gridLayout.thresholdDisplacementRelative;
	
	gridLayout.thresholdDisplacementAbsolute = gd.getNextNumber();
	thresholdDisplacementAbsoluteStatic = gridLayout.thresholdDisplacementAbsolute;
	
	boolean previewOnly = gd.getNextBoolean();
	previewOnlyStatic = previewOnly;
	
	boolean computeOverlap = gd.getNextBoolean();
	computeOverlapStatic = computeOverlap;
	
	stitchImageGrid(filenames, directory, gridLayout, handleRGB, 
			fusionMethod, output, overlap, startX, startY, startI, 
			writeOnlyOutput, previewOnly, computeOverlap);

}
 
Example #6
Source File: GUIHelper.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
public static final void addHyperLink( final GenericDialog gd, final String msg, final String url )
{
	gd.addMessage( msg, new Font( Font.SANS_SERIF, Font.ITALIC + Font.BOLD, 12 ) );
	MultiLineLabel text =  (MultiLineLabel) gd.getMessage();
	GUIHelper.addHyperLinkListener( text, url );
}
 
Example #7
Source File: GUIHelper.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
public static final void addPreibischLabWebsite( final GenericDialog gd )
{
	gd.addMessage( "This software is developed by the Preibisch Lab in collaboration with the ImgLib2 and Fiji team\nhttp://preibischlab.mdc-berlin.de/", new Font( Font.SANS_SERIF, Font.BOLD, 12 ) );
	MultiLineLabel text =  (MultiLineLabel) gd.getMessage();
	GUIHelper.addHyperLinkListener( text, "http://preibischlab.github.io/preibisch-labsite" );
}
 
Example #8
Source File: Bead_Registration.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
public static final void addHyperLinkListener( final MultiLineLabel text, final String myURL )
{
	GUIHelper.addHyperLinkListener( text, myURL );
}
 
Example #9
Source File: SnippetCreator.java    From Scripts with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean dialogItemChanged(final GenericDialog gd, final AWTEvent e) {
	final Object source = (e == null) ? null : e.getSource();
	final Vector<?> choices = gd.getChoices();
	final Vector<?> fields = gd.getStringFields();
	final Button[] buttons = gd.getButtons();
	final Choice fChoice = (Choice) choices.elementAt(0);
	final TextField fField = (TextField) fields.elementAt(0);
	final Button okButton = buttons[0];

	sFilename = gd.getNextString();
	sType = gd.getNextChoiceIndex();
	infoMsg = (MultiLineLabel) gd.getMessage();

	// Populate text area
	if (source == fChoice) {
		String header = "";
		switch (sType) {
		case BSH:
			header = bshHeader();
			break;
		case CLJ:
			header = cljHeader();
			break;
		case GRV:
			header = grvHeader();
			break;
		case IJM:
			header = ijmHeader();
			break;
		case JS:
			header = jsHeader();
			break;
		case PY:
			header = pyHeader();
			break;
		case RB:
			header = rbHeader();
			break;
		}
		if (header != "")
			appendToTextArea(header);

		// Ensure adequate filename extension
		if (!sFilename.endsWith(S_EXTS[sType])) {
			final int index = sFilename.lastIndexOf(".");
			if (index > -1)
				sFilename = sFilename.substring(0, index);
			sFilename += S_EXTS[sType];
			fField.setText(sFilename);
		}

	}

	// Adjust labels and fields
	final File f = new File(Utils.getMyRoutinesDir() + sFilename);
	final boolean invalidName = invalidFilename(sFilename);
	okButton.setLabel(f.exists() ? "Replace and Open" : " Create and Open ");
	fField.setForeground((f.exists()||invalidName) ? Color.RED : Color.BLACK);

	// Adjust messages
	final StringBuilder sb = new StringBuilder();
	if (invalidName) {
		sb.append("\nInvalid Filename");
	} else if (f.exists()) {
		sb.append("File already exists in BAR/My_Routines!");
	} else if (sFilename.indexOf("_") == -1) {
		sb.append("\nFile does not contain an underscore");
		sb.append("\nand will not be listed in the BAR Menu.");
	} else {
		sb.append("\nFile will be listed in the BAR Menu.");
	}
	infoMsg.setText(sb.toString());
	infoMsg.setForeground(Color.DARK_GRAY);

	return !invalidName;
}