本文整理汇总了Java中fiji.util.gui.GenericDialogPlus类的典型用法代码示例。如果您正苦于以下问题:Java GenericDialogPlus类的具体用法?Java GenericDialogPlus怎么用?Java GenericDialogPlus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GenericDialogPlus类属于fiji.util.gui包,在下文中一共展示了GenericDialogPlus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBrowseToCellVoyagerFolder
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
public static void addBrowseToCellVoyagerFolder( 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 ChooseCellVoyagerDirListener listener = new ChooseCellVoyagerDirListener( 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 );
}
示例2: addSaveAsFileField
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
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 );
}
示例3: queryCZIFile
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
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;
}
}
示例4: querySLDFile
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
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;
}
}
示例5: queryMMFile
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
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;
}
}
示例6: getParameters
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
public static Parameters getParameters()
{
final GenericDialogPlus gd = new GenericDialogPlus( "Resave dataset as TIFF" );
if ( defaultPath == null )
defaultPath = LoadParseQueryXML.defaultXMLfilename;
PluginHelper.addSaveAsFileField( gd, "Select new XML", defaultPath, 80 );
gd.addChoice( "ImgLib2_data_container", StackList.imglib2Container, StackList.imglib2Container[ defaultContainer ] );
gd.addCheckbox( "Lossless compression of TIFF files (ZIP)", defaultCompress );
gd.addMessage( "Use ArrayImg if -ALL- input views are smaller than ~2048x2048x500 px (2^31 px), or if the\n" +
"program throws an OutOfMemory exception while processing. CellImg is slower, but more\n" +
"memory efficient and supports much larger file sizes only limited by the RAM of the machine.",
new Font( Font.SANS_SERIF, Font.ITALIC, 11 ) );
gd.showDialog();
if ( gd.wasCanceled() )
return null;
final Parameters params = new Parameters();
params.xmlFile = gd.getNextString();
if ( !params.xmlFile.endsWith( ".xml" ) )
params.xmlFile += ".xml";
params.compress = defaultCompress = gd.getNextBoolean();
defaultPath = LoadParseQueryXML.defaultXMLfilename = params.xmlFile;
if ( ( defaultContainer = gd.getNextChoiceIndex() ) == 0 )
params.imgFactory = new ArrayImgFactory< FloatType >();
else
params.imgFactory = new CellImgFactory< FloatType >();
return params;
}
示例7: queryDirectoryAndRatio
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
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() );
}
示例8: loadNativeLibrary
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
public static < L extends Library > L loadNativeLibrary( ArrayList< String > potentialNames, final Class< L > library )
{
final GenericDialogPlus gd = new GenericDialogPlus( "Specify path of native library" );
final String directory;
if ( defaultDirectory == null )
directory = IJ.getDirectory( "ImageJ" );
else
directory = defaultDirectory;
final File dir;
if ( directory == null || directory.equals( "null/") )
dir = new File( "" );
else
dir = new File( directory );
gd.addDirectoryField( "CUDA_Directory", dir.getAbsolutePath(), 80 );
gd.showDialog();
if ( gd.wasCanceled() )
return null;
return loadNativeLibrary( potentialNames, new File( defaultDirectory = gd.getNextString() ), library );
}
示例9: getAllFilesInDirectory
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
protected ArrayList< ImageCollectionElement > getAllFilesInDirectory( final String directory, final boolean confirmFiles )
{
// get all files from the directory
final File dir = new File( directory );
if ( !dir.isDirectory() )
{
Log.error( "'" + directory + "' is not a directory. stop.");
return null;
}
final String[] imageFiles = dir.list();
final ArrayList<String> files = new ArrayList<String>();
for ( final String fileName : imageFiles )
{
File file = new File( dir, fileName );
if ( file.isFile() && !file.isHidden() && !fileName.endsWith( ".txt" ) && !fileName.endsWith( ".TXT" ) )
{
Log.info( file.getPath() );
files.add( fileName );
}
}
Log.info( "Found " + files.size() + " files (we ignore hidden and .txt files)." );
if ( files.size() < 2 )
{
Log.error( "Only " + files.size() + " files found in '" + dir.getPath() + "', you need at least 2 - stop." );
return null ;
}
final boolean[] useFile = new boolean[ files.size() ];
for ( int i = 0; i < files.size(); ++i )
useFile[ i ] = true;
if ( confirmFiles )
{
final GenericDialogPlus gd = new GenericDialogPlus( "Confirm files" );
for ( final String name : files )
gd.addCheckbox( name, true );
gd.showDialog();
if ( gd.wasCanceled() )
return null;
for ( int i = 0; i < files.size(); ++i )
useFile[ i ] = gd.getNextBoolean();
}
final ArrayList< ImageCollectionElement > elements = new ArrayList< ImageCollectionElement >();
for ( int i = 0; i < files.size(); ++i )
if ( useFile [ i ] )
elements.add( new ImageCollectionElement( new File( directory, files.get( i ) ), i ) );
if ( elements.size() < 2 )
{
Log.error( "Only " + elements.size() + " files selected, you need at least 2 - stop." );
return null ;
}
return elements;
}
示例10: run
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
@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);
}
示例11: stitchCollection
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
/**
* 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();
}
示例12: getInput
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
/**
* Displays a dialog to harvest user input, allowing scaling from a
* specified image width and height.
*
* @param imgWidth Base image width
* @param imgHeight Base image height
*/
public void getInput(int imgWidth, int imgHeight) {
originalWidth = imgWidth;
originalHeight = imgHeight;
final GenericDialogPlus gdDownSample = new GenericDialogPlus("Downsample");
String[] methods = ImageProcessor.getInterpolationMethods();
gdDownSample.addNumericField("x scale", 1, 1);
gdDownSample.addNumericField("y scale", 1, 1);
gdDownSample.addNumericField("width (pixels)", imgWidth, 0);
gdDownSample.addNumericField("height (pixels)", imgHeight, 0);
gdDownSample.addChoice("Interpolation:", methods,
methods[methods.length - 1]);
gdDownSample.addCheckbox("Average when downsizing", true);
Vector<?> fields = gdDownSample.getNumericFields();
xField = (TextComponent) fields.get(0);
yField = (TextComponent) fields.get(1);
widthField = (TextComponent) fields.get(2);
heightField = (TextComponent) fields.get(3);
xField.addTextListener(textListener);
xField.addFocusListener(focusListener);
yField.addTextListener(textListener);
yField.addFocusListener(focusListener);
widthField.addTextListener(textListener);
widthField.addFocusListener(focusListener);
heightField.addTextListener(textListener);
heightField.addFocusListener(focusListener);
gdDownSample.showDialog();
if (gdDownSample.wasOKed()) {
xScale = gdDownSample.getNextNumber();
yScale = gdDownSample.getNextNumber();
double width = gdDownSample.getNextNumber();
double height = gdDownSample.getNextNumber();
String method = gdDownSample.getNextChoice();
String average = gdDownSample.getNextBoolean() ? " average" : "";
params =
"width=" + width + " height=" +
height + average + " interpolation=" + method;
}
}
示例13: getParameters
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
protected Parameters getParameters( final String sourcePathStr )
{
while ( true )
{
final GenericDialogPlus gd = new GenericDialogPlus( "CellVoyager Import" );
gd.addStringField( "Subsampling factors", lastSubsampling, 25 );
gd.addStringField( "Hdf5 chunk sizes", lastChunkSizes, 25 );
gd.addMessage( "" );
if ( null == sourcePathStr )
{
if ( null == sourceFolderStr )
{
final File folder = new File( System.getProperty( "user.dir" ) ).getParentFile().getParentFile();
sourceFolderStr = folder.getAbsolutePath();
}
}
else
{
sourceFolderStr = sourcePathStr;
}
addBrowseToCellVoyagerFolder( gd, "Measurement folder", sourceFolderStr, 25 );
if ( null == lastExportPath )
{
final File sourceFile = new File( sourceFolderStr );
final String parentFolder = sourceFile.getParent();
lastExportPath = new File( parentFolder, "export.xml" ).getAbsolutePath();
}
PluginHelper.addSaveAsFileField( gd, "Export to", lastExportPath, 25 );
gd.showDialog();
if ( gd.wasCanceled() )
return null;
lastSubsampling = gd.getNextString();
lastChunkSizes = gd.getNextString();
sourceFolderStr = gd.getNextString();
lastExportPath = gd.getNextString();
// parse mipmap resolutions and cell sizes
final int[][] resolutions = PluginHelper.parseResolutionsString( lastSubsampling );
final int[][] subdivisions = PluginHelper.parseResolutionsString( lastChunkSizes );
if ( resolutions.length == 0 )
{
IJ.showMessage( "Cannot parse subsampling factors: " + lastSubsampling );
continue;
}
if ( subdivisions.length == 0 )
{
IJ.showMessage( "Cannot parse hdf5 chunk sizes: " + lastChunkSizes );
continue;
}
else if ( resolutions.length != subdivisions.length )
{
IJ.showMessage( "Subsampling factors and hdf5 chunk sizes must have the same number of elements." );
continue;
}
final File sourceFolder = new File( sourceFolderStr );
String seqFilename = lastExportPath;
if ( !seqFilename.endsWith( ".xml" ) )
seqFilename += ".xml";
final File seqFile = new File( seqFilename );
final File parent = seqFile.getParentFile();
if ( parent == null || !parent.exists() || !parent.isDirectory() )
{
IJ.showMessage( "Invalid export filename " + seqFilename );
continue;
}
final String hdf5Filename = seqFilename.substring( 0, seqFilename.length() - 4 ) + ".h5";
final File hdf5File = new File( hdf5Filename );
return new Parameters( resolutions, subdivisions, sourceFolder, seqFile, hdf5File );
}
}
示例14: defineDataset
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
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;
}
}
}
示例15: getInteractiveDoGParameters
import fiji.util.gui.GenericDialogPlus; //导入依赖的package包/类
/**
* 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();
}
}