ij.gui.GenericDialog Java Examples

The following examples show how to use ij.gui.GenericDialog. 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: TransformationModel.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
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 = gd.getNextChoiceIndex();
	this.lambda = gd.getNextNumber();
	this.regularize = true;

	return true;
}
 
Example #2
Source File: LucasKanadeParameters.java    From BigStitcher with GNU General Public License v2.0 6 votes vote down vote up
public static LucasKanadeParameters getParametersFromGD(final GenericDialog gd, boolean askForModelType)
{
	if (gd.wasCanceled())
		return null;

	final int nIterations  = (int) gd.getNextNumber();
	final double minParameterChance = gd.getNextNumber();

	final WarpFunctionType modelType;
	if (askForModelType)
	{
		final int modelIdx = gd.getNextChoiceIndex();
		modelType = WarpFunctionType.values()[modelIdx];
	}
	else
		modelType = defaultModelType;

	boolean expertGrouping = gd.getNextBoolean();

	return new LucasKanadeParameters(modelType, nIterations, minParameterChance, expertGrouping);
}
 
Example #3
Source File: EfficientBayesianBased.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void queryAdditionalParameters( final GenericDialog gd )
{
	gd.addChoice( "ImgLib2_container_FFTs", BoundingBoxGUI.imgTypes, BoundingBoxGUI.imgTypes[ defaultFFTImgType ] );
	gd.addCheckbox( "Save_memory (not keep FFT's on CPU, 2x time & 0.5x memory)", defaultSaveMemory );
	saveMem = (Checkbox)gd.getCheckboxes().lastElement();
	gd.addChoice( "Type_of_iteration", iterationTypeString, iterationTypeString[ defaultIterationType ] );
	it = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "Image_weights", weightsString, weightsString[ defaultWeightType ] );
	weight = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "OSEM_acceleration", osemspeedupChoice, osemspeedupChoice[ defaultOSEMspeedupIndex ] );
	gd.addNumericField( "Number_of_iterations", defaultNumIterations, 0 );
	gd.addCheckbox( "Debug_mode", defaultDebugMode );
	gd.addCheckbox( "Adjust_blending_parameters (if stripes are visible)", defaultAdjustBlending );
	gd.addCheckbox( "Use_Tikhonov_regularization", defaultUseTikhonovRegularization );
	gd.addNumericField( "Tikhonov_parameter", defaultLambda, 4 );
	gd.addChoice( "Compute", blocksChoice, blocksChoice[ defaultBlockSizeIndex ] );
	block = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "Compute_on", computationOnChoice, computationOnChoice[ defaultComputationTypeIndex ] );
	gpu = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "PSF_estimation", extractPSFChoice, extractPSFChoice[ defaultExtractPSF ] );
	gd.addChoice( "PSF_display", displayPSFChoice, displayPSFChoice[ defaultDisplayPSF ] );
}
 
Example #4
Source File: AreaOpeningPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr)
{
	// Create the configuration dialog
	GenericDialog gd = new GenericDialog("Area Opening");

	gd.addNumericField("Pixel Number", 100, 0, 10, "pixels");
	
	gd.addPreviewCheckbox(pfr);
	gd.addDialogListener(this);
       previewing = true;
       gd.showDialog();
       previewing = false;
       
       if (gd.wasCanceled())
       	return DONE;
		
   	parseDialogParameters(gd);
		
	// clean up an return 
	gd.dispose();
	return flags;
}
 
Example #5
Source File: ReplaceLabelValuesPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void run(String arg0) 
{
	ImagePlus imagePlus = IJ.getImage();
	
	GenericDialog gd = new GenericDialog("Remove/Replace Label(s)");
	gd.addStringField("Label(s)", "1", 12);
	gd.addMessage("Separate label values by \",\"");
	gd.addNumericField("Final Value", 0, 0);
	gd.addMessage("Replacing by value 0\n will remove labels");
	gd.showDialog();
	
	if (gd.wasCanceled())
		return;
	
	String labelListString = gd.getNextString();
	double finalValue = gd.getNextNumber();

	float[] labelArray = parseLabels(labelListString);
	
	// replace values in original image
	LabelImages.replaceLabels(imagePlus, labelArray, (float) finalValue);
	imagePlus.updateAndDraw();
}
 
