ImageCheck { public static boolean isVoxelIsotropic(final ImagePlus imp, final double tolerance) { if (imp == null) { IJ.error("No image", "Image is null"); return false; } final Calibration cal = imp.getCalibration(); final double vW = cal.pixelWidth; final double vH = cal.pixelHeight; final double tLow = 1 - tolerance; final double tHigh = 1 + tolerance; final double widthHeightRatio = vW > vH ? vW / vH : vH / vW; if (widthHeightRatio < tLow || widthHeightRatio > tHigh) { return false; } if (isSingleSlice(imp)) { return true; } final double vD = cal.pixelDepth; final double widthDepthRatio = vW > vD ? vW / vD : vD / vW; return (widthDepthRatio >= tLow && widthDepthRatio <= tHigh); } private  ImageCheck(); static void dicomVoxelDepth(final ImagePlus imp); static boolean huCalibrated(final ImagePlus imp); static boolean isBinary(final ImagePlus imp); static boolean isSingleSlice(final ImagePlus imp); static boolean isVoxelIsotropic(final ImagePlus imp,
		final double tolerance);  }
@Test public void testIsVoxelIsotropic() throws Exception { final ImagePlus testImage = mock(ImagePlus.class); final Calibration anisotropicCalibration = new Calibration(); anisotropicCalibration.pixelWidth = 2; anisotropicCalibration.pixelHeight = 1; when(testImage.getCalibration()).thenReturn(anisotropicCalibration); when(testImage.getStackSize()).thenReturn(1); boolean result = ImageCheck.isVoxelIsotropic(testImage, 0.0); assertFalse("Image where width > height should not be isotropic", result); result = ImageCheck.isVoxelIsotropic(testImage, 1.0); assertTrue("Image should be isotropic if anisotropy is within tolerance", result); anisotropicCalibration.pixelDepth = 1000; when(testImage.getStackSize()).thenReturn(100); result = ImageCheck.isVoxelIsotropic(testImage, 1.0); assertFalse("Pixel depth too great to be anisotropic within tolerance", result); }