本文整理汇总了Java中net.imglib2.img.display.imagej.ImageJFunctions.show方法的典型用法代码示例。如果您正苦于以下问题:Java ImageJFunctions.show方法的具体用法?Java ImageJFunctions.show怎么用?Java ImageJFunctions.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.img.display.imagej.ImageJFunctions
的用法示例。
在下文中一共展示了ImageJFunctions.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void main( String[] args )
{
new ImageJ();
Img< FloatType > img = ArrayImgs.floats( 500, 500 );
BlendingRealRandomAccess blend = new BlendingRealRandomAccess(
img,
new float[]{ 100, 0 },
new float[]{ 12, 150 } );
Cursor< FloatType > c = img.localizingCursor();
while ( c.hasNext() )
{
c.fwd();
blend.setPosition( c );
c.get().setReal( blend.get().getRealFloat() );
}
ImageJFunctions.show( img );
}
示例2: visualizeVisibleIds
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
/**
* Visualization to test how it works.
*
* @param screenLabels
*/
@SuppressWarnings( "unused" )
public static void visualizeVisibleIds(
final RandomAccessibleInterval< Pair< LabelMultisetType, LongType > > screenLabels )
{
final GoldenAngleSaturatedARGBStream argbStream =
new GoldenAngleSaturatedARGBStream(
new FragmentSegmentAssignment(
new LocalIdService() ) );
final RandomAccessibleInterval< ARGBType > convertedScreenLabels =
Converters.convert(
screenLabels,
new PairLabelMultisetLongARGBConverter( argbStream ),
new ARGBType() );
ImageJFunctions.show( convertedScreenLabels );
}
示例3: process
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public <T extends RealType<T>> void process( Img<T> img )
{
// Define the transformation model
RigidModel2D model = new RigidModel2D();
model.set( (float)Math.toRadians( 15 ), 0, 0 );
// Define the transformation model
//TranslationModel2D model = new TranslationModel2D();
//model.set( 10.1f, -12.34f );
try
{
// compute the gradient on the image
Img<T> transformed = transform( img, model );
// show the new Img that contains the gradient
ImageJFunctions.show( transformed );
}
catch ( NoninvertibleModelException e )
{
IJ.log( model + " cannot be inverted: " + e );
}
}
示例4: standardDilate
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void standardDilate() {
final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes(new long[] { 3, 9 });
final ArrayRandomAccess<UnsignedByteType> ra = img.randomAccess();
ra.setPosition(new int[] { 1, 4 });
ra.get().set(255);
final Shape strel = new CenteredRectangleShape(new int[] { 5, 2 }, true);
// final Shape strel = new HyperSphereShape(radius)
final Img< UnsignedByteType > full = Dilation.dilateFull( img, strel, new UnsignedByteType( 0 ), 4 );
final Img< UnsignedByteType > std = Dilation.dilate( img, strel, new UnsignedByteType( 0 ), 4 );
new ImageJ();
ImageJFunctions.show(img);
ImageJFunctions.show(full);
ImageJFunctions.show(std);
}
示例5: benchmark
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static <T extends RealType<T> & NativeType< T >> void benchmark( final IterationMethod method, final String msg, final int niter, final Img< T > image )
{
// Init algo
final TestRelativeIterationPerformance<T> algo = new TestRelativeIterationPerformance<T>(image);
algo.method = method;
System.out.println( msg );
final long start = System.currentTimeMillis();
for (int i = 0; i < niter; i++) {
algo.process();
}
final long totalTime = System.currentTimeMillis() - start;
ImageJFunctions.show(algo.getResult());
System.out.println(String.format("Time taken: %.2f ms/iteration.", (float) totalTime / niter));
final long width = image.dimension(0);
final long height = image.dimension(1);
System.out.println(String.format("or: %.2f µs/pixel.", 1000f * totalTime / ((float) niter * width * height)));
System.out.println();
}
示例6: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void main( String[] args )
{
new ImageJ();
final Img< FloatType > img = openAs32Bit( new File( "src/main/resources/mri-stack.tif" ) );
//final Img< FloatType > img = openAs32Bit( new File( "src/main/resources/bridge.png" ) );
ImageJFunctions.show( img );
}
示例7: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void main( String[] args )
{
// define the blocksize so that it is one single block
final RandomAccessibleInterval< FloatType > block = ArrayImgs.floats( 384, 384 );
final long[] blockSize = new long[ block.numDimensions() ];
block.dimensions( blockSize );
final RandomAccessibleInterval< FloatType > image = ArrayImgs.floats( 1024, 1024 );
final long[] imgSize = new long[ image.numDimensions() ];
image.dimensions( imgSize );
// whatever the kernel size is (extra size/2 in general)
final long[] kernelSize = new long[]{ 16, 32 };
final BlockGeneratorFixedSizePrecise blockGenerator = new BlockGeneratorFixedSizePrecise( blockSize );
final Block[] blocks = blockGenerator.divideIntoBlocks( imgSize, kernelSize );
int i = 0;
for ( final Block b : blocks )
{
// copy data from the image to the block (including extra space for outofbounds/real image data depending on kernel size)
b.copyBlock( Views.extendMirrorDouble( image ), block );
// do something with the block (e.g. also multithreaded, cluster, ...)
for ( final FloatType f : Views.iterable( block ) )
f.set( i );
++i;
// write the block back (use a temporary image if multithreaded or in general not all are copied first)
b.pasteBlock( image, block );
}
ImageJFunctions.show( image );
}
示例8: process
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public <T extends RealType<T>> void process( Img<T> img )
{
// compute the gradient on the image
Img<T> gradient = gradient( img );
// show the new Img that contains the gradient
ImageJFunctions.show( gradient );
}
示例9: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void main( final String[] args )
{
new ImageJ();
ImagePlus imp = new ImagePlus( "/Users/preibischs/workspace/TestLucyRichardson/src/resources/dros-1.tif" );
Img< FloatType > img = ImageJFunctions.convertFloat( imp );
ImageJFunctions.show( img.copy() );
ImageJFunctions.show( computeLazyMinFilter( img, 5 ) );
}
示例10: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void main( final String[] args )
{
final int w = 800;
final int h = 800;
final int nPoints = 10000;
// make random 2D Points
final Random rand = new Random( 123124 );
final ArrayList< Point > points = new ArrayList< Point >();
for ( int i = 0; i < nPoints; ++i )
{
final long x = rand.nextInt( w );
final long y = rand.nextInt( h );
points.add( new Point( x, y ) );
}
// split on hyperplane
final HyperPlane plane = new HyperPlane( 1, 0.5, 600 );
final KDTree< Point > kdtree = new KDTree< Point >( points, points );
final SplitHyperPlaneKDTree< Point > split = new SplitHyperPlaneKDTree< Point >( kdtree );
split.split( plane );
// show all points
final Img< ARGBType > pointsImg = ArrayImgs.argbs( w, h );
paint( points, pointsImg, new ARGBType( 0x00ff00 ) );
ImageJFunctions.show( pointsImg );
// show inside/outside points
final Img< ARGBType > clipImg = ArrayImgs.argbs( w, h );
paint( split.getAboveNodes(), clipImg, new ARGBType( 0xffff00 ) );
paint( split.getBelowNodes(), clipImg, new ARGBType( 0x0000ff ) );
ImageJFunctions.show( clipImg );
}
示例11: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
Img<FloatType> img;
// test if an image is open, otherwise load blobs
if ( imp == null )
{
// create the ImgOpener
ImgOpener imgOpener = new ImgOpener();
// load the image as FloatType using the ArrayImg
try
{
img = imgOpener.openImg( getClass().getResource( "/Drosophila.tif.zip" ).getFile(), new ArrayImgFactory<FloatType>(), new FloatType() );
}
catch (ImgIOException e)
{
e.printStackTrace();
return;
}
// display the image
ImageJFunctions.show( img );
}
else
{
// wrap it into an ImgLib2 Img (no copying)
img = ImageJFunctions.wrapFloat( imp );
}
// process wrapped image with ImgLib2
process( img );
}
示例12: process
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public <T extends RealType<T>> void process( Img<T> img )
{
// define threshold
T threshold = img.firstElement().copy();
threshold.setReal( 100 );
// apply threshold to image
Img< BitType > thresholdImg = threshold( img, threshold );
// show the new Img that contains the threshold
ImageJFunctions.show( thresholdImg );
}
示例13: CompositeXYRandomAccessibleProjectorBenchmark
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public CompositeXYRandomAccessibleProjectorBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
// open with ImgOpener using an ArrayImgFactory
final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
final long[] dim = new long[ img.numDimensions() - 1 ];
for ( int d = 0; d < dim.length; ++d )
dim[ d ] = img.dimension( d );
argbImg = new ArrayImgFactory< ARGBType >().create( dim, new ARGBType() );
convert( img, argbImg );
ImageJFunctions.show( argbImg );
}
示例14: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void main( String[] args )
{
new ImageJ();
// test blending
ImgFactory< FloatType > f = new ArrayImgFactory< FloatType >();
Img< FloatType > img = f.create( new int[] { 400, 400 }, new FloatType() );
Cursor< FloatType > c = img.localizingCursor();
final int numDimensions = img.numDimensions();
final double[] tmp = new double[ numDimensions ];
// for blending
final long[] dimensions = new long[ numDimensions ];
img.dimensions( dimensions );
final float percentScaling = 0.2f;
final double[] border = new double[ numDimensions ];
while ( c.hasNext() )
{
c.fwd();
for ( int d = 0; d < numDimensions; ++d )
tmp[ d ] = c.getFloatPosition( d );
c.get().set( (float)BlendingPixelFusion.computeWeight( tmp, dimensions, border, percentScaling ) );
}
ImageJFunctions.show( img );
Log.debug( "done" );
}
示例15: example2
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static void example2()
{
final ImgFactory< UnsignedByteType > imgFactory = new ArrayImgFactory< UnsignedByteType >();
Img< UnsignedByteType > image = imgFactory.create( new int[] { DIM, DIM, DIM }, new UnsignedByteType() );
long[] center = new long[ 3 ];
long[] span = new long[ 3 ];
for ( int i = 0; i < DIM; i++ )
{
center[ 0 ] = ( long ) ( Math.random() * DIM );
center[ 1 ] = ( long ) ( Math.random() * DIM );
center[ 2 ] = ( long ) ( Math.random() * DIM );
span[ 0 ] = ( long ) ( Math.random() / 10 * DIM );
span[ 1 ] = ( long ) ( Math.random() / 10 * DIM );
span[ 2 ] = ( long ) ( Math.random() / 10 * DIM );
EllipsoidNeighborhood< UnsignedByteType > ellipsoid = new EllipsoidNeighborhood< UnsignedByteType >( image, center, span );
System.out.println( "Center: " + Util.printCoordinates( center ) );// DEBUG
System.out.println( "Span: " + Util.printCoordinates( span ) );// DEBUG
int val = ( int ) ( Math.random() * 200 );
for ( UnsignedByteType pixel : ellipsoid )
{
pixel.set( val );
// val++;
}
}
ImageJFunctions.show( image );
}