Java Code Examples for fiji.util.gui.GenericDialogPlus#addStringField()
The following examples show how to use
fiji.util.gui.GenericDialogPlus#addStringField() .
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: PluginHelper.java From SPIM_Registration with GNU General Public License v2.0 | 6 votes |
public static void addSaveAsFileField( final GenericDialogPlus dialog, final String label, final String defaultPath, final int columns) { dialog.addStringField( label, defaultPath, columns ); final TextField text = ( TextField ) dialog.getStringFields().lastElement(); final GridBagLayout layout = ( GridBagLayout ) dialog.getLayout(); final GridBagConstraints constraints = layout.getConstraints( text ); final Button button = new Button( "Browse..." ); final ChooseXmlFileListener listener = new ChooseXmlFileListener( text ); button.addActionListener( listener ); button.addKeyListener( dialog ); final Panel panel = new Panel(); panel.setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) ); panel.add( text ); panel.add( button ); layout.setConstraints( panel, constraints ); dialog.add( panel ); }
Example 2
Source File: DHM.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
protected DHMMetaData queryDirectoryAndRatio() { GenericDialogPlus gd = new GenericDialogPlus( "Specify Holographic Acquistion Directory" ); gd.addDirectoryField( "Holographic_Acquisition main directory", defaultDir, 50 ); gd.addMessage( "" ); gd.addMessage( "Camera pixel size (e.g. 3.45um) / Magnification (e.g. 20):" ); gd.addNumericField( "Pixel_distance_x", defaulCalX, 5 ); gd.addNumericField( "Pixel_distance_y", defaulCalY, 5 ); gd.addMessage( "Depth between planes (e.g. 0.5mm) / Magnification^2 (e.g. 20^2) * 1000 (mm to um):" ); gd.addNumericField( "Pixel_distance_z", defaulCalZ, 5 ); gd.addStringField( "Pixel_unit", defaulCalUnit ); gd.addMessage( "" ); gd.addCheckbox( "Open_all planes to ensure they have the same dimensions (takes time!)", defaultOpenAll ); gd.showDialog(); if ( gd.wasCanceled() ) return null; return new DHMMetaData( new File( defaultDir = gd.getNextString() ), defaulCalX = gd.getNextNumber(), defaulCalY = gd.getNextNumber(), defaulCalZ = gd.getNextNumber(), defaulCalUnit = gd.getNextString(), defaultOpenAll = gd.getNextBoolean() ); }
Example 3
Source File: Stitch_Image_Grid.java From Stitching with GNU General Public License v2.0 | 4 votes |
@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 4
Source File: Define_Multi_View_Dataset.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
public Pair< SpimData2, String > defineDataset( final boolean save ) { final ArrayList< MultiViewDatasetDefinition > datasetDefinitions = new ArrayList< MultiViewDatasetDefinition >(); for ( final MultiViewDatasetDefinition mvd : staticDatasetDefinitions ) datasetDefinitions.add( mvd.newInstance() ); // verify that there are definitions final int numDatasetDefinitions = datasetDefinitions.size(); if ( numDatasetDefinitions == 0 ) { IJ.log( "No Multi-View Dataset Definitions available." ); return null; } // get their names final String[] titles = new String[ numDatasetDefinitions ]; for ( int i = 0; i < datasetDefinitions.size(); ++i ) titles[ i ] = datasetDefinitions.get( i ).getTitle(); // query the dataset definition to use final GenericDialogPlus gd1 = new GenericDialogPlus( "Select type of multi-view dataset" ); if ( defaultDatasetDef >= numDatasetDefinitions ) defaultDatasetDef = 0; gd1.addChoice( "Type_of_dataset: ", titles, titles[ defaultDatasetDef ] ); //Choice choice = (Choice)gd1.getChoices().lastElement(); gd1.addStringField( "XML_filename", defaultXMLName, 30 ); /* final MyMultiLineLabel label = MyMultiLineLabel.addMessage( gd1, formatEntry( datasetDefinitions.get( defaultDatasetDef ).getExtendedDescription(), numCharacters, numLinesDocumentation ), new Font( Font.MONOSPACED, Font.PLAIN, 11 ), Color.BLACK ); addListeners( gd1, choice, label, datasetDefinitions );*/ GUIHelper.addWebsite( gd1 ); gd1.showDialog(); if ( gd1.wasCanceled() ) return null; defaultDatasetDef = gd1.getNextChoiceIndex(); final String xmlFileName = defaultXMLName = gd1.getNextString(); // run the definition final MultiViewDatasetDefinition def = datasetDefinitions.get( defaultDatasetDef ); IOFunctions.println( defaultDatasetDef ); final SpimData2 spimData = def.createDataset(); if ( spimData == null ) { IOFunctions.println( "Defining multi-view dataset failed." ); return null; } else { final String xml = SpimData2.saveXML( spimData, xmlFileName, "" ); if ( xml != null ) { GenericLoadParseQueryXML.defaultXMLfilename = xml; return new ValuePair< SpimData2, String >( spimData, xml ); } else { return null; } } }