Search in sources :

Example 1 with CellImgFactory

use of net.imglib2.img.cell.CellImgFactory in project imagej-ops by imagej.

the class CreateImgTest method testImageFactory.

@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);
}
Also used : FinalDimensions(net.imglib2.FinalDimensions) CreateImgFromImg(net.imagej.ops.create.img.CreateImgFromImg) Img(net.imglib2.img.Img) CellImgFactory(net.imglib2.img.cell.CellImgFactory) DoubleType(net.imglib2.type.numeric.real.DoubleType) CreateImgFromDimsAndType(net.imagej.ops.create.img.CreateImgFromDimsAndType) FinalDimensions(net.imglib2.FinalDimensions) Dimensions(net.imglib2.Dimensions) ArrayImgFactory(net.imglib2.img.array.ArrayImgFactory) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 2 with CellImgFactory

use of net.imglib2.img.cell.CellImgFactory in project imagej-ops by imagej.

the class CreateLabelingTest method testImageFactory.

@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());
}
Also used : FinalDimensions(net.imglib2.FinalDimensions) Img(net.imglib2.img.Img) Dimensions(net.imglib2.Dimensions) FinalDimensions(net.imglib2.FinalDimensions) IntType(net.imglib2.type.numeric.integer.IntType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Aggregations

AbstractOpTest (net.imagej.ops.AbstractOpTest)2 Dimensions (net.imglib2.Dimensions)2 FinalDimensions (net.imglib2.FinalDimensions)2 Img (net.imglib2.img.Img)2 Test (org.junit.Test)2 CreateImgFromDimsAndType (net.imagej.ops.create.img.CreateImgFromDimsAndType)1 CreateImgFromImg (net.imagej.ops.create.img.CreateImgFromImg)1 ArrayImgFactory (net.imglib2.img.array.ArrayImgFactory)1 CellImgFactory (net.imglib2.img.cell.CellImgFactory)1 IntType (net.imglib2.type.numeric.integer.IntType)1 DoubleType (net.imglib2.type.numeric.real.DoubleType)1