@Test public void testIsAxesMatchingSpatialCalibration() { final String unit = "mm"; final double scale = 0.75; final DefaultLinearAxis xAxis = new DefaultLinearAxis(Axes.X, unit, scale); final DefaultLinearAxis yAxis = new DefaultLinearAxis(Axes.Y, unit, scale); final Img<BitType> img = ArrayImgs.bits(1, 1); final ImgPlus<BitType> imgPlus = new ImgPlus<>(img, "Test image", xAxis, yAxis); final boolean result = SurfaceAreaWrapper.isAxesMatchingSpatialCalibration( imgPlus); assertTrue("Axes should have matching calibration", result); }
static <T extends AnnotatedSpace<CalibratedAxis>> boolean isAxesMatchingSpatialCalibration(final T space) { final boolean noUnits = spatialAxisStream(space).map(CalibratedAxis::unit) .allMatch(StringUtils::isNullOrEmpty); final boolean matchingUnit = spatialAxisStream(space).map( CalibratedAxis::unit).distinct().count() == 1; final boolean matchingScale = spatialAxisStream(space).map(a -> a .averageScale(0, 1)).distinct().count() == 1; return (matchingUnit || noUnits) && matchingScale; }
SurfaceAreaWrapper extends BoneJCommand { static <T extends AnnotatedSpace<CalibratedAxis>> boolean isAxesMatchingSpatialCalibration(final T space) { final boolean noUnits = spatialAxisStream(space).map(CalibratedAxis::unit) .allMatch(StringUtils::isNullOrEmpty); final boolean matchingUnit = spatialAxisStream(space).map( CalibratedAxis::unit).distinct().count() == 1; final boolean matchingScale = spatialAxisStream(space).map(a -> a .averageScale(0, 1)).distinct().count() == 1; return (matchingUnit || noUnits) && matchingScale; } }
SurfaceAreaWrapper extends BoneJCommand { static <T extends AnnotatedSpace<CalibratedAxis>> boolean isAxesMatchingSpatialCalibration(final T space) { final boolean noUnits = spatialAxisStream(space).map(CalibratedAxis::unit) .allMatch(StringUtils::isNullOrEmpty); final boolean matchingUnit = spatialAxisStream(space).map( CalibratedAxis::unit).distinct().count() == 1; final boolean matchingScale = spatialAxisStream(space).map(a -> a .averageScale(0, 1)).distinct().count() == 1; return (matchingUnit || noUnits) && matchingScale; }  }
SurfaceAreaWrapper extends BoneJCommand { static <T extends AnnotatedSpace<CalibratedAxis>> boolean isAxesMatchingSpatialCalibration(final T space) { final boolean noUnits = spatialAxisStream(space).map(CalibratedAxis::unit) .allMatch(StringUtils::isNullOrEmpty); final boolean matchingUnit = spatialAxisStream(space).map( CalibratedAxis::unit).distinct().count() == 1; final boolean matchingScale = spatialAxisStream(space).map(a -> a .averageScale(0, 1)).distinct().count() == 1; return (matchingUnit || noUnits) && matchingScale; }  @Override void run(); }
SurfaceAreaWrapper extends BoneJCommand { static <T extends AnnotatedSpace<CalibratedAxis>> boolean isAxesMatchingSpatialCalibration(final T space) { final boolean noUnits = spatialAxisStream(space).map(CalibratedAxis::unit) .allMatch(StringUtils::isNullOrEmpty); final boolean matchingUnit = spatialAxisStream(space).map( CalibratedAxis::unit).distinct().count() == 1; final boolean matchingScale = spatialAxisStream(space).map(a -> a .averageScale(0, 1)).distinct().count() == 1; return (matchingUnit || noUnits) && matchingScale; }  @Override void run();  }