Java Code Examples for mpicbg.imglib.image.display.imagej.ImageJFunctions#copyToImagePlus()

The following examples show how to use mpicbg.imglib.image.display.imagej.ImageJFunctions#copyToImagePlus() . 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: 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 2
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();
}
 
Example 3
Source File: SPIMImageFusion.java    From SPIM_Registration with GNU General Public License v2.0 votes vote down vote up
public ImagePlus getFusedImageCopy() { return ImageJFunctions.copyToImagePlus( getFusedImage() ); }