本文整理汇总了Java中net.imglib2.img.display.imagej.ImageJFunctions类的典型用法代码示例。如果您正苦于以下问题:Java ImageJFunctions类的具体用法?Java ImageJFunctions怎么用?Java ImageJFunctions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageJFunctions类属于net.imglib2.img.display.imagej包,在下文中一共展示了ImageJFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public static void main( String[] args )
{
SpimData spimData = grid3x2();
SequenceDescription sd = spimData.getSequenceDescription();
ImgLoader i = sd.getImgLoader();
TimePoint firstTp = sd.getTimePoints().getTimePointsOrdered().get( 0 );
int tpId = firstTp.getId();
for ( final ViewSetup vs: spimData.getSequenceDescription().getViewSetups().values() )
{
SetupImgLoader< ? > sil = i.getSetupImgLoader( vs.getId() );
ViewDescription vd = sd.getViewDescription( tpId, vs.getId() );
Tile t = vd.getViewSetup().getTile();
if ( t.hasLocation() )
System.out.println( "Loading: " + t.getName() + " " + Util.printCoordinates( t.getLocation() ) + " " + vd.getViewSetup().getChannel().getName() );
else
System.out.println( "Loading: " + t.getName() + " (unknown location) " + vd.getViewSetup().getChannel().getName() );
ImageJFunctions.show( (RandomAccessibleInterval< UnsignedShortType >)sil.getImage( tpId, ImgLoaderHints.LOAD_COMPLETELY ) ).resetDisplayRange();
}
}
示例2: 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 );
}
示例3: 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 );
}
示例4: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例5: 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 );
}
}
示例6: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例7: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img< FloatType > img = ImageJFunctions.wrapFloat( imp );
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例8: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例9: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例10: act
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
@Override
public < T extends RealType< T > > void act(
final int iteration,
final RandomAccessibleInterval< T > matrix,
final RandomAccessibleInterval< T > scaledMatrix,
final double[] lut,
final int[] permutation,
final int[] inversePermutation,
final double[] multipliers,
final RandomAccessibleInterval< double[] > estimatedFit )
{
final T dummy = scaledMatrix.randomAccess().get().createVariable();
dummy.setReal( Double.NaN );
final String path = fileDir( iteration );
if ( iteration == 0 )
createParentDirectory( path );
final LUTRealTransform tf = new LUTRealTransform( lut, 2, 2 );
final RealTransformRealRandomAccessible< T, InverseRealTransform > transformed = RealViews.transformReal( Views.interpolate( Views.extendValue( scaledMatrix, dummy ), new NLinearInterpolatorFactory<>() ), tf );
final double s = 1.0 / ( lut[ lut.length - 1 ] - lut[ 0 ] ) * lut.length;
final double o = -lut[ 0 ];
final ScaleAndTranslation scaleAndTranslation = new ScaleAndTranslation( new double[] { s, s }, new double[] { o, o } );
final IntervalView< T > offset = Views.interval( Views.raster( RealViews.transformReal( transformed, scaleAndTranslation ) ), scaledMatrix );
final RandomAccessibleInterval< T > strip = MatrixStripConversion.matrixToStrip( offset, range, dummy );
new FileSaver( ImageJFunctions.wrap( strip, "" ) ).saveAsTiff( path );
}
示例11: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
final static public void main( final String[] args )
{
new ImageJ();
final ImagePlus imp = new ImagePlus( "http://media.npr.org/images/picture-show-flickr-promo.jpg" );
imp.show();
final float[] pixels = ( float[] ) imp.getProcessor().convertToFloat().getPixels();
final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( pixels, imp.getWidth(), imp.getHeight() );
final double[] lut = new double[ Math.max( imp.getWidth(), imp.getHeight() ) ];
for ( int i = 0; i < lut.length; ++i )
lut[ i ] = i + Math.pow( i, 1.5 );
final SingleDimensionLUTRealTransform transform = new SingleDimensionLUTRealTransform( lut, 2, 2, 1 );
final RealRandomAccessible< FloatType > source = Views.interpolate( Views.extendBorder( img ), new NLinearInterpolatorFactory< FloatType >() );
final RandomAccessible< FloatType > target = new RealTransformRandomAccessible< FloatType, RealTransform >( source, transform );
final RandomAccessible< FloatType > target2 = RealViews.transform( source, transform );
// RealViews.transformReal(source, transform);
ImageJFunctions.show( Views.interval( target, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
ImageJFunctions.show( Views.interval( target2, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
}
示例12: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public static void main( String[] args )
{
final Img< FloatType > img;
//img = OpenImg.open( "/Users/preibischs/Documents/Microscopy/SPIM/HisYFP-SPIM/img_Angle0.tif", new ArrayImgFactory< FloatType >() );
img = new ArrayImgFactory< FloatType >().create( new long[]{ 515, 231, 15 }, new FloatType() );
final Cursor< FloatType > c = img.localizingCursor();
while ( c.hasNext() )
{
c.next().set( c.getIntPosition( 0 ) % 10 + c.getIntPosition( 1 ) % 13 + c.getIntPosition( 2 ) % 3 );
}
new ImageJ();
ImageJFunctions.show( img );
ImageJFunctions.show( simple2x( img, img.factory(), new boolean[]{ true, true, true } ) );
}
示例13: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
final static public void main( final String[] args )
{
new ImageJ();
Img< FloatType > img = null;
try
{
ImgFactory< FloatType > imgFactory = new CellImgFactory<FloatType>( new int[] {64, 64} );
final ImgOpener io = new ImgOpener();
img = io.openImg( "/home/tobias/workspace/data/73_float.tif", imgFactory, new FloatType() );
}
catch ( Exception e )
{
e.printStackTrace();
return;
}
ImageJFunctions.show( img );
}
示例14: getIntIntImgLabellingFromLabelMapImagePlus
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
public static ImgLabeling< Integer, IntType > getIntIntImgLabellingFromLabelMapImagePlus( final ImagePlus labelMap )
{
final Img< FloatType > img2 = ImageJFunctions.convertFloat( labelMap );
final Dimensions dims = img2;
final IntType t = new IntType();
final RandomAccessibleInterval< IntType > img = Util.getArrayOrCellImgFactory( dims, t ).create( dims, t );
final ImgLabeling< Integer, IntType > labeling = new ImgLabeling<>( img );
final Cursor< LabelingType< Integer > > labelCursor = Views.flatIterable( labeling ).cursor();
for ( final UnsignedByteType input : Views.flatIterable( ImageJFunctions.wrapByte( labelMap ) ) )
{
final LabelingType< Integer > element = labelCursor.next();
if ( input.get() != 0 )
element.add( input.get() );
}
return labeling;
}
示例15: main
import net.imglib2.img.display.imagej.ImageJFunctions; //导入依赖的package包/类
final static public void main( final String[] args )
{
new ImageJ();
Img< FloatType > img = null;
try
{
final ImgFactory< FloatType > imgFactory = new ArrayImgFactory< FloatType >();
final ImgOpener io = new ImgOpener();
img = io.openImg( "/home/tobias/workspace/data/73_float.tif", imgFactory, new FloatType() );
}
catch ( final Exception e )
{
e.printStackTrace();
return;
}
final RandomAccessibleInterval< FloatType > view = Views.hyperSlice( img, 2, 10 );
ImageJFunctions.show( view );
}