@Test public void testIsBinaryBooleanTypeAssignable() { final Img<BitType> img = ArrayImgs.bits(1); final boolean isBinary = ElementUtil.isBinary(img); assertTrue("A BitType image should be binary", isBinary); }
public static <T extends RealType<T> & NativeType<T>> boolean isBinary( final IterableInterval<T> interval) { if (interval.size() == 0) { return false; } if (BooleanType.class.isAssignableFrom(interval.firstElement() .getClass())) { return true; } double a = interval.firstElement().getRealDouble(); double b = a; double c; final Cursor<T> cursor = interval.cursor(); while (cursor.hasNext()){ c = cursor.next().getRealDouble(); if (c != a) { b = c; break; } } while (cursor.hasNext()) { c = cursor.next().getRealDouble(); if (c == a || c == b) continue; return false; } return true; }
ElementUtil { public static <T extends RealType<T> & NativeType<T>> boolean isBinary( final IterableInterval<T> interval) { if (interval.size() == 0) { return false; } if (BooleanType.class.isAssignableFrom(interval.firstElement() .getClass())) { return true; } double a = interval.firstElement().getRealDouble(); double b = a; double c; final Cursor<T> cursor = interval.cursor(); while (cursor.hasNext()){ c = cursor.next().getRealDouble(); if (c != a) { b = c; break; } } while (cursor.hasNext()) { c = cursor.next().getRealDouble(); if (c == a || c == b) continue; return false; } return true; } }
ElementUtil { public static <T extends RealType<T> & NativeType<T>> boolean isBinary( final IterableInterval<T> interval) { if (interval.size() == 0) { return false; } if (BooleanType.class.isAssignableFrom(interval.firstElement() .getClass())) { return true; } double a = interval.firstElement().getRealDouble(); double b = a; double c; final Cursor<T> cursor = interval.cursor(); while (cursor.hasNext()){ c = cursor.next().getRealDouble(); if (c != a) { b = c; break; } } while (cursor.hasNext()) { c = cursor.next().getRealDouble(); if (c == a || c == b) continue; return false; } return true; } private  ElementUtil(); }
ElementUtil { public static <T extends RealType<T> & NativeType<T>> boolean isBinary( final IterableInterval<T> interval) { if (interval.size() == 0) { return false; } if (BooleanType.class.isAssignableFrom(interval.firstElement() .getClass())) { return true; } double a = interval.firstElement().getRealDouble(); double b = a; double c; final Cursor<T> cursor = interval.cursor(); while (cursor.hasNext()){ c = cursor.next().getRealDouble(); if (c != a) { b = c; break; } } while (cursor.hasNext()) { c = cursor.next().getRealDouble(); if (c == a || c == b) continue; return false; } return true; } private  ElementUtil(); static double calibratedSpatialElementSize(final T space, final UnitService unitService); static boolean isBinary(
		final IterableInterval<T> interval); }
ElementUtil { public static <T extends RealType<T> & NativeType<T>> boolean isBinary( final IterableInterval<T> interval) { if (interval.size() == 0) { return false; } if (BooleanType.class.isAssignableFrom(interval.firstElement() .getClass())) { return true; } double a = interval.firstElement().getRealDouble(); double b = a; double c; final Cursor<T> cursor = interval.cursor(); while (cursor.hasNext()){ c = cursor.next().getRealDouble(); if (c != a) { b = c; break; } } while (cursor.hasNext()) { c = cursor.next().getRealDouble(); if (c == a || c == b) continue; return false; } return true; } private  ElementUtil(); static double calibratedSpatialElementSize(final T space, final UnitService unitService); static boolean isBinary(
		final IterableInterval<T> interval);  }