Example #6
Source File: SkeletonPlugin.java    From SNT with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean dialogItemChanged(final GenericDialog arg, final AWTEvent event) {

	useOnlySelectedPaths = gd.getNextRadioButton().contains("only");
	restrictByRoi = gd.getNextRadioButton().contains("only");
	restrictBySWCType = gd.getNextRadioButton().contains("only");
	final String analysisChoice = gd.getNextRadioButton();
	summarizeSkeleton = analysisChoice.contains("summary");
	callAnalyzeSkeleton = analysisChoice.contains("Analyze Skeleton");
	if (restrictBySWCType) {
		selectedSwcTypes.clear();
		for (final int type : Path.getSWCtypes()) {
			if (gd.getNextBoolean())
				selectedSwcTypes.add(type);
		}
	}
	final Vector<?> cbxs = gd.getCheckboxes();
	for (int i = 0; i < cbxs.size(); i++)
		((Checkbox) cbxs.get(i)).setEnabled(restrictBySWCType);

	return true;
}
 
Example #7
Source File: FilePathRepair.java    From TrakEM2 with GNU General Public License v3.0 6 votes vote down vote up
public void mousePressed(final MouseEvent me) {
	final JTable table = (JTable) me.getSource();
	final PathTableModel data = (PathTableModel) table.getModel();
	final int row = table.rowAtPoint(me.getPoint());
	if (-1 == row) return;

	if (2 == me.getClickCount()) {
		dispatcher.exec(new Runnable() { public void run() {
			try {
				table.setEnabled(false);
				GenericDialog gd = new GenericDialog("Fix paths");
				gd.addCheckbox("Fix other listed image files with identical parent directory", true);
				gd.addCheckbox("Fix all image files in the project with identical parent directory", true);
				gd.addCheckbox("Update mipmaps for each fixed path", false);
				gd.showDialog();
				if (!gd.wasCanceled()) {
					fixPath(table, data, row, gd.getNextBoolean(), gd.getNextBoolean(), gd.getNextBoolean());
				}
			} catch (Exception e) {
				IJError.print(e);
			} finally {
				table.setEnabled(true);
			}
		}});
	}
}
 
Example #8
Source File: Save3dTIFF.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void queryAdditionalParameters( final GenericDialog gd, final SpimData2 spimData )
{
	if ( defaultPath == null || defaultPath.length() == 0 )
	{
		defaultPath = spimData.getBasePath().getAbsolutePath();
		
		if ( defaultPath.endsWith( "/." ) )
			defaultPath = defaultPath.substring( 0, defaultPath.length() - 1 );
		
		if ( defaultPath.endsWith( "/./" ) )
			defaultPath = defaultPath.substring( 0, defaultPath.length() - 2 );
	}

	gd.addStringField( "Output_file_directory", defaultPath, 50 );
}
 
Example #9
Source File: GrayscaleAreaOpeningPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr)
{
	// Create the configuration dialog
	GenericDialog gd = new GenericDialog("Gray Scale Area Opening");

	gd.addNumericField("Pixel Number", 100, 0, 10, "pixels");
	
	gd.addPreviewCheckbox(pfr);
	gd.addDialogListener(this);
       previewing = true;
       gd.showDialog();
       previewing = false;
       
       if (gd.wasCanceled())
       	return DONE;
		
   	parseDialogParameters(gd);
		
	// clean up an return 
	gd.dispose();
	return flags;
}
 
