net.imglib2.type.numeric.integer.UnsignedIntType Java Examples
The following examples show how to use
net.imglib2.type.numeric.integer.UnsignedIntType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: N5TypesTest.java From paintera with GNU General Public License v2.0 | 6 votes |
@Test public void testType() { final Set<DataType> toBeTested = Stream.of(DataType.values()).collect(Collectors.toSet()); final Set<DataType> wasTested = new HashSet<>(); testAndLogNativeTypeForType(DataType.FLOAT32, FloatType.class, wasTested); testAndLogNativeTypeForType(DataType.FLOAT64, DoubleType.class, wasTested); testAndLogNativeTypeForType(DataType.INT8, ByteType.class, wasTested); testAndLogNativeTypeForType(DataType.INT16, ShortType.class, wasTested); testAndLogNativeTypeForType(DataType.INT32, IntType.class, wasTested); testAndLogNativeTypeForType(DataType.INT64, LongType.class, wasTested); testAndLogNativeTypeForType(DataType.UINT8, UnsignedByteType.class, wasTested); testAndLogNativeTypeForType(DataType.UINT16, UnsignedShortType.class, wasTested); testAndLogNativeTypeForType(DataType.UINT32, UnsignedIntType.class, wasTested); testAndLogNativeTypeForType(DataType.UINT64, UnsignedLongType.class, wasTested); Assert.assertEquals(toBeTested, wasTested); }
Example #2
Source File: DefaultImgUtilityService.java From scifio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Converts ImgLib2 Type object to SCIFIO pixel type. */ @Override public int makeType(final Object type) throws ImgIOException { int pixelType = FormatTools.UINT8; if (type instanceof UnsignedByteType) { pixelType = FormatTools.UINT8; } else if (type instanceof ByteType) { pixelType = FormatTools.INT8; } else if (type instanceof UnsignedShortType) { pixelType = FormatTools.UINT16; } else if (type instanceof ShortType) { pixelType = FormatTools.INT16; } else if (type instanceof UnsignedIntType) { pixelType = FormatTools.UINT32; } else if (type instanceof IntType) { pixelType = FormatTools.INT32; } else if (type instanceof FloatType) { pixelType = FormatTools.FLOAT; } else if (type instanceof DoubleType) { pixelType = FormatTools.DOUBLE; } else { throw new ImgIOException("Pixel type not supported. " + "Please convert your image to a supported type."); } return pixelType; }
Example #3
Source File: N5Types.java From paintera with GNU General Public License v2.0 | 5 votes |
/** * * @param dataType N5 {@link DataType} * @param <T> {@link NativeType} * @return appropriate {@link NativeType} for {@code dataType} */ @SuppressWarnings("unchecked") public static <T extends NativeType<T>> T type(final DataType dataType) { switch (dataType) { case INT8: return (T) new ByteType(); case UINT8: return (T) new UnsignedByteType(); case INT16: return (T) new ShortType(); case UINT16: return (T) new UnsignedShortType(); case INT32: return (T) new IntType(); case UINT32: return (T) new UnsignedIntType(); case INT64: return (T) new LongType(); case UINT64: return (T) new UnsignedLongType(); case FLOAT32: return (T) new FloatType(); case FLOAT64: return (T) new DoubleType(); default: return null; } }
Example #4
Source File: InvertTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testUnsignedIntTypeInvert() { final Img<UnsignedIntType> inUnsignedIntType = generateUnsignedIntArrayTestImg(true, 5, 5); final Img<UnsignedIntType> outUnsignedIntType = inUnsignedIntType.factory() .create(inUnsignedIntType, new UnsignedIntType()); assertDefaultInvert(inUnsignedIntType, outUnsignedIntType); assertDefaultInvertMinMaxProvided(inUnsignedIntType, outUnsignedIntType, new UnsignedIntType(237), new UnsignedIntType(257)); assertDefaultInvertMinMaxProvided(inUnsignedIntType, outUnsignedIntType, new UnsignedIntType(10), new UnsignedIntType(-10)); }
Example #5
Source File: AbstractOpTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
public ArrayImg<UnsignedIntType, IntArray> generateUnsignedIntArrayTestImg( final boolean fill, final long... dims) { final int[] array = new int[(int) Intervals.numElements(new FinalInterval( dims))]; if (fill) { seed = 17; for (int i = 0; i < array.length; i++) { array[i] = (int) pseudoRandom() / (int) Integer.MAX_VALUE; } } return ArrayImgs.unsignedInts(array, dims); }
Example #6
Source File: DefaultCreateIntegerType.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Override public IntegerType calculate() { if (maxValue <= 0L) return new IntType(); if (maxValue <= 1L) return new BitType(); if (maxValue <= 0x7fL) return new ByteType(); if (maxValue <= 0xffL) return new UnsignedByteType(); if (maxValue <= 0x7fffL) return new ShortType(); if (maxValue <= 0xffffL) return new UnsignedShortType(); if (maxValue <= 0x7fffffffL) return new IntType(); if (maxValue <= 0xffffffffL) return new UnsignedIntType(); return new LongType(); }
Example #7
Source File: ConvertNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(op = net.imagej.ops.convert.ConvertTypes.IntegerToUint32.class) public <T extends IntegerType<T>> UnsignedIntType uint32( final UnsignedIntType out, final T in) { final UnsignedIntType result = (UnsignedIntType) ops().run( Ops.Convert.Uint32.class, out, in); return result; }
Example #8
Source File: ConvertNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(op = net.imagej.ops.convert.ConvertTypes.ComplexToUint32.class) public <C extends ComplexType<C>> UnsignedIntType uint32( final UnsignedIntType out, final C in) { final UnsignedIntType result = (UnsignedIntType) ops().run( Ops.Convert.Uint32.class, out, in); return result; }
Example #9
Source File: ConvertNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(op = net.imagej.ops.convert.ConvertImages.Uint32.class) public <C extends ComplexType<C>> Img<UnsignedIntType> uint32( final Img<UnsignedIntType> out, final IterableInterval<C> in) { @SuppressWarnings("unchecked") final Img<UnsignedIntType> result = (Img<UnsignedIntType>) ops().run( Ops.Convert.Uint32.class, out, in); return result; }
Example #10
Source File: ConvertNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@OpMethod(op = net.imagej.ops.convert.ConvertImages.Uint32.class) public <C extends ComplexType<C>> Img<UnsignedIntType> uint32( final IterableInterval<C> in) { @SuppressWarnings("unchecked") final Img<UnsignedIntType> result = (Img<UnsignedIntType>) ops().run( Ops.Convert.Uint32.class, in); return result; }
Example #11
Source File: ConvertNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@OpMethod(op = net.imagej.ops.convert.ConvertTypes.ComplexToUint32.class) public <C extends ComplexType<C>> UnsignedIntType uint32(final C in) { final UnsignedIntType result = (UnsignedIntType) ops().run( Ops.Convert.Uint32.class, in); return result; }
Example #12
Source File: ConvertNamespace.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@OpMethod(op = net.imagej.ops.convert.ConvertTypes.IntegerToUint32.class) public <T extends IntegerType<T>> UnsignedIntType uint32(final T in) { final UnsignedIntType result = (UnsignedIntType) ops().run( Ops.Convert.Uint32.class, in); return result; }
Example #13
Source File: ConvertTypes.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void compute(final T input, final UnsignedIntType output) { output.set(input.getIntegerLong()); }
Example #14
Source File: CreateIntegerTypeTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Test public void testUint32() { assertType(UnsignedIntType.class, 0xfffffffeL); assertType(UnsignedIntType.class, 0xffffffffL); assertNotType(UnsignedIntType.class, 0x100000000L); }
Example #15
Source File: ConvertTypes.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public UnsignedIntType createOutput(final T input) { return new UnsignedIntType(); }
Example #16
Source File: ConvertTypes.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void compute(final C input, final UnsignedIntType output) { output.set((long) input.getRealDouble()); }
Example #17
Source File: ConvertTypes.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public UnsignedIntType createOutput(final C input) { return new UnsignedIntType(); }