@Override public Object fromString(String str) { return StringUtils.toDoubleArray(str, ","); } });
public static TiledFileMultiLevelSource create(File imageDir) throws IOException { Assert.notNull(imageDir); final Properties imageProperties = new Properties(); imageProperties.load(new FileReader(new File(imageDir, "image.properties"))); int levelCount = Integer.parseInt(imageProperties.getProperty("numLevels")); int sourceWidth = Integer.parseInt(imageProperties.getProperty("width")); int sourceHeight = Integer.parseInt(imageProperties.getProperty("height")); final String s = imageProperties.getProperty("i2mTransform"); AffineTransform i2mTransform = new AffineTransform(); if (s != null) { try { double[] matrix = StringUtils.toDoubleArray(s, ","); if (matrix.length == 6) { i2mTransform = new AffineTransform(matrix); } } catch (IllegalArgumentException e) { // may be thrown by StringUtils.toDoubleArray(), use identity instead } } final MultiLevelModel model = new DefaultMultiLevelModel(levelCount, i2mTransform, sourceWidth, sourceHeight); return new TiledFileMultiLevelSource(model, imageDir, imageProperties); }
static Kernel convertElementToKernel(Element kernelInfo) { final String kernelDataString = kernelInfo.getChildTextTrim(DimapProductConstants.TAG_KERNEL_DATA); final double[] data = StringUtils.toDoubleArray(kernelDataString, ","); int width = Integer.parseInt(kernelInfo.getChildTextTrim(DimapProductConstants.TAG_KERNEL_WIDTH)); int height = Integer.parseInt(kernelInfo.getChildTextTrim(DimapProductConstants.TAG_KERNEL_HEIGHT)); String xOriginText = kernelInfo.getChildTextTrim(DimapProductConstants.TAG_KERNEL_X_ORIGIN); int xOrigin = (width - 1) / 2; if (xOriginText != null) { xOrigin = Integer.parseInt(xOriginText); } String yOriginText = kernelInfo.getChildTextTrim(DimapProductConstants.TAG_KERNEL_Y_ORIGIN); int yOrigin = (height - 1) / 2; if (yOriginText != null) { yOrigin = Integer.parseInt(yOriginText); } String factorText = kernelInfo.getChildTextTrim(DimapProductConstants.TAG_KERNEL_FACTOR); double factor = 1; if (factorText != null) { factor = Double.parseDouble(factorText); } return new Kernel(width, height, xOrigin, yOrigin, factor, data); }
if (histoSkipPercentStr != null) { try { _histoSkipRatios = StringUtils.toDoubleArray(histoSkipPercentStr, ","); if (_histoSkipRatios.length != 2) { error("invalid contrast stretch range '" + histoSkipPercentStr + "'");