Example #10
Source File: LayerSet.java    From TrakEM2 with GNU General Public License v3.0 6 votes vote down vote up
/** Returns false if the dialog was canceled or there wasn't any tag to remove. */
protected boolean askToRemoveTag(final int keyCode) {
	TreeSet<Tag> ts = getTags(keyCode);
	if (null == ts || ts.isEmpty()) return false;
	String[] tags = new String[ts.size()];
	int next = 0;
	for (Tag t : ts) tags[next++] = t.toString();
	GenericDialog gd = new GenericDialog("Remove tag");
	gd.addMessage("Remove a tag for key: " + ((char)keyCode));
	gd.addChoice("Remove:", tags, tags[0]);
	gd.showDialog();
	if (gd.wasCanceled()) return false;
	String tag = gd.getNextChoice();
	removeTag(tag, keyCode);
	return true;
}
 
Example #11
Source File: WeightedAverageFusion.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean parseAdditionalParameters( final GenericDialog gd )
{
	if ( this.getFusionType() == WeightedAvgFusionType.FUSEDATA )
	{
		defaultNumParalellViewsIndex = gd.getNextChoiceIndex();
		this.numParalellViews = defaultNumParalellViewsIndex;
		this.useBlending = Fusion.defaultUseBlending = gd.getNextBoolean();
		this.useContentBased = Fusion.defaultUseContentBased = gd.getNextBoolean();
	}
	else
	{
		this.useBlending = this.useContentBased = false;
	}
	this.interpolation = Fusion.defaultInterpolation = gd.getNextChoiceIndex();

	return true;
}
 
Example #12
Source File: AnimationEditor.java    From 3Dscript with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void runTextFromTo(boolean selection) {
	final TextEditorTab tab = getTab();
	tab.showOutput();
	tab.prepare();

	String text = tab.editorPane.getText();

	GenericDialog gd = new GenericDialog("Run from ... to ...");
	gd.addNumericField("From frame", -1, 0);
	gd.addNumericField("To frame", -1, 0);
	gd.showDialog();
	if(gd.wasCanceled())
		return;

	int from = (int)gd.getNextNumber();
	int to   = (int)gd.getNextNumber();

	try {
		animator.render(text, from, to);
	} catch(Exception ex) {
		handleException(ex);
		tab.restore();
		throw new RuntimeException("Error reading animations", ex);
	}
}
 
Example #13
Source File: DistanceTransformWatershed.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Called when a dialog widget has been modified: recomputes option values
 * from dialog content.
 */
public boolean dialogItemChanged(GenericDialog gd, AWTEvent evt)
{
	synchronized (this){
		// set up current parameters
		weightLabel = gd.getNextChoice();
		floatProcessing = gd.getNextChoiceIndex() == 0;
		normalize = gd.getNextBoolean();
		dynamic = (int) gd.getNextNumber();
		connLabel = gd.getNextChoice();
		connectivity = Conn2D.fromLabel( connLabel ).getValue();

		// identify which weights should be used
		weights = ChamferWeights.fromLabel( weightLabel );
	}
	return true;
}
 
Example #14
Source File: Utils.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
static public final void addLayerChoice(final String label, final Layer selected, final GenericDialog gd) {
	final String[] layers = new String[selected.getParent().size()];
	final ArrayList<String> al_layer_titles =  new ArrayList<String>();
	int i = 0;
	for (final Layer layer : selected.getParent().getLayers()) {
		layers[i] = selected.getProject().findLayerThing(layer).toString();
		al_layer_titles.add(layers[i]);
		i++;
	}
	final int i_layer = selected.getParent().indexOf(selected);
	gd.addChoice(label, layers, layers[i_layer]);

}
 
Example #15
Source File: MorphologicalFilterPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean dialogItemChanged(GenericDialog gd, AWTEvent evt)
{
	boolean wasPreview = this.previewing;
	parseDialogParameters(gd);
	
	// if preview checkbox was unchecked, replace the preview image by the original image
	if (wasPreview && !this.previewing)
	{
		resetPreview();
	}
	return true;
}
 
Example #16
Source File: AppendSpimData2.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean parseAdditionalParameters( final GenericDialog gd, final SpimData2 spimData )
{
	if ( appendToHdf5 != null )
		return appendToHdf5.parseAdditionalParameters( gd, spimData );

	return true;
}
 
