本文整理汇总了Java中net.imglib2.img.cell.CellImgFactory类的典型用法代码示例。如果您正苦于以下问题:Java CellImgFactory类的具体用法?Java CellImgFactory怎么用?Java CellImgFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CellImgFactory类属于net.imglib2.img.cell包,在下文中一共展示了CellImgFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initCanvas
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
/**
* Load or initialize canvas
*
* @param params
* @throws IOException
*/
protected void initCanvas( final P params ) throws IOException
{
System.out.println( "Opening canvas from " + params.inFile );
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
/* canvas (to which the brush paints) */
if ( reader.exists( params.canvas ) )
canvas = H5Utils.loadUnsignedLong( reader, params.canvas, cellDimensions );
else
{
canvas = new CellImgFactory< LongType >( cellDimensions ).create( maxRawDimensions, new LongType() );
for ( final LongType t : canvas )
t.set( Label.TRANSPARENT );
}
reader.close();
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:24,代码来源:BigCat.java
示例2: main
import net.imglib2.img.cell.CellImgFactory; //导入依赖的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 );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:20,代码来源:OpenAndDisplayWithCellContainer.java
示例3: createCellImage
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
private CellImg<UnsignedByteType, ByteArray> createCellImage() {
final UnsignedByteType type = new UnsignedByteType();
final int cellSize = ( int ) Math.pow( Integer.MAX_VALUE / type.getEntitiesPerPixel().getRatio(), 1.0 / numDimensions );
// test whether there were rounding errors and cellSize is actually too big
long t = 1;
for ( int d = 0; d < numDimensions; ++d )
t *= cellSize;
t *= type.getEntitiesPerPixel().getNumerator();
t /= type.getEntitiesPerPixel().getDenominator();
if ( t > Integer.MAX_VALUE )
throw new RuntimeException( "there were rounding errors and cellSize is actually too big" );
@SuppressWarnings( "unchecked" )
final
CellImg<UnsignedByteType, ByteArray> cellContainer = ( CellImg<UnsignedByteType, ByteArray> ) createImage( dimensions, new CellImgFactory< UnsignedByteType >( cellSize ) );
return cellContainer;
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:19,代码来源:ImglibBenchmark.java
示例4: testImageFactory
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
@Test
public void testImageFactory() {
final Dimensions dim = new FinalDimensions(10, 10, 10);
@SuppressWarnings("unchecked")
final Img<DoubleType> arrayImg = (Img<DoubleType>) ops.run(
CreateImgFromDimsAndType.class, dim, new DoubleType(),
new ArrayImgFactory<DoubleType>());
final Class<?> arrayFactoryClass = arrayImg.factory().getClass();
assertEquals("Image Factory: ", ArrayImgFactory.class, arrayFactoryClass);
@SuppressWarnings("unchecked")
final Img<DoubleType> cellImg = (Img<DoubleType>) ops.run(
CreateImgFromDimsAndType.class, dim, new DoubleType(),
new CellImgFactory<DoubleType>());
final Class<?> cellFactoryClass = cellImg.factory().getClass();
assertEquals("Image Factory: ", CellImgFactory.class, cellFactoryClass);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:CreateImgTest.java
示例5: testImageFactory
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testImageFactory() {
final Dimensions dim = new FinalDimensions( 10, 10, 10 );
assertEquals("Labeling Factory: ", ArrayImgFactory.class,
((Img<?>) ((ImgLabeling<String, ?>) ops.run(
DefaultCreateImgLabeling.class, dim, null,
new ArrayImgFactory<IntType>())).getIndexImg()).factory().getClass());
assertEquals("Labeling Factory: ", CellImgFactory.class,
((Img<?>) ((ImgLabeling<String, ?>) ops.run(
DefaultCreateImgLabeling.class, dim, null,
new CellImgFactory<IntType>())).getIndexImg()).factory().getClass());
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:CreateLabelingTest.java
示例6: selectImgFactory
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
protected ImgFactory<? extends NativeType<?>> selectImgFactory(final SlideBook6MetaData meta) {
int[] dims = meta.imageSize(0);
long maxNumPixels = dims[0];
maxNumPixels *= dims[1];
maxNumPixels *= dims[2];
String s = "Maximum number of pixels in any view: n=" + Long.toString(maxNumPixels) +
" px ";
if (maxNumPixels < Integer.MAX_VALUE) {
IOFunctions.println(s + "< " + Integer.MAX_VALUE + ", using ArrayImg.");
return new ArrayImgFactory<FloatType>();
} else {
IOFunctions.println(s + ">= " + Integer.MAX_VALUE + ", using CellImg.");
return new CellImgFactory<FloatType>(256);
}
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:18,代码来源:SlideBook6.java
示例7: instantiateImg
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
protected < T extends NativeType< T > > Img< T > instantiateImg( final long[] dim, final T type )
{
Img< T > img;
try
{
img = getImgFactory().imgFactory( type ).create( dim, type );
}
catch ( Exception e1 )
{
try
{
img = new CellImgFactory< T >( 256 ).create( dim, type );
}
catch ( Exception e2 )
{
img = null;
}
}
return img;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:23,代码来源:LegacyStackImgLoader.java
示例8: loadFloat
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
/**
* Load an HDF5 float32 dataset into a {@link CellImg} of {@link FloatType}.
*
* @param reader
* @param dataset
* @param cellDimensions
*/
static public CellImg< FloatType, ? > loadFloat(
final IHDF5Reader reader,
final String dataset,
final int[] cellDimensions )
{
final IHDF5FloatReader float32Reader = reader.float32();
final long[] dimensions = reorder( reader.object().getDimensions( dataset ) );
final int n = dimensions.length;
final CellImg< FloatType, ? > target = new CellImgFactory< FloatType >( cellDimensions ).create( dimensions, new FloatType() );
final long[] offset = new long[ n ];
final long[] targetCellDimensions = new long[ n ];
for ( int d = 0; d < n; )
{
cropCellDimensions( target, offset, cellDimensions, targetCellDimensions );
final RandomAccessibleInterval< FloatType > targetBlock = Views.offsetInterval( target, offset, targetCellDimensions );
final MDFloatArray targetCell = float32Reader.readMDArrayBlockWithOffset(
dataset,
Util.long2int( reorder( targetCellDimensions ) ),
reorder( offset ) );
int i = 0;
for ( final FloatType t : Views.flatIterable( targetBlock ) )
t.set( targetCell.get( i++ ) );
for ( d = 0; d < n; ++d )
{
offset[ d ] += cellDimensions[ d ];
if ( offset[ d ] < dimensions[ d ] )
break;
else
offset[ d ] = 0;
}
}
return target;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:47,代码来源:H5Utils.java
示例9: loadDouble
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
/**
* Load an HDF5 float64 dataset into a {@link CellImg} of {@link DoubleType}.
*
* @param reader
* @param dataset
* @param cellDimensions
*/
static public CellImg< DoubleType, ? > loadDouble(
final IHDF5Reader reader,
final String dataset,
final int[] cellDimensions )
{
final IHDF5DoubleReader float64Reader = reader.float64();
final long[] dimensions = reorder( reader.object().getDimensions( dataset ) );
final int n = dimensions.length;
final CellImg< DoubleType, ? > target = new CellImgFactory< DoubleType >( cellDimensions ).create( dimensions, new DoubleType() );
final long[] offset = new long[ n ];
final long[] targetCellDimensions = new long[ n ];
for ( int d = 0; d < n; )
{
cropCellDimensions( target, offset, cellDimensions, targetCellDimensions );
final RandomAccessibleInterval< DoubleType > targetBlock = Views.offsetInterval( target, offset, targetCellDimensions );
final MDDoubleArray targetCell = float64Reader.readMDArrayBlockWithOffset(
dataset,
Util.long2int( reorder( targetCellDimensions ) ),
reorder( offset ) );
int i = 0;
for ( final DoubleType t : Views.flatIterable( targetBlock ) )
t.set( targetCell.get( i++ ) );
for ( d = 0; d < n; ++d )
{
offset[ d ] += cellDimensions[ d ];
if ( offset[ d ] < dimensions[ d ] )
break;
else
offset[ d ] = 0;
}
}
return target;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:47,代码来源:H5Utils.java
示例10: loadUnsignedLong
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
/**
* Load an HDF5 uint64 dataset into a {@link CellImg} of {@link LongType}.
*
* @param reader
* @param dataset
* @param cellDimensions
*/
static public CellImg< LongType, ? > loadUnsignedLong(
final IHDF5Reader reader,
final String dataset,
final int[] cellDimensions )
{
final IHDF5LongReader uint64Reader = reader.uint64();
final long[] dimensions = reorder( reader.object().getDimensions( dataset ) );
final int n = dimensions.length;
final CellImg< LongType, ? > target = new CellImgFactory< LongType >( cellDimensions ).create( dimensions, new LongType() );
final long[] offset = new long[ n ];
final long[] targetCellDimensions = new long[ n ];
for ( int d = 0; d < n; )
{
cropCellDimensions( target, offset, cellDimensions, targetCellDimensions );
final RandomAccessibleInterval< LongType > targetBlock = Views.offsetInterval( target, offset, targetCellDimensions );
final MDLongArray targetCell = uint64Reader.readMDArrayBlockWithOffset(
dataset,
Util.long2int( reorder( targetCellDimensions ) ),
reorder( offset ) );
int i = 0;
for ( final LongType t : Views.flatIterable( targetBlock ) )
t.set( targetCell.get( i++ ) );
for ( d = 0; d < n; ++d )
{
offset[ d ] += cellDimensions[ d ];
if ( offset[ d ] < dimensions[ d ] )
break;
else
offset[ d ] = 0;
}
}
return target;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:47,代码来源:H5Utils.java
示例11: loadUnsignedShort
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
/**
* Load an HDF5 uint16 dataset into a {@link CellImg} of {@link UnsignedShortType}.
*
* @param reader
* @param dataset
* @param cellDimensions
*/
static public CellImg< UnsignedShortType, ? > loadUnsignedShort(
final IHDF5Reader reader,
final String dataset,
final int[] cellDimensions )
{
final IHDF5ShortReader uint16Reader = reader.uint16();
final long[] dimensions = reorder( reader.object().getDimensions( dataset ) );
final int n = dimensions.length;
final CellImg< UnsignedShortType, ? > target = new CellImgFactory< UnsignedShortType >( cellDimensions ).create( dimensions, new UnsignedShortType() );
final long[] offset = new long[ n ];
final long[] targetCellDimensions = new long[ n ];
for ( int d = 0; d < n; )
{
cropCellDimensions( target, offset, cellDimensions, targetCellDimensions );
final RandomAccessibleInterval< UnsignedShortType > targetBlock = Views.offsetInterval( target, offset, targetCellDimensions );
final MDShortArray targetCell = uint16Reader.readMDArrayBlockWithOffset(
dataset,
Util.long2int( reorder( targetCellDimensions ) ),
reorder( offset ) );
int i = 0;
for ( final UnsignedShortType t : Views.flatIterable( targetBlock ) )
t.set( targetCell.get( i++ ) );
for ( d = 0; d < n; ++d )
{
offset[ d ] += cellDimensions[ d ];
if ( offset[ d ] < dimensions[ d ] )
break;
else
offset[ d ] = 0;
}
}
return target;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:47,代码来源:H5Utils.java
示例12: loadUnsignedByte
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
/**
* Load an HDF5 uint8 dataset into a {@link CellImg} of {@link UnsignedByteType}.
*
* @param reader
* @param dataset
* @param cellDimensions
*/
static public CellImg< UnsignedByteType, ? > loadUnsignedByte(
final IHDF5Reader reader,
final String dataset,
final int[] cellDimensions )
{
final IHDF5ByteReader uint8Reader = reader.uint8();
final long[] dimensions = reorder( reader.object().getDimensions( dataset ) );
final int n = dimensions.length;
final CellImg< UnsignedByteType, ? > target = new CellImgFactory< UnsignedByteType >( cellDimensions ).create( dimensions, new UnsignedByteType() );
final long[] offset = new long[ n ];
final long[] targetCellDimensions = new long[ n ];
for ( int d = 0; d < n; )
{
cropCellDimensions( target, offset, cellDimensions, targetCellDimensions );
final RandomAccessibleInterval< UnsignedByteType > targetBlock = Views.offsetInterval( target, offset, targetCellDimensions );
final MDByteArray targetCell = uint8Reader.readMDArrayBlockWithOffset(
dataset,
Util.long2int( reorder( targetCellDimensions ) ),
reorder( offset ) );
int i = 0;
for ( final UnsignedByteType t : Views.flatIterable( targetBlock ) )
t.set( targetCell.get( i++ ) );
for ( d = 0; d < n; ++d )
{
offset[ d ] += cellDimensions[ d ];
if ( offset[ d ] < dimensions[ d ] )
break;
else
offset[ d ] = 0;
}
}
return target;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:47,代码来源:H5Utils.java
示例13: generateByteTestCellImg
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
public CellImg<ByteType, ?> generateByteTestCellImg(final boolean fill,
final long... dims)
{
final CellImg<ByteType, ?> img = new CellImgFactory<ByteType>().create(dims,
new ByteType());
if (fill) {
final Cursor<ByteType> c = img.cursor();
while (c.hasNext())
c.next().set((byte) pseudoRandom());
}
return img;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:15,代码来源:AbstractOpTest.java
示例14: getParameters
import net.imglib2.img.cell.CellImgFactory; //导入依赖的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;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:40,代码来源:Resave_TIFF.java
示例15: selectImgFactory
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
protected ImgFactory< ? extends NativeType< ? > > selectImgFactory( final LightSheetZ1MetaData meta )
{
long maxNumPixels = 0;
for ( int a = 0; a < meta.numAngles(); ++a )
{
final int[] dim = meta.imageSizes().get( a );
long n = 1;
for ( int d = 0; d < dim.length; ++d )
{
n *= (long)dim[ d ];
if ( dim[ d ] <= 0 )
{
IOFunctions.println( "Dimensions couldn't be read from metadata, using CellImg(256)." );
return new CellImgFactory< FloatType >( 256 );
}
}
maxNumPixels = Math.max( n, maxNumPixels );
}
int smallerLog2 = (int)Math.ceil( Math.log( maxNumPixels ) / Math.log( 2 ) );
String s = "Maximum number of pixels in any view: n=" + maxNumPixels +
" (2^" + (smallerLog2-1) + " < n < 2^" + smallerLog2 + " px), ";
if ( smallerLog2 <= 31 )
{
IOFunctions.println( s + "using ArrayImg." );
return new ArrayImgFactory< FloatType >();
}
else
{
IOFunctions.println( s + "using CellImg(256)." );
return new CellImgFactory< FloatType >( 256 );
}
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:41,代码来源:LightSheetZ1.java
示例16: getImgFactory
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
public < T extends ComplexType< T > & NativeType < T > > ImgFactory< T > getImgFactory( final T type )
{
final ImgFactory< T > imgFactory;
if ( this.getImgType() == 0 )
imgFactory = new ArrayImgFactory< T >();
else if ( this.getImgType() == 1 )
imgFactory = new ImagePlusImgFactory< T >();
else
imgFactory = new CellImgFactory<T>( 256 );
return imgFactory;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:14,代码来源:BoundingBoxGUI.java
示例17: createCellImage
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
private Img<UnsignedByteType> createCellImage(final byte[] data, final int w,
final int h)
{
return createImage(data, w, h, new CellImgFactory<UnsignedByteType>());
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:6,代码来源:PerformanceBenchmark.java
示例18: calculate
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
@Override
public ImgFactory<T> calculate() {
return (dims == null || Intervals.numElements(dims) <= Integer.MAX_VALUE)
? new ArrayImgFactory<>() : new CellImgFactory<>();
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:6,代码来源:DefaultCreateImgFactory.java
示例19: fromXml
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
@Override
public SlideBook6ImgLoader fromXml(
final Element elem, File basePath,
final AbstractSequenceDescription<?, ?, ?> sequenceDescription )
{
try
{
final File path = loadPath( elem, DIRECTORY_TAG, basePath );
final String masterFile = XmlHelpers.getText( elem, MASTER_FILE_TAG );
final String container = XmlHelpers.getText( elem, IMGLIB2CONTAINER_PATTERN_TAG );
final ImgFactory< FloatType > imgFactory;
if ( container == null )
{
System.out.println( "WARNING: No Img implementation defined in XML, using ArrayImg." );
// if no factory is defined we define an ArrayImgFactory
imgFactory = new ArrayImgFactory< FloatType >();
}
else
{
if ( container.toLowerCase().contains( "cellimg" ) )
{
imgFactory = new CellImgFactory< FloatType >( 256 );
}
else if ( container.toLowerCase().contains( "arrayimg" ) )
{
imgFactory = new ArrayImgFactory< FloatType >();
}
else if ( container.toLowerCase().contains( "planarimg" ) )
{
imgFactory = new PlanarImgFactory< FloatType >();
}
else
{
// if factory is unknown we define an ArrayImgFactory
imgFactory = new ArrayImgFactory< FloatType >();
System.out.println( "WARNING: Unknown Img implementation defined in XML:'" + container + "', using ArrayImg." );
}
}
return new SlideBook6ImgLoader( new File( path, masterFile ), imgFactory, sequenceDescription );
}
catch ( final Exception e )
{
throw new RuntimeException( e );
}
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:51,代码来源:XmlIoSlideBook6ImgLoader.java
示例20: fromXml
import net.imglib2.img.cell.CellImgFactory; //导入依赖的package包/类
@Override
public LightSheetZ1ImgLoader fromXml(
final Element elem, File basePath,
final AbstractSequenceDescription<?, ?, ?> sequenceDescription )
{
try
{
final File path = loadPath( elem, DIRECTORY_TAG, basePath );
final String masterFile = XmlHelpers.getText( elem, MASTER_FILE_TAG );
final String container = XmlHelpers.getText( elem, IMGLIB2CONTAINER_PATTERN_TAG );
final ImgFactory< FloatType > imgFactory;
if ( container == null )
{
System.out.println( "WARNING: No Img implementation defined in XML, using ArrayImg." );
// if no factory is defined we define an ArrayImgFactory
imgFactory = new ArrayImgFactory< FloatType >();
}
else
{
if ( container.toLowerCase().contains( "cellimg" ) )
{
imgFactory = new CellImgFactory< FloatType >( 256 );
}
else if ( container.toLowerCase().contains( "arrayimg" ) )
{
imgFactory = new ArrayImgFactory< FloatType >();
}
else if ( container.toLowerCase().contains( "planarimg" ) )
{
imgFactory = new PlanarImgFactory< FloatType >();
}
else
{
// if factory is unknown we define an ArrayImgFactory
imgFactory = new ArrayImgFactory< FloatType >();
System.out.println( "WARNING: Unknown Img implementation defined in XML:'" + container + "', using ArrayImg." );
}
}
return new LightSheetZ1ImgLoader( new File( path, masterFile ), imgFactory, sequenceDescription );
}
catch ( final Exception e )
{
throw new RuntimeException( e );
}
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:51,代码来源:XmlIoLightSheetZ1ImgLoader.java
注:本文中的net.imglib2.img.cell.CellImgFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论