当前位置: 首页>>代码示例>>Java>>正文


Java ImageJFunctions类代码示例

本文整理汇总了Java中mpicbg.imglib.image.display.imagej.ImageJFunctions的典型用法代码示例。如果您正苦于以下问题:Java ImageJFunctions类的具体用法?Java ImageJFunctions怎么用?Java ImageJFunctions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImageJFunctions类属于mpicbg.imglib.image.display.imagej包,在下文中一共展示了ImageJFunctions类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: wrap

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static final Image< FloatType > wrap( final Img< net.imglib2.type.numeric.real.FloatType > i )
{
	if ( i instanceof ImagePlusImg )
	{
		try
		{
			return ImageJFunctions.wrapFloat( ((ImagePlusImg) i).getImagePlus() );
		}
		catch (ImgLibException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}			
	}
	else
	{
		return ImgLib2.wrapFloatToImgLib1( i );
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:22,代码来源:LRFFT.java

示例2: saveAsTiffs

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
@Override
public boolean saveAsTiffs( final String dir, final String name, final int channelIndex )
{
	if ( channelIndex > 0 )
		return true;

	boolean success = true;

	for ( int i = 0; i < fusedImages.length; i++ )
	{
		final ViewDataBeads view = viewStructure.getViews().get( angleIndicies[ i ] );

		if ( viewStructure.getDebugLevel() <= ViewStructure.DEBUG_MAIN )
			IOFunctions.println( "(" + new Date(System.currentTimeMillis()) + "): Saving '" + name + "_ch" + view.getChannel() + "_angle" + view.getAcqusitionAngle() + "'" );

		success &= ImageJFunctions.saveAsTiffs( fusedImages[ i ], dir, name + "_ch" + view.getChannel() + "_angle" + view.getAcqusitionAngle(), ImageJFunctions.GRAY32 );
	}

	return success;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:21,代码来源:MappingFusionSequentialDifferentOutput.java

示例3: actionPerformed

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
@Override
public void actionPerformed( final ActionEvent e ) 
{
	if ( chartPanel != null )
	{
		// this might fail horribly, but at the moment it is the only solution
		// as right clicks in the chart are not reported to the mouse-listener
		// if they happen above the line drawings
		try
		{
			final JMenuItem item = (JMenuItem)e.getSource(); 
			final JPopupMenu m = (JPopupMenu)item.getParent();

			// location of the top left pixel of the chartpanel in screen coordinates
			final Point p = chartPanel.getLocationOnScreen();

			// we parse the position of the JPopupMenu on the screen (AAARGH!!!)
			final String output = m.toString();

			final String x = output.substring( output.indexOf( "desiredLocationX" ) );
			final String y = output.substring( output.indexOf( "desiredLocationY" ) );

			System.out.println( "chart: " +p );

			System.out.println( "popup: " + x + ", " + y );

			// and from that we get the relative coordinate in the chartpanel 
			p.x = Integer.parseInt( x.substring( x.indexOf( "=" )+1, x.indexOf( "," ) ) ) - p.x;
			p.y = Integer.parseInt( y.substring( y.indexOf( "=" )+1, y.indexOf( "," ) ) ) - p.y;
			
			// now we transform it into the correct timelapse scale
			final int tp = MouseListenerTimelapse.getChartXLocation( p, chartPanel );
			
			// now find the correct image
			for ( final RegistrationStatistics stat : data )
				if ( stat.timePoint == tp )
				{
					final Image<FloatType> image = LOCI.openLOCIFloatType( stat.worstView.getAbsolutePath(), new ArrayContainerFactory() );
					ImageJFunctions.show( image );
					break;
				}
		}
		catch ( Exception ex ) {}
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:46,代码来源:FileOpenMenuEntry.java

示例4: getInteractiveDoGParameters

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的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();			
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:72,代码来源:Bead_Registration.java

示例5: getInteractiveIntegralParameters

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:52,代码来源:Bead_Registration.java

示例6: main

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
public static void main( String[] args )
{
	new ImageJ();
	//final Image< FloatType > img = LOCI.openLOCIFloatType( "/Users/preibischs/Desktop/Geburtstagsfaust.jpg", new ArrayContainerFactory() );
	final Image< FloatType > img = LOCI.openLOCIFloatType( "/Users/preibischs/Desktop/spim.tif", new ArrayContainerFactory() );
			
	final Image< FloatType > kernel = FourierConvolution.createGaussianKernel( img.getContainerFactory(), new double[]{ 10, 10, 10 } );
	//ImageJFunctions.show( img );
	//final FourierConvolution< FloatType, FloatType > t = new FourierConvolution<FloatType, FloatType>( img, kernel );
	//t.process();
	//ImageJFunctions.show( t.getResult() );		
	
	final int[] imgSize = img.getDimensions();//new int[]{ 256, 384 };
	final int[] blockSize = new int[]{ 256, 256, 256 };
	
	//for ( int d = 0; d < blockSize.length; ++d )
	//	blockSize[ d ] = img.getDimension( d ) + kernel.getDimension( d ) - 1;
	
	final int[] kernelSize = kernel.getDimensions();//new int[]{ 51, 25 };
	
	final Block[] blocks = Block.divideIntoBlocks( imgSize, blockSize, kernelSize );
	
	final ArrayList< Image< FloatType > > blockImgs = new ArrayList< Image< FloatType > >();
	final ImageFactory< FloatType > factory = new ImageFactory< FloatType >( new FloatType(), new ArrayContainerFactory() );
	
	ImageJFunctions.show( img );	
	
	for ( int i = 0; i < blocks.length; ++i )
		blockImgs.add( factory.createImage( blockSize ) );
	
	long time = 0;
	
	//while ( time >= 0 )
	{
		time = System.currentTimeMillis();
		for ( int i = 0; i < blocks.length; ++i )
		{
			blocks[ i ].copyBlock( img, blockImgs.get( i ) );
			//ImageJFunctions.show( block );
		}

		System.out.println( System.currentTimeMillis() - time );
		//System.exit( 0 );
	}
	
	
	/*
	final FourierConvolution< FloatType, FloatType > t2 = new FourierConvolution<FloatType, FloatType>( blockImgs.get( 0 ), kernel );
	//t2.setExtendImageByKernelSize( false );

		//for ( final FloatType t : block )
		//	t.set( t.get() + 20*(i+1) );

	*/

	final Image< FloatType > img2 = img.createNewImage();
	
	//while ( time > 0 )
	{
		time = System.currentTimeMillis();

		for ( int i = 0; i < blocks.length; ++i )
		{
			//t2.replaceImage( blockImgs.get( i ) );
			//t2.process();
			
			blocks[ i ].pasteBlock( img2,  blockImgs.get( i ) );
			//ImageJFunctions.show( t.getResult() );
		}
		
		System.out.println( System.currentTimeMillis() - time );
	}
	ImageJFunctions.show( img2 );
	
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:76,代码来源:Block.java

示例7: addAlphaMaskLocal

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
/** Add the given area, in local coordinates, to the alpha mask, using the given fill value. */
public void addAlphaMaskLocal(final Area aLocal, int value) {
	if (value < 0) value = 0;
	if (value > 255) value = 255;
	//
	CoordinateTransform ct = null;
	if (hasCoordinateTransform() && null == (ct = getCT())) {
		return;
	}

	// When the area is larger than the image, sometimes the area fails to be set at all
	// Also, intersection accelerates calls to contains(x,y) for complex polygons
	final Area a = new Area(new Rectangle(0, 0, (int)(width+1), (int)(height+1)));
	a.intersect(aLocal);


	if (M.isEmpty(a)) {
		Utils.log("ROI does not intersect the active image!");
		return;
	}

	ByteProcessor mask = getAlphaMask();

	// Use imglib to bypass all the problems with ShapeROI
	// Create a Shape image with background and the Area on it with 'value'
	final int background = (null != mask && 255 == value) ? 0 : 255;
	final ShapeList<UnsignedByteType> shapeList = new ShapeList<UnsignedByteType>(new int[]{(int)width, (int)height, 1}, new UnsignedByteType(background));
	shapeList.addShape(a, new UnsignedByteType(value), new int[]{0});
	final mpicbg.imglib.image.Image<UnsignedByteType> shapeListImage = new mpicbg.imglib.image.Image<UnsignedByteType>(shapeList, shapeList.getBackground(), "mask");

	ByteProcessor rmask = (ByteProcessor) ImageJFunctions.copyToImagePlus(shapeListImage, ImagePlus.GRAY8).getProcessor();

	if (hasCoordinateTransform()) {
		// inverse the coordinate transform
		final TransformMesh mesh = new TransformMesh(ct, meshResolution, o_width, o_height);
		final TransformMeshMapping mapping = new TransformMeshMapping( mesh );
		rmask = (ByteProcessor) mapping.createInverseMappedImageInterpolated(rmask);
	}

	if (null == mask) {
		// There wasn't a mask, hence just set it
		mask = rmask;
	} else {
		final byte[] b1 = (byte[]) mask.getPixels();
		final byte[] b2 = (byte[]) rmask.getPixels();
		// Whatever is not background in the new mask gets set on the old mask
		for (int i=0; i<b1.length; i++) {
			if (background == (b2[i]&0xff)) continue; // background pixel in new mask
			b1[i] = b2[i]; // replace old pixel with new pixel
		}
	}
	setAlphaMask(mask);
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:54,代码来源:Patch.java

示例8: getWrappedImageUnsignedByte

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
/**
 * return an {@link Image} of {@link UnsignedByteType} as input for the PhaseCorrelation. If no rectangular roi
 * is selected, it will only wrap the existing ImagePlus!
 * 
 * @param imp - the {@link ImagePlus}
 * @param channel - which channel (if channel=0 means average all channels)
 * @param timepoint - which timepoint
 * 
 * @return - the {@link Image} or null if it was not an ImagePlus.GRAY8 or if channel = 0
 */
public static Image<UnsignedByteType> getWrappedImageUnsignedByte( final ImagePlus imp, final int channel, final int timepoint )
{
	if ( channel == 0 || imp.getType() != ImagePlus.GRAY8 )
		return null;
	return ImageJFunctions.wrapByte( Hyperstack_rearranger.getImageChunk( imp, channel, timepoint ) );
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:17,代码来源:PairWiseStitchingImgLib.java

示例9: getWrappedImageUnsignedShort

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
/**
 * return an {@link Image} of {@link UnsignedShortType} as input for the PhaseCorrelation. If no rectangular roi
 * is selected, it will only wrap the existing ImagePlus!
 * 
 * @param imp - the {@link ImagePlus}
 * @param channel - which channel (if channel=0 means average all channels)
 * @param timepoint - which timepoint
 * 
 * @return - the {@link Image} or null if it was not an ImagePlus.GRAY16 or if channel = 0
 */
public static Image<UnsignedShortType> getWrappedImageUnsignedShort( final ImagePlus imp, final int channel, final int timepoint )
{
	if ( channel == 0 || imp.getType() != ImagePlus.GRAY16 )
		return null;
	return ImageJFunctions.wrapShort( Hyperstack_rearranger.getImageChunk( imp, channel, timepoint ) );
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:17,代码来源:PairWiseStitchingImgLib.java

示例10: getWrappedImageFloat

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
/**
 * return an {@link Image} of {@link FloatType} as input for the PhaseCorrelation. If no rectangular roi
 * is selected, it will only wrap the existing ImagePlus!
 * 
 * @param imp - the {@link ImagePlus}
 * @param channel - which channel (if channel=0 means average all channels)
 * @param timepoint - which timepoint
 * 
 * @return - the {@link Image} or null if it was not an ImagePlus.GRAY32 or if channel = 0
 */
public static Image<FloatType> getWrappedImageFloat( final ImagePlus imp, final int channel, final int timepoint )
{
	if ( channel == 0 || imp.getType() != ImagePlus.GRAY32 )
		return null;
	return ImageJFunctions.wrapFloat( Hyperstack_rearranger.getImageChunk( imp, channel, timepoint ) );
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:17,代码来源:PairWiseStitchingImgLib.java

示例11: main

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
public static void main( String args[] )
{
	new ImageJ();
	
	//Image< FloatType > img1 = new ImageFactory<FloatType>( new FloatType(), new ArrayContainerFactory() ).createImage( new int[]{ 13, 13, 13 } );		
	//meanMirror( null, img1, 7, 7, 7, 0, 0 );		
	//ImageJFunctions.show( img1 );		
	//SimpleMultiThreading.threadHaltUnClean();
	
	Image< FloatType > img = LOCI.openLOCIFloatType( "/Users/preibischs/Documents/Microscopy/SPIM/HisYFP-SPIM/spim_TL18_Angle0.tif", new ArrayContainerFactory() );
	
	long ti = System.currentTimeMillis();
	Image<FloatType> cb = computeContentBasedWeighting( img, 20, 40, 2.73f );
	System.out.println( "Content-based took: " + (System.currentTimeMillis() - ti) + " ms." );
	ImageJFunctions.show( cb );		
	SimpleMultiThreading.threadHaltUnClean();
	
	final IntegralImageLong< FloatType > intImg = new IntegralImageLong<FloatType>( img, new Converter< FloatType, LongType >()
	{
		@Override
		public void convert( final FloatType input, final LongType output ) { output.set( Util.round( input.get() ) ); } 
	} );
	
	intImg.process();
	
	final Image< LongType > integralImg = intImg.getResult();
	
	meanMirror( integralImg, img, 31, 31, 11 );
	
	ImageJFunctions.show( img );
	SimpleMultiThreading.threadHaltUnClean();
	
	final FloatType min = new FloatType();
	final FloatType max = new FloatType();
	
	DOM.computeMinMax( img, min, max );

	final Image< FloatType > domImg = img.createNewImage();
	
	long t = 0;
	int num = 10;
	
	for ( int i = 0; i < num; ++i )
	{
		long t1 = System.currentTimeMillis();
		
		DOM.computeDifferencOfMean3d( integralImg, domImg, 3, 3, 3, 5, 5, 5, min.get(), max.get() );
		
		long t2 = System.currentTimeMillis();
		
		t += (t2 - t1);
		System.out.println( "run " + i + ": " + (t2-t1) + " ms." );
	}
	
	System.out.println( "avg: " + (t/num) + " ms." );
	
	//DOM.computeDifferencOfMean( integralImg, img, 3, 3, 3, 5, 5, 5, min.get(), max.get() );
	
	
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:61,代码来源:DOM.java

示例12: getFusedImageCopy

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
public ImagePlus getFusedImageCopy() { return ImageJFunctions.copyToImagePlus( getFusedImage() ); } 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:2,代码来源:SPIMImageFusion.java

示例13: getFusedImageVirtual

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
public ImagePlus getFusedImageVirtual() { return ImageJFunctions.displayAsVirtualStack( getFusedImage() ); } 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:2,代码来源:SPIMImageFusion.java

示例14: saveAsTiffs

import mpicbg.imglib.image.display.imagej.ImageJFunctions; //导入依赖的package包/类
public boolean saveAsTiffs( final String dir, final String name, final int channelIndex ) { return ImgLibSaver.saveAsTiffs( getFusedImage(), dir, name + "_ch" + viewStructure.getChannelNum( channelIndex ), ImageJFunctions.GRAY32 ); } 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:2,代码来源:SPIMImageFusion.java


注:本文中的mpicbg.imglib.image.display.imagej.ImageJFunctions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。