Example #17
Source File: BoundingBoxGUI.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
protected GenericDialog getSimpleDialog( final boolean compress, final boolean allowModifyDimensions )
{
	final int[] rangeMin = new int[ 3 ];
	final int[] rangeMax = new int[ 3 ];

	setUpDefaultValues( rangeMin, rangeMax );

	final GenericDialog gd = new GenericDialog( "Manually define Bounding Box" );

	gd.addMessage( "Note: Coordinates are in global coordinates as shown " +
			"in Fiji status bar of a fused datasets", GUIHelper.smallStatusFont );

	if ( !compress )
		gd.addMessage( "", GUIHelper.smallStatusFont );

	gd.addSlider( "Minimal_X", rangeMin[ 0 ], rangeMax[ 0 ], this.min[ 0 ] );
	gd.addSlider( "Minimal_Y", rangeMin[ 1 ], rangeMax[ 1 ], this.min[ 1 ] );
	gd.addSlider( "Minimal_Z", rangeMin[ 2 ], rangeMax[ 2 ], this.min[ 2 ] );

	if ( !compress )
		gd.addMessage( "" );

	gd.addSlider( "Maximal_X", rangeMin[ 0 ], rangeMax[ 0 ], this.max[ 0 ] );
	gd.addSlider( "Maximal_Y", rangeMin[ 1 ], rangeMax[ 1 ], this.max[ 1 ] );
	gd.addSlider( "Maximal_Z", rangeMin[ 2 ], rangeMax[ 2 ], this.max[ 2 ] );

	if ( !allowModifyDimensions )
	{
		for ( int i = gd.getSliders().size() - 6; i < gd.getSliders().size(); ++i )
			((Scrollbar)gd.getSliders().get( i )).setEnabled( false );

		for ( int i = gd.getNumericFields().size() - 6; i < gd.getNumericFields().size(); ++i )
			((TextField)gd.getNumericFields().get( i )).setEnabled( false );
	}

	return gd;
}
 
Example #18
Source File: InteractivePlotter.java    From Scripts with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Displays a message dialog taking into account the position of the main
 * plugin prompt
 */
private void showMessage(final String title, final String msg) {
	final GenericDialog gd = new GenericDialog(title);
	gd.addMessage(msg);
	gd.setLocationRelativeTo(prompt);
	gd.hideCancelButton();
	gd.showDialog();
}
 
Example #19
Source File: AreaWrapper.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #20
Source File: AreaList.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void adjustProperties() {
	final GenericDialog gd = makeAdjustPropertiesDialog(); // in superclass
	gd.addCheckbox("Paint as outlines", !fill_paint);
	gd.addCheckbox("Apply paint mode to all AreaLists", false);
	gd.showDialog();
	if (gd.wasCanceled()) return;
	// superclass processing
	final Displayable.DoEdit prev = processAdjustPropertiesDialog(gd);
	// local proccesing
	final boolean fp = !gd.getNextBoolean();
	final boolean to_all = gd.getNextBoolean();
	if (to_all) {
		for (final ZDisplayable zd : this.layer_set.getZDisplayables()) {
			if (zd.getClass() == AreaList.class) {
				final AreaList ali = (AreaList)zd;
				ali.fill_paint = fp;
				ali.updateInDatabase("fill_paint");
				Display.repaint(this.layer_set, ali, 2);
			}
		}
	} else {
		if (this.fill_paint != fp) {
			prev.add("fill_paint", fp);
			this.fill_paint = fp;
			updateInDatabase("fill_paint");
		}
	}

	// Add current step, with the same modified keys
	final DoEdit current = new DoEdit(this).init(prev);
	if (isLinked()) current.add(new Displayable.DoTransforms().addAll(getLinkedGroup(null)));
	getLayerSet().addEditStep(current);
}
 
Example #21
Source File: GrayscaleAttributeFilteringPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr)
{
	// Create the configuration dialog
	GenericDialog gd = new GenericDialog("Gray Scale Attribute Filtering");

	gd.addChoice("Operation", Operation.getAllLabels(), Operation.OPENING.label);
	gd.addChoice("Attribute", Attribute.getAllLabels(), Attribute.AREA.label);
	gd.addNumericField("Minimum Value", 100, 0, 10, "pixels");
	gd.addChoice("Connectivity", connectivityLabels, connectivityLabels[0]);
	
	gd.addPreviewCheckbox(pfr);
	gd.addDialogListener(this);
       previewing = true;
	gd.showDialog();
       previewing = false;
       
       if (gd.wasCanceled())
       {
       	resetPreview();
       	return DONE;
       }	
       parseDialogParameters(gd);

       // clean up an return
	gd.dispose();
	return flags;
}
 
Example #22
Source File: IterativeClosestPoint.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addQuery( final GenericDialog gd, final RegistrationType registrationType )
{
	gd.addChoice( "Transformation model", TransformationModel.modelChoice, TransformationModel.modelChoice[ defaultModel ] );
	gd.addCheckbox( "Regularize_model", defaultRegularize );
	gd.addSlider( "Maximal_distance for correspondence (px)", 0.25, 40.0, IterativeClosestPointParameters.maxDistance );
	gd.addNumericField( "Maximal_number of iterations", IterativeClosestPointParameters.maxIterations, 0 );
}
 
Example #23
Source File: ChamferDistanceMapPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) 
  {
  	// Store user data
  	this.imagePlus = imp;
  	this.baseImage = imp.getProcessor().duplicate();
  	this.pfr = pfr;

  	// Create a new generic dialog with appropriate options
  	GenericDialog gd = new GenericDialog("Chamfer Distance Map");
  	gd.addChoice("Distances", ChamferWeights.getAllLabels(), 
  			ChamferWeights.BORGEFORS.toString());			
  	String[] outputTypes = new String[]{"32 bits", "16 bits"};
  	gd.addChoice("Output Type", outputTypes, outputTypes[0]);
  	gd.addCheckbox("Normalize weights", true);	
  	gd.addPreviewCheckbox(pfr);
  	gd.addDialogListener(this);
      previewing = true;
gd.addHelp("https://imagej.net/MorphoLibJ");
      gd.showDialog();
      previewing = false;
      
  	// test cancel  
  	if (gd.wasCanceled())
  		return DONE;

  	// set up current parameters
  	String weightLabel = gd.getNextChoice();
  	floatProcessing = gd.getNextChoiceIndex() == 0;
  	normalize = gd.getNextBoolean();

  	// identify which weights should be used
  	weights = ChamferWeights.fromLabel(weightLabel);

  	return flags;
  }
 
Example #24
Source File: SetLabelMapPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void run(String args)
{
	imagePlus = IJ.getImage();

	// Check image type
	if (isColorImage(imagePlus))
	{
		IJ.error("Image Type Error", "Requires a label image as input");
		return;
	}

	// Extract color model
	if (imagePlus.getStackSize() == 1)
	{
		oldColorModel = imagePlus.getProcessor().getColorModel();
	}
	else
	{
		oldColorModel = imagePlus.getStack().getColorModel();
	}

	// Display dialogs and waits for user validation
	GenericDialog gd = showDialog();
	if (gd.wasCanceled())
	{
		setColorModel(oldColorModel);
		imagePlus.updateAndDraw();
		return;
	}

	parseDialogParameters(gd);

	ColorModel cm = ColorMaps.createColorModel(colorMap, bgColor);
	setColorModel(cm);
	imagePlus.updateAndDraw();
}
 
Example #25
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 #26
Source File: AnalyzeSkeleton_.java    From AnalyzeSkeleton with GNU General Public License v3.0 5 votes vote down vote up
/** Disables dialog components that are irrelevant to GUI-based analysis. */
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e)
{
	if ( this.imRef.getRoi() == null && null != gd
			&& null != gd.getCheckboxes() )
	{
		Checkbox roiOption = (Checkbox)gd.getCheckboxes().elementAt(1);
		roiOption.setEnabled(false);
		if (Recorder.record) roiOption.setState(false);
	}
	return true;
}
 
Example #27
Source File: GeometricHashing.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addQuery( final GenericDialog gd, final RegistrationType registrationType )
{
	gd.addChoice( "Transformation model", TransformationModel.modelChoice, TransformationModel.modelChoice[ defaultModel ] );
	gd.addCheckbox( "Regularize_model", defaultRegularize );
	gd.addSlider( "Allowed_error_for_RANSAC (px)", 0.5, 20.0, RANSACParameters.max_epsilon );
	gd.addSlider( "Significance required for a descriptor match", 1.0, 20.0, GeometricHashingParameters.ratioOfDistance );
}
 
Example #28
Source File: RegionalMinAndMax3DPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
	public void run(String arg) {
		ImagePlus imagePlus = IJ.getImage();
		
		if (imagePlus.getStackSize() == 1) {
			IJ.error("Requires a Stack");
		}
		
		ImageStack stack = imagePlus.getStack();
		
		// Create the configuration dialog
		GenericDialog gd = new GenericDialog("Regional Min & Max 3D");
		gd.addChoice("Operation", Operation.getAllLabels(), 
				Operation.REGIONAL_MINIMA.label);
		gd.addChoice("Connectivity", connectivityLabels, connectivityLabels[0]);
//		gd.addHelp("http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:fast_morphological_filters:start");
        gd.showDialog();
        if (gd.wasCanceled())
        	return;
        
		// extract chosen parameters
		Operation op = Operation.fromLabel(gd.getNextChoice());
		int conn = connectivityValues[gd.getNextChoiceIndex()];
        
		long t0 = System.currentTimeMillis();
		
		ImageStack result = op.apply(stack, conn);

		String newName = createResultImageName(imagePlus, op);
		ImagePlus resultPlus = new ImagePlus(newName, result);
		resultPlus.copyScale(imagePlus);
		resultPlus.show();
		
		resultPlus.setSlice(imagePlus.getCurrentSlice());

		long t1 = System.currentTimeMillis();
		IJUtils.showElapsedTime(op.toString(), t1 - t0, imagePlus);
	}
 
Example #29
Source File: SetLabelMapPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void parseDialogParameters(GenericDialog gd)
{
	lutName = gd.getNextChoice();
	String bgColorName = gd.getNextChoice();
	bgColor = CommonColors.fromLabel(bgColorName).getColor();
	shuffleLut = gd.getNextBoolean();

	// I could not use more than 256 colors for the LUT with ShortProcessor,
	// problem at
	// ij.process.ShortProcessor.createBufferedImage(ShortProcessor.java:135)
	colorMap = CommonLabelMaps.fromLabel(lutName).computeLut(255, shuffleLut);
}
 
Example #30
Source File: DirectionalFilteringPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
	public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr)
	{
		// Normal setup
    	this.imagePlus = imp;
    	this.baseImage = imp.getProcessor().duplicate();

		// Create the configuration dialog
		GenericDialog gd = new GenericDialog("Directional Filtering");
		
		gd.addChoice("Type", Type.getAllLabels(), this.type.toString());
		gd.addChoice("Operation", Operation.getAllLabels(), this.op.toString());
		gd.addNumericField("Line Length", this.lineLength, 0, 8, "pixels");
		gd.addNumericField("Direction Number", this.nDirections, 0);
		
		gd.addPreviewCheckbox(pfr);
		gd.addDialogListener(this);
        previewing = true;
//		gd.addHelp("http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:fast_morphological_filters:start");
        gd.showDialog();
        previewing = false;
        
        if (gd.wasCanceled()) 
        {
			return DONE;
        }
        
    	parseDialogParameters(gd);
			
		// clean up an return 
		gd.dispose();
		return flags;
	}