Java Code Examples for ij.gui.GenericDialog#invalidNumber()
The following examples show how to use
ij.gui.GenericDialog#invalidNumber() .
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: BinaryOrbit.java From orbit-image-analysis with GNU General Public License v3.0 | 6 votes |
public boolean dialogItemChanged (GenericDialog gd, AWTEvent e) { iterations = (int)gd.getNextNumber(); count = (int)gd.getNextNumber(); boolean bb = Prefs.blackBackground; Prefs.blackBackground = gd.getNextBoolean(); if ( Prefs.blackBackground!=bb) ThresholdAdjuster.update(); Prefs.padEdges = gd.getNextBoolean(); EDM.setOutputType(gd.getNextChoiceIndex()); boolean isInvalid = gd.invalidNumber(); if (iterations<1) {iterations = 1; isInvalid = true;} if (iterations>MAX_ITERATIONS) {iterations = MAX_ITERATIONS; isInvalid = true;} if (count < 1) {count = 1; isInvalid = true;} if (count > 8) {count = 8; isInvalid = true;} if (isInvalid) return false; if (imp != null) { operation = gd.getNextChoice(); arg = operation.toLowerCase(); } return true; }
Example 2
Source File: RankFiltersOrbit.java From orbit-image-analysis with GNU General Public License v3.0 | 5 votes |
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) { radius = gd.getNextNumber(); if (filterType == OUTLIERS) { threshold = gd.getNextNumber(); whichOutliers = gd.getNextChoiceIndex(); } int maxRadius = (filterType==MEDIAN || filterType==OUTLIERS || filterType==REMOVE_NAN) ? 100 : 1000; if (gd.invalidNumber() || radius<0 || radius>maxRadius || (filterType==OUTLIERS && threshold <0)) return false; return true; }
Example 3
Source File: ShenCastan.java From Scripts with GNU General Public License v3.0 | 5 votes |
/** * Reads dialog parameters (during preview and upon dismissal of dialog * prompt). * * @return <code>true</code>, if user specified valid input values */ @Override public boolean dialogItemChanged(final GenericDialog gd, final AWTEvent e) { f = gd.getNextNumber(); if (f < 0) f = 0d; if (f > 1) f = 1d; canceled = gd.invalidNumber(); if (gd.wasOKed() && canceled) { IJ.error("Value is invalid."); return false; } return true; }
Example 4
Source File: Align.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public boolean readSIFTFields( final GenericDialog gd ) { SIFT.readFields( gd, sift ); rod = ( float )gd.getNextNumber(); return !gd.invalidNumber(); }
Example 5
Source File: Align.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public boolean readGeometricConsensusFilterFields( final GenericDialog gd ) { maxEpsilon = ( float )gd.getNextNumber(); minInlierRatio = ( float )gd.getNextNumber(); minNumInliers = ( int )gd.getNextNumber(); expectedModelIndex = gd.getNextChoiceIndex(); rejectIdentity = gd.getNextBoolean(); identityTolerance = ( float )gd.getNextNumber(); return !gd.invalidNumber(); }
Example 6
Source File: Align.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public boolean readAlignmentFields( final GenericDialog gd ) { desiredModelIndex = gd.getNextChoiceIndex(); correspondenceWeight = ( float )gd.getNextNumber(); regularize = gd.getNextBoolean(); return !gd.invalidNumber(); }
Example 7
Source File: Align.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public boolean readRegularizationFields( final GenericDialog gd ) { regularizerModelIndex = gd.getNextChoiceIndex(); lambda = gd.getNextNumber(); return !gd.invalidNumber(); }
Example 8
Source File: Align.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
@Override public boolean readAlignmentFields( final GenericDialog gd ) { super.readAlignmentFields( gd ); maxIterations = ( int )gd.getNextNumber(); maxPlateauwidth = ( int )gd.getNextNumber(); filterOutliers = gd.getNextBoolean(); meanFactor = ( float )gd.getNextNumber(); return !gd.invalidNumber(); }
Example 9
Source File: Align.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
@Override public boolean readFields( final GenericDialog gd ) { super.readFields( gd ); maxIterations = ( int )gd.getNextNumber(); maxPlateauwidth = ( int )gd.getNextNumber(); filterOutliers = gd.getNextBoolean(); meanFactor = ( float )gd.getNextNumber(); return !gd.invalidNumber(); }
Example 10
Source File: Distortion_Correction.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public boolean readFields( final GenericDialog gd ) { SIFT.readFields( gd, sift ); rod = ( float )gd.getNextNumber(); maxEpsilon = ( float )gd.getNextNumber(); minInlierRatio = ( float )gd.getNextNumber(); expectedModelIndex = gd.getNextChoiceIndex(); dimension = ( int )gd.getNextNumber(); lambda = ( double )gd.getNextNumber(); return !gd.invalidNumber(); }
Example 11
Source File: Distortion_Correction.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
@Override public boolean readFields( final GenericDialog gd ) { super.readFields( gd ); return !gd.invalidNumber(); }
Example 12
Source File: Distortion_Correction.java From TrakEM2 with GNU General Public License v3.0 | 4 votes |
/** * Setup as a three step dialog. */ @Override public boolean setup( final String title ) { source_dir = ""; while ( source_dir == "" ) { final DirectoryChooser dc = new DirectoryChooser( "Calibration Images" ); source_dir = dc.getDirectory(); if ( null == source_dir ) return false; source_dir = source_dir.replace( '\\', '/' ); if ( !source_dir.endsWith( "/" ) ) source_dir += "/"; } final String exts = ".tif.jpg.png.gif.tiff.jpeg.bmp.pgm"; names = new File( source_dir ).list( new FilenameFilter() { @Override public boolean accept( final File dir, final String name ) { final int idot = name.lastIndexOf( '.' ); if ( -1 == idot ) return false; return exts.contains( name.substring( idot ).toLowerCase() ); } } ); Arrays.sort( names ); final GenericDialog gd = new GenericDialog( title ); gd.addNumericField( "number_of_images :", 9, 0 ); gd.addChoice( "first_image :", names, names[ 0 ] ); gd.addNumericField( "power_of_polynomial_kernel :", dimension, 0 ); gd.addNumericField( "lambda :", lambda, 6 ); gd.addCheckbox( "apply_correction_to_images", applyCorrection ); gd.addCheckbox( "visualize results", visualizeResults ); final String[] options = new String[]{ "save", "load" }; gd.addChoice( "What to do? ", options, options[ saveOrLoad ] ); gd.addStringField( "file_name: ", saveFileName ); gd.showDialog(); if (gd.wasCanceled()) return false; numberOfImages = ( int )gd.getNextNumber(); firstImageIndex = gd.getNextChoiceIndex(); dimension = ( int )gd.getNextNumber(); lambda = gd.getNextNumber(); applyCorrection = gd.getNextBoolean(); visualizeResults = gd.getNextBoolean(); saveOrLoad = gd.getNextChoiceIndex(); saveFileName = gd.getNextString(); if ( saveOrLoad == 0 || visualizeResults ) { final GenericDialog gds = new GenericDialog( title ); SIFT.addFields( gds, sift ); gds.addNumericField( "closest/next_closest_ratio :", rod, 2 ); gds.addMessage( "Geometric Consensus Filter:" ); gds.addNumericField( "maximal_alignment_error :", maxEpsilon, 2, 6, "px" ); gds.addNumericField( "inlier_ratio :", minInlierRatio, 2 ); gds.addChoice( "expected_transformation :", modelStrings, modelStrings[ expectedModelIndex ] ); gds.showDialog(); if ( gds.wasCanceled() ) return false; SIFT.readFields( gds, sift ); rod = ( float )gds.getNextNumber(); maxEpsilon = ( float )gds.getNextNumber(); minInlierRatio = ( float )gds.getNextNumber(); expectedModelIndex = gds.getNextChoiceIndex(); return !( gd.invalidNumber() || gds.invalidNumber() ); } return !gd.invalidNumber(); }