protected Node readNode(BufferedInputStreamWrapper nodesFileStream) throws IOException { int nodeId = nodesFileStream.readInt(); int perimeter = nodesFileStream.readInt(); int area = nodesFileStream.readInt(); int upperLeftX = nodesFileStream.readInt(); int upperLeftY = nodesFileStream.readInt(); int width = nodesFileStream.readInt(); int height = nodesFileStream.readInt(); BoundingBox box = new BoundingBox(upperLeftX, upperLeftY, width, height); int contourSize = nodesFileStream.readInt(); int byteCount = nodesFileStream.readInt(); byte[] bits = new byte[byteCount]; nodesFileStream.readFully(bits); Contour contour = new Contour(contourSize, bits); int numberOfComponentsPerPixel = nodesFileStream.readInt(); return buildNode(nodeId, box, contour, perimeter, area, numberOfComponentsPerPixel); }
inputFileStream = new BufferedInputStreamWrapper(nodesFile); int bandCount = inputFileStream.readInt(); for (int x = segmentationTileLeftX; x < segmentationTileRightX; x++) { for (int i=0; i<bandCount; i++) { output[i].setValueAt(y, x, inputFileStream.readFloat()); if (inputFileStream != null) { try { inputFileStream.close(); } catch (IOException exception) {
try { File nodesFile = this.temporaryFolder.resolve(nodesPath).toFile(); nodesFileStream = new BufferedInputStreamWrapper(nodesFile); int nodeCount = nodesFileStream.readInt(); Int2ObjectMap<Node> nodesMap = new Int2ObjectLinkedOpenHashMap<Node>(nodeCount); Graph graph = new Graph(nodeCount); edgesFileStream = new BufferedInputStreamWrapper(edgesFile); int nodeId = edgesFileStream.readInt(); assert(node.getId() == nodeId); int edgeCount = edgesFileStream.readInt(); for (int k=0; k<edgeCount; k++) { int targetNodeId = edgesFileStream.readInt(); int boundary = edgesFileStream.readInt(); Node targetNode = nodesMap.get(targetNodeId); if (targetNode != null) { if (nodesFileStream != null) { try { nodesFileStream.close(); } catch (IOException exception) { edgesFileStream.close(); } catch (IOException exception) {
public static ByteMatrix readMaskTile(Path parentFolderPath, int tileLeftX, int tileTopY, int tileWidth, int tileHeight) throws IOException { File nodesFile = AbstractWriteMasksTilesComputing.computeMaskTilePath(parentFolderPath, tileLeftX, tileTopY, tileWidth, tileHeight).toFile(); BufferedInputStreamWrapper inputFileStream = null; try { inputFileStream = new BufferedInputStreamWrapper(nodesFile); ByteMatrix maskTilePixels = new ByteMatrix(tileHeight, tileWidth); int tileBottomY = tileTopY + tileHeight; int tileRightX = tileLeftX + tileWidth; for (int y = tileTopY; y < tileBottomY; y++) { for (int x = tileLeftX; x < tileRightX; x++) { maskTilePixels.setValueAt(y-tileTopY, x-tileLeftX, inputFileStream.readBoolean() ? 1 : (byte)ForestCoverChangeConstants.NO_DATA_VALUE); } } return maskTilePixels; } finally { if (inputFileStream != null) { try { inputFileStream.close(); } catch (IOException exception) { // ignore exception } } } }
@Override protected Node readNode(BufferedInputStreamWrapper nodesFileStream) throws IOException { BaatzSchapeNode node = (BaatzSchapeNode)super.readNode(nodesFileStream); int count = node.getNumberOfComponentsPerPixel(); for (int i=0; i<count; i++) { node.setMeansAt(i, nodesFileStream.readFloat()); node.setSpectralSumAt(i, nodesFileStream.readFloat()); node.setSquareMeansAt(i, nodesFileStream.readFloat()); node.setStdAt(i, nodesFileStream.readFloat()); } return node; } }
public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); } }
@Override protected Node readNode(BufferedInputStreamWrapper nodesFileStream) throws IOException { SpringNode node = (SpringNode)super.readNode(nodesFileStream); int count = node.getNumberOfComponentsPerPixel(); for (int i=0; i<count; i++) { node.setMeansAt(i, nodesFileStream.readFloat()); } return node; } }
@Override protected Node readNode(BufferedInputStreamWrapper nodesFileStream) throws IOException { FullLambdaScheduleNode node = (FullLambdaScheduleNode)super.readNode(nodesFileStream); int count = node.getNumberOfComponentsPerPixel(); for (int i=0; i<count; i++) { node.setMeansAt(i, nodesFileStream.readFloat()); } return node; } }