Java Code Examples for fiji.util.gui.GenericDialogPlus#addFileField()

The following examples show how to use fiji.util.gui.GenericDialogPlus#addFileField() . 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: LightSheetZ1.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
protected File queryCZIFile()
{
	GenericDialogPlus gd = new GenericDialogPlus( "Define Lightsheet Z.1 Dataset" );

	gd.addFileField( "First_CZI file of the dataset", defaultFirstFile, 50 );

	gd.showDialog();

	if ( gd.wasCanceled() )
		return null;

	final File firstFile = new File( defaultFirstFile = gd.getNextString() );

	if ( !firstFile.exists() )
	{
		IOFunctions.println( "File '" + firstFile.getAbsolutePath() + "' does not exist. Stopping" );
		return null;
	}
	else
	{
		IOFunctions.println( "Investigating file '" + firstFile.getAbsolutePath() + "'." );
		return firstFile;
	}
}
 
Example 2
Source File: SlideBook6.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
protected File querySLDFile() {
    GenericDialogPlus gd = new GenericDialogPlus("Define SlideBook6 diSPIM Dataset");

    gd.addFileField("SlideBook6 SLD file", defaultFilePath, 50);
    gd.showDialog();

    if (gd.wasCanceled())
        return null;

    final File firstFile = new File(defaultFilePath = gd.getNextString());
    if (!firstFile.exists()) {
        IOFunctions.println("File '" + firstFile.getAbsolutePath() + "' does not exist. Stopping");
        return null;
    } else {
        IOFunctions.println("Investigating file '" + firstFile.getAbsolutePath() + "'.");
        return firstFile;
    }
}
 
Example 3
Source File: MicroManager.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
protected File queryMMFile()
{
	GenericDialogPlus gd = new GenericDialogPlus( "Define MicroMananger diSPIM Dataset" );

	gd.addFileField( "MicroManager OME TIFF file", defaultFirstFile, 50 );

	gd.showDialog();

	if ( gd.wasCanceled() )
		return null;

	final File firstFile = new File( defaultFirstFile = gd.getNextString() );

	if ( !firstFile.exists() )
	{
		IOFunctions.println( "File '" + firstFile.getAbsolutePath() + "' does not exist. Stopping" );
		return null;
	}
	else
	{
		IOFunctions.println( "Investigating file '" + firstFile.getAbsolutePath() + "'." );
		return firstFile;
	}
}
 
Example 4
Source File: Load_Tile_Configuration.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void run(String arg)
{
	// load SpimData
	final LoadParseQueryXML result = new LoadParseQueryXML();
	if ( !result.queryXML( "to load a TileConfiguration for", false, false, false, false, false ) )
		return;
	final SpimData2 data = result.getData();

	// ask for parameters
	final GenericDialogPlus gd = new GenericDialogPlus( "" );
	gd.addFileField( "TileConfiguration file", defaultTCFile );
	gd.addCheckbox( "Use_pixel_units", true );
	gd.addCheckbox( "Keep_metadata_rotation", true );

	gd.showDialog();

	if ( gd.wasCanceled() )
		return;

	defaultTCFile = gd.getNextString();
	final boolean pixelUnits = gd.getNextBoolean();
	final boolean metadataRotate = gd.getNextBoolean();

	// apply
	final Map< ViewId, Translation3D > tcParsed = TileConfigurationHelpers.parseTileConfiguration( new File( defaultTCFile ) );
	final Map< ViewId, Translation3D > transformsForData = TileConfigurationHelpers.getTransformsForData( tcParsed, pixelUnits, data );
	TileConfigurationHelpers.applyToData( transformsForData, pixelUnits, metadataRotate, data );

	// save result
	SpimData2.saveXML( data, result.getXMLFileName(), result.getClusterExtension() );
}
 
Example 5
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 6
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 7
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 8
Source File: Bead_Registration.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Can be called with values[ 3 ], i.e. [initialsigma, sigma2, threshold] or
 * values[ 2 ], i.e. [initialsigma, threshold]
 * 
 * The results are stored in the same array.
 * If called with values[ 2 ], sigma2 changing will be disabled
 * 
 * @param text - the text which is shown when asking for the file
 * @param values - the intial values and also contains the result
 */
public static void getInteractiveDoGParameters( final String text, final double values[] )
{
	final GenericDialogPlus gd = new GenericDialogPlus( text );		
	gd.addFileField( "", spimDataDirectory, 50 );		
	gd.showDialog();
	
	if ( gd.wasCanceled() )
		return;
	
	final String file = gd.getNextString();
	
	IOFunctions.println( "Loading " + file );
	final Image<FloatType> img = LOCI.openLOCIFloatType( file, new ArrayContainerFactory() );
	
	if ( img == null )
	{
		IOFunctions.println( "File not found: " + file );
		return;
	}
	
	img.getDisplay().setMinMax();
	final ImagePlus imp = ImageJFunctions.copyToImagePlus( img );
	img.close();
	
	imp.show();		
	imp.setSlice( imp.getStackSize() / 2 );	
	imp.setRoi( 0, 0, imp.getWidth()/3, imp.getHeight()/3 );		
	
	final InteractiveDoG idog = new InteractiveDoG();
	
	if ( values.length == 2 )
	{
		idog.setSigma2isAdjustable( false );
		idog.setInitialSigma( (float)values[ 0 ] );
		idog.setThreshold( (float)values[ 1 ] );
	}
	else
	{
		idog.setInitialSigma( (float)values[ 0 ] );
		idog.setThreshold( (float)values[ 2 ] );			
	}
	
	idog.run( null );
	
	while ( !idog.isFinished() )
		SimpleMultiThreading.threadWait( 100 );
	
	imp.close();
	
	if ( values.length == 2)
	{
		values[ 0 ] = idog.getInitialSigma();
		values[ 1 ] = idog.getThreshold();
	}
	else
	{
		values[ 0 ] = idog.getInitialSigma();
		values[ 1 ] = idog.getSigma2();						
		values[ 2 ] = idog.getThreshold();			
	}
}
 
Example 9
Source File: Bead_Registration.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Can be called with values[ 3 ], i.e. [r1, r2, threshold] (r2 is only written as result)
 * 
 * The results are stored in the same array.
 * 
 * @param text - the text which is shown when asking for the file
 * @param values - the intial values and also contains the result
 */
public static void getInteractiveIntegralParameters( final String text, final double values[] )
{
	final GenericDialogPlus gd = new GenericDialogPlus( text );		
	gd.addFileField( "", spimDataDirectory, 50 );		
	gd.showDialog();
	
	if ( gd.wasCanceled() )
		return;
	
	final String file = gd.getNextString();
	
	IOFunctions.println( "Loading " + file );
	final Image<FloatType> img = LOCI.openLOCIFloatType( file, new ArrayContainerFactory() );
	
	if ( img == null )
	{
		IOFunctions.println( "File not found: " + file );
		return;
	}
	
	img.getDisplay().setMinMax();
	final ImagePlus imp = ImageJFunctions.copyToImagePlus( img );
	img.close();
	
	imp.show();		
	imp.setSlice( imp.getStackSize() / 2 );	
	
	final InteractiveIntegral ii = new InteractiveIntegral();
	
	ii.setInitialRadius( Math.round( (float)values[ 0 ] ) );
	ii.setThreshold( (float)values[ 2 ] );
	
	ii.run( null );
	
	while ( !ii.isFinished() )
		SimpleMultiThreading.threadWait( 100 );
	
	imp.close();
	
	values[ 0 ] = ii.getRadius1();
	values[ 1 ] = ii.getRadius2();
	values[ 2 ] = ii.getThreshold();
}