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


Java PlanarImgFactory类代码示例

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


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

示例1: deserializeSpecialTypes

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的package包/类
@Test
public void deserializeSpecialTypes() throws Exception {
	final LinkedHashMap<String, Object> inputs = new LinkedHashMap<>();
	final Img<ByteType> img0 = Imgs.create(new ArrayImgFactory<>(), Intervals
		.createMinMax(0, 10, 0, 10), new ByteType());
	final Img<ByteType> img1 = Imgs.create(new PlanarImgFactory<>(), Intervals
		.createMinMax(0, 10, 0, 10), new ByteType());
	final Foo foo = new Foo("test string");
	inputs.put("img0", img0);
	inputs.put("img1", img1);
	inputs.put("foo", foo);

	objectService.register(img0, "");
	objectService.register(img1, "");
	objectService.register(foo, "");

	@SuppressWarnings("unchecked")
	final Map<String, Object> deserialized = modifiedMapper.readValue(fixture(
		"fixtures/inputs/specialTypes.json"), Map.class);

	assertEquals(deserialized, inputs);
}
 
开发者ID:imagej,项目名称:imagej-server,代码行数:23,代码来源:DefaultJsonServiceTest.java

示例2: createData

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的package包/类
@Before
public void createData() {
	input = new PlanarImgFactory<DoubleType>().create(
			new int[] { 120, 100 }, new DoubleType());

	final Random r = new Random(System.currentTimeMillis());

	final Cursor<DoubleType> inc = input.cursor();

	while (inc.hasNext()) {
		inc.next().set(r.nextDouble());
	}
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:CopyIITest.java

示例3: testImgOptions

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的package包/类
/**
 * Test opening images with various ImgOptions set.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testImgOptions() throws IncompatibleTypeException, ImgIOException
{
	final NativeType t = new UnsignedByteType();

	final ImgFactory aif = new ArrayImgFactory().imgFactory(t);
	final ImgFactory pif = new PlanarImgFactory().imgFactory(t);
	final ImgFactory sif = new SCIFIOCellImgFactory().imgFactory(t);

	for (final ImgFactory f : new ImgFactory[] { aif, pif, sif }) {
		testSubRegion(f);
	}
}
 
开发者ID:scifio,项目名称:scifio,代码行数:18,代码来源:ImgOpenerTest.java

示例4: serializeSpecialTypes

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的package包/类
@Test
public void serializeSpecialTypes() throws Exception {
	// MixIns and special types are tested together here. Could separate them if
	// needed in the future.
	final LinkedHashMap<String, Object> outputs = new LinkedHashMap<>();
	final IntType intType = new IntType(1);
	final ByteType byteType = new ByteType((byte) 1);
	final ShortType shortType = new ShortType((short) 1);
	final LongType longType = new LongType(1L);
	final FloatType floatType = new FloatType(1.5f);
	final DoubleType doubleType = new DoubleType(1.5d);
	final ComplexDoubleType complexDoubleType = new ComplexDoubleType(1.5, 2.5);
	final Img<ByteType> img0 = Imgs.create(new ArrayImgFactory<>(), Intervals
		.createMinMax(0, 10, 0, 10), new ByteType());
	final Img<ByteType> img1 = Imgs.create(new PlanarImgFactory<>(), Intervals
		.createMinMax(0, 10, 0, 10), new ByteType());
	final Foo foo = new Foo("test string");
	outputs.put("intType", intType);
	outputs.put("byteType", byteType);
	outputs.put("shortType", shortType);
	outputs.put("longType", longType);
	outputs.put("floatType", floatType);
	outputs.put("doubleType", doubleType);
	outputs.put("complexDoubleType", complexDoubleType);
	outputs.put("img0", img0);
	outputs.put("img1", img1);
	outputs.put("foo", foo);

	final String normalized = mapper.writeValueAsString(mapper.readValue(
		fixture("fixtures/outputs/specialTypes.json"), Object.class));

	assertEquals(jsonService.parseObject(outputs), normalized);
}
 
开发者ID:imagej,项目名称:imagej-server,代码行数:34,代码来源:DefaultJsonServiceTest.java

示例5: FusionImageLoader

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的package包/类
public FusionImageLoader( final String pattern, final HashMap< Integer, Integer > setupIdToChannelId, final int numSlices, final SliceLoader< T > sliceLoader, final double sliceValueMin, final double sliceValueMax )
{
	this( pattern, setupIdToChannelId, numSlices, sliceLoader, sliceValueMin, sliceValueMax, new PlanarImgFactory< UnsignedShortType >() );
}
 
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:5,代码来源:FusionImageLoader.java

示例6: fromXml

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的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

示例7: fromXml

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的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

示例8: fromXml

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的package包/类
@Override
public T fromXml( final Element elem, final File basePath, final AbstractSequenceDescription< ?, ?, ? > sequenceDescription )
{
	try
	{
		File path = loadPath( elem, DIRECTORY_TAG, basePath );
		String fileNamePattern = XmlHelpers.getText( elem, FILE_PATTERN_TAG );

		int layoutTP = XmlHelpers.getInt( elem, LAYOUT_TP_TAG );
		int layoutChannels = XmlHelpers.getInt( elem, LAYOUT_CHANNEL_TAG );
		int layoutIllum = XmlHelpers.getInt( elem, LAYOUT_ILLUMINATION_TAG );
		int layoutAngles = XmlHelpers.getInt( elem, LAYOUT_ANGLE_TAG );

		final String container = XmlHelpers.getText( elem, IMGLIB2CONTAINER_PATTERN_TAG );
		ImgFactory< FloatType > imgFactory;
		if ( container == null )
		{
			System.out.println( "WARNING: No Img implementation defined, 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 '" + container + "', using ArrayImg." );
			}
		}
		
		return createImgLoader( path, fileNamePattern, imgFactory, layoutTP, layoutChannels, layoutIllum, layoutAngles, sequenceDescription );
	}
	catch ( final Exception e )
	{
		throw new RuntimeException( e );
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:53,代码来源:XmlIoStackImgLoader.java

示例9: createFactory

import net.imglib2.img.planar.PlanarImgFactory; //导入依赖的package包/类
@Override
	public <T extends NativeType<T>> ImgFactory<T> createFactory(
		final Metadata m, final ImgMode[] imgModes, final T type)
		throws IncompatibleTypeException
	{
		ImgFactory<T> tmpFactory = null;

		// Max size of a plane of a PlanarImg, or total dataset for ArrayImg.
		// 2GB.
		final long maxSize = ArrayUtils.safeMultiply64(2, 1024, 1024, 1024);

		final long availableMem =
			(long) (MemoryTools.totalAvailableMemory() * MEMORY_THRESHOLD);
		long datasetSize = m.getDatasetSize();

		// check for overflow
		if (datasetSize <= 0) datasetSize = Long.MAX_VALUE;

		// divide by 1024 to compare to max_size and avoid overflow
		final long planeSize =
			m.get(0).getAxisLength(Axes.X) * m.get(0).getAxisLength(Axes.Y) *
				FormatTools.getBytesPerPixel(m.get(0).getPixelType());

		final boolean fitsInMemory = availableMem > datasetSize;

		boolean decided = false;
		int modeIndex = 0;

		// loop over ImgOptions in preferred order
		while (!decided) {

			// get the current mode, or AUTO if we've exhausted the list of
			// modes
			final ImgMode mode =
				modeIndex >= imgModes.length ? ImgMode.AUTO : imgModes[modeIndex++];

			if (mode.equals(ImgMode.AUTO)) {
				if (!fitsInMemory) tmpFactory = new SCIFIOCellImgFactory<>();
				else if (datasetSize < maxSize) tmpFactory = new ArrayImgFactory<>();
				else tmpFactory = new PlanarImgFactory<>();

				// FIXME: no CellImgFactory right now.. isn't guaranteed to
				// handle all
				// images well (e.g. RGB)
//        else if (planeSize < maxSize) tmpFactory = new PlanarImgFactory<T>();
//        else tmpFactory = new CellImgFactory<T>();

				decided = true;
			}
			else if (mode.equals(ImgMode.ARRAY) && datasetSize < maxSize &&
				fitsInMemory)
			{
				tmpFactory = new ArrayImgFactory<>();
				decided = true;
			}
			else if (mode.equals(ImgMode.PLANAR) && planeSize < maxSize &&
				fitsInMemory)
			{
				tmpFactory = new PlanarImgFactory<>();
				decided = true;
			}
			else if (mode.equals(ImgMode.CELL)) {
				// FIXME: no CellImgFactory right now.. isn't guaranteed to
				// handle all
				// images well (e.g. RGB)
//        if (fitsInMemory) tmpFactory = new CellImgFactory<T>();
//        else tmpFactory = new SCIFIOCellImgFactory<T>();
				tmpFactory = new SCIFIOCellImgFactory<>();

				decided = true;
			}
		}

		return tmpFactory.imgFactory(type);
	}
 
开发者ID:scifio,项目名称:scifio,代码行数:76,代码来源:DefaultImgFactoryHeuristic.java


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