/** @return the chosen mode, or -1 when canceled. */ final static private int chooseAlignmentMode() { final GenericDialog gdMode = new GenericDialog( "Montage mode" ); gdMode.addChoice( "mode :", modeStrings, modeStrings[ mode ] ); gdMode.showDialog(); if ( gdMode.wasCanceled() ) return -1; final int m = gdMode.getNextChoiceIndex(); // Set the static for future use mode = m; return m; }
/** * Querys a single element from the list * * @param name - type of elements (e.g. "Timepoint") * @param list - list of available elements * @param defaultSelection - default selection * @return the selection or -1 if cancelled */ public static int queryIndividualEntry( final String name, final String[] list, int defaultSelection ) { if ( defaultSelection >= list.length ) defaultSelection = 0; final GenericDialog gd = new GenericDialog( "Select Single " + name ); gd.addChoice( "Processing_" + name, list, list[ defaultSelection ] ); gd.showDialog(); if ( gd.wasCanceled() ) return -1; return gd.getNextChoiceIndex(); }
/**Dialog to ask which method to be used for Bleach Correction * * @return */ public boolean showDialog() { GenericDialog gd = new GenericDialog("Bleach Correction"); gd.addChoice("Correction Method :", CorrectionMethods , CorrectionMethods[CorrectionMethod]); gd.showDialog(); if (gd.wasCanceled()) return false; BleachCorrection.setCorrectionMethod(gd.getNextChoiceIndex()); return true; }
int showOptionDialog(int w1, int h1,int w, int h) { String[] options = new String[]{"inserting a cropped image", "inserting a reduced size image", "resizing the destination stack by adding border pixels", "resizing the destination stack by scaling it up"}; GenericDialog gd = new GenericDialog("Options"); gd.addMessage("The image does not fit. Source: "+w1+"x"+h1+" pixels. Dest.: "+w+"x"+h+" pixels."); gd.addChoice("Adjust by", options, options[0]); gd.showDialog(); if (gd.wasCanceled()) return QUIT; return gd.getNextChoiceIndex(); } public void windowClosing(WindowEvent e) {
int showDialog(String[] versions) { GenericDialog gd = new GenericDialog("ImageJ Updater 2"); gd.addChoice("Upgrade To:", versions, versions[0]); String msg = "You are currently running v"+ImageJ.VERSION+ImageJ.BUILD+".\n"+ " \n"+ "If you click \"OK\", ImageJ will quit\n"+ "and you will be running the upgraded\n"+ "version after you restart ImageJ.\n"; gd.addMessage(msg); gd.showDialog(); if (gd.wasCanceled()) return -1; else return gd.getNextChoiceIndex(); }
int showDialog(String[] versions) { GenericDialog gd = new GenericDialog("ImageJ Updater 2"); gd.addChoice("Upgrade To:", versions, versions[0]); String msg = "You are currently running v"+ImageJ.VERSION+ImageJ.BUILD+".\n"+ " \n"+ "If you click \"OK\", ImageJ will quit\n"+ "and you will be running the upgraded\n"+ "version after you restart ImageJ.\n"; gd.addMessage(msg); gd.showDialog(); if (gd.wasCanceled()) return -1; else return gd.getNextChoiceIndex(); }
private Collection<Layer> getLayerList(final String title) { final GenericDialog gd = new GenericDialog(title); Utils.addLayerRangeChoices(Display.this.layer, gd); gd.showDialog(); if (gd.wasCanceled()) return null; return layer.getParent().getLayers().subList(gd.getNextChoiceIndex(), gd.getNextChoiceIndex() +1); // exclusive end } private String getScriptPath() {
private void reset() { GenericDialog gd = new GenericDialog(""); gd.addChoice("Reset:", choices, choices[choiceIndex]); gd.showDialog(); if (gd.wasCanceled()) return; choiceIndex = gd.getNextChoiceIndex(); switch (choiceIndex) { case 0: unlock(); break; case 1: resetClipboard(); break; case 2: resetUndo(); break; } }
public boolean queryRegularizedModel() { final GenericDialog gd = new GenericDialog( "Regularization Parameters" ); gd.addChoice( "Model_to_regularize_with", regularizationModelChoice, regularizationModelChoice[ defaultRegularizationModelIndex ] ); gd.addNumericField( "Lamba", defaultLambda, 2 ); gd.showDialog(); if ( gd.wasCanceled() ) { this.regularize = false; return false; } this.regularizedModelIndex = defaultRegularizationModelIndex = gd.getNextChoiceIndex(); this.lambda = defaultLambda = gd.getNextNumber(); this.regularize = true; return true; }
private void reset() { GenericDialog gd = new GenericDialog(""); gd.addChoice("Reset:", choices, choices[choiceIndex]); gd.showDialog(); if (gd.wasCanceled()) return; choiceIndex = gd.getNextChoiceIndex(); switch (choiceIndex) { case 0: unlock(); break; case 1: resetClipboard(); break; case 2: resetUndo(); break; } }
protected int parseRegistrations( final GenericDialog gd ) { int transformation = defaultTransformationChoice = gd.getNextChoiceIndex(); if ( transformation == 2 ) { final GenericDialog gd2 = new GenericDialog( "Choose number of transformations" ); gd2.addNumericField( "Number of transformations to add", defaultNumTransformations, 0 ); gd2.showDialog(); if ( gd2.wasCanceled() ) return -1; else transformation = (int)Math.round( gd2.getNextNumber() ); } return transformation; }
public static boolean display( final SpimData2 spimData, final Collection< ? extends ViewId > viewCollection ) { final ArrayList< ViewId > viewIds = new ArrayList<>(); viewIds.addAll( viewCollection ); // filter not present ViewIds final List< ViewId > removed = SpimData2.filterMissingViews( spimData, viewIds ); if ( removed.size() > 0 ) IOFunctions.println( "(" + new Date( System.currentTimeMillis() ) + "): Removed " + removed.size() + " views because they are not present." ); final GenericDialog gd = new GenericDialog( "Display PSF's" ); gd.addChoice( "Display", displayChoices, displayChoices[ defaultDisplayChoice ] ); gd.showDialog(); if ( gd.wasCanceled() ) return false; return display( spimData, viewIds, defaultDisplayChoice = gd.getNextChoiceIndex() ); }
public boolean setup() { GenericDialog gd = new GenericDialog("Paint parameters"); gd.addSlider("Default_alpha", 0, 100, default_alpha * 100); final String[] modes = {"Allow overlap", "Exclude others", "Erode others"}; gd.addChoice("Paint mode", modes, modes[paint_mode]); gd.showDialog(); if (gd.wasCanceled()) return false; this.default_alpha = (float) gd.getNextNumber(); if (this.default_alpha > 1) this.default_alpha = 1f; else if (this.default_alpha < 0) this.default_alpha = 0.4f; // back to default's default value this.paint_mode = gd.getNextChoiceIndex(); // trigger update of GUI radio buttons on all displays: Display.toolChanged(ProjectToolbar.BRUSH); return true; }
protected ViewId askForReferenceView( final Subset< ViewId > subset, final String title ) { final GenericDialog gd = new GenericDialog( title ); final List< ViewId > views = Subset.getViewsSorted( subset.getViews() ); final String[] choice = new String[ subset.getViews().size() ]; for ( int i = 0; i < choice.length; ++i ) choice[ i ] = "ViewSetupId:" + views.get( i ).getViewSetupId() + " Timepoint:" + views.get( i ).getTimePointId(); if ( defaultReferenceView >= choice.length ) defaultReferenceView = 0; gd.addChoice( title.replace( " ", "_" ), choice, choice[ defaultReferenceView ] ); gd.showDialog(); if ( gd.wasCanceled() ) return null; return views.get( defaultReferenceView = gd.getNextChoiceIndex() ); }
final GenericDialog gd = new GenericDialog( "Choose interest point label to thin out" ); gd.addChoice( "Interest_points", labels, labels[ ThinOut_Detections.defaultLabel ] ); gd.showDialog(); if ( gd.wasCanceled() ) return null; return InterestPointTools.getSelectedLabel( labels, ThinOut_Detections.defaultLabel = gd.getNextChoiceIndex() );
protected ViewId getViewSelection( final String dialogHeader, final String text ) { final ArrayList< ViewDescription > views = SpimData2.getAllViewDescriptionsSorted( spimData, viewIdsToProcess ); final String[] viewChoice = new String[ views.size() ]; for ( int i = 0; i < views.size(); ++i ) { final ViewDescription vd = views.get( i ); viewChoice[ i ] = "Timepoint " + vd.getTimePointId() + ", ViewSetupId " + vd.getViewSetupId(); } if ( defaultViewChoice >= views.size() ) defaultViewChoice = 0; final GenericDialog gd = new GenericDialog( dialogHeader ); gd.addMessage( text ); gd.addChoice( "View", viewChoice, viewChoice[ defaultViewChoice ] ); gd.showDialog(); if ( gd.wasCanceled() ) return null; final ViewId viewId = views.get( defaultViewChoice = gd.getNextChoiceIndex() ); return viewId; }
public static boolean average( final SpimData2 spimData, final Collection< ? extends ViewId > viewCollection ) { final ArrayList< ViewId > viewIds = new ArrayList<>(); viewIds.addAll( viewCollection ); // filter not present ViewIds final List< ViewId > removed = SpimData2.filterMissingViews( spimData, viewIds ); if ( removed.size() > 0 ) IOFunctions.println( "(" + new Date( System.currentTimeMillis() ) + "): Removed " + removed.size() + " views because they are not present." ); final GenericDialog gd = new GenericDialog( "Average PSF's" ); gd.addChoice( "Averaged PSF", averagingChoices, averagingChoices[ defaultAveraging ] ); gd.addCheckbox( "Remove_min_intensity_projections_from_PSF", PSF_Extract.defaultRemoveMinIntensity ); gd.addMessage( "Note: Assigning to all input views will overwrite previous PSF", GUIHelper.smallStatusFont ); gd.showDialog(); if ( gd.wasCanceled() ) return false; return average( spimData, viewIds, defaultAveraging = gd.getNextChoiceIndex(), PSF_Extract.defaultRemoveMinIntensity = gd.getNextBoolean() ); }
final GenericDialog gd = new GenericDialog( "Choose interest point labels" ); gd.addChoice( "Interest_points", labels, labels[ ThinOut_Detections.defaultLabel ] ); gd.addChoice( "Relative_to", labels, labels[ RelativeThinOut_Detections.defaultRelativeLabel ] ); gd.showDialog(); if ( gd.wasCanceled() ) return null; labelSelection[ 0 ] = InterestPointTools.getSelectedLabel( labels, ThinOut_Detections.defaultLabel = gd.getNextChoiceIndex() ); labelSelection[ 1 ] = InterestPointTools.getSelectedLabel( labels, RelativeThinOut_Detections.defaultRelativeLabel = gd.getNextChoiceIndex() );
final GenericDialog gd = new GenericDialog("Select matching"); Utils.addLayerRangeChoices(layer, gd); gd.addStringField("Regular expression:", ""); types.put("17 - Dissector", Dissector.class); gd.addChoice("Type:", types.keySet().toArray(new String[types.size()]), types.firstKey()); gd.addCheckbox("Visible only", true); gd.showDialog(); if (gd.wasCanceled()) return Collections.EMPTY_LIST; final int first = gd.getNextChoiceIndex(); final int last = gd.getNextChoiceIndex(); return find(gd.getNextString(), gd.getNextBoolean(), (Class<T>)types.get(gd.getNextChoice()), first, last);
for (int i = 0; i < activeCount; i++) names[i] = threads[i].getName(); GenericDialog gd = new GenericDialog("Thread to kill"); gd.addChoice("thread", names, names[0]); gd.showDialog(); if (gd.wasCanceled()) return; int threadIndex = gd.getNextChoiceIndex(); threads[threadIndex].stop();