private void parseCellObjects() { String rootObject = CellH5Constants.DEFINITION + CellH5Constants.OBJECT; List<String> allObjects = jhdf.getMember(rootObject); for (String objectName : allObjects) { String objectType = (String) jhdf.readCompoundArrayDataMap( rootObject + objectName)[0].get("type"); if (objectType.equals("region")) { cellObjectNames.add(objectName); LOGGER.debug("CellH5Reader: Found cell object {}", objectName); } } }
@Override public void close() throws IOException { jhdf.close(); super.close(); }
for (String plate : jhdf.getMember(path_to_plate)) { String path_to_well = path_to_plate + plate + CellH5Constants.WELL; LOGGER.info("Well :" + path_to_well ); for (String well : jhdf.getMember(path_to_well)) { String path_to_site = path_to_well + well + CellH5Constants.SITE; LOGGER.info("Site :" + path_to_site ); for (String site : jhdf.getMember(path_to_site)) { CellH5PositionList.add(new CellH5Coordinate(plate, well, site)); if (jhdf.exists(coord.pathToImageData)) { CoreMetadata m = new CoreMetadata(); core.add(m); int[] ctzyx = jhdf.getShape(coord.pathToImageData); m.sizeC = ctzyx[0]; m.sizeT = ctzyx[1]; m.interleaved = false; m.indexed = true; int bpp = jhdf.getElementSize(coord.pathToImageData); if (bpp==1) { m.pixelType = FormatTools.UINT8; if (jhdf.exists(coord.pathToSegmentationData)) { CoreMetadata m = new CoreMetadata(); core.add(m); int[] ctzyx = jhdf.getShape(coord.pathToSegmentationData); m.sizeC = ctzyx[0];
ServiceFactory factory = new ServiceFactory(); jhdf = factory.getInstance(JHDFService.class); jhdf.setFileForWrite(id); } catch (DependencyException e) { throw new MissingLibraryException(JHDFServiceImpl.NO_JHDF_MSG, e); jhdf.createGroup(CellH5Constants.DEFINITION + CellH5Reader.CellH5Constants.OBJECT); jhdf.createGroup(CellH5Constants.DEFINITION + CellH5Reader.CellH5Constants.FEATURE); jhdf.createGroup(CellH5Constants.DEFINITION + CellH5Reader.CellH5Constants.IMAGE); jhdf.initIntArray(outputPath, new long[] {sizeC, sizeT, sizeZ, sizeY, sizeX}, bpp);
int width = getSizeX(); int elementSize = jhdf.getElementSize(CellH5PathsToImageData.get(series)); MDIntArray test = jhdf.readIntBlockArray(CellH5PathsToImageData.get(series), arrayOrigin, arrayDimension);
private void initializeJHDFService(String id) throws IOException, MissingLibraryException { try { ServiceFactory factory = new ServiceFactory(); jhdf = factory.getInstance(JHDFService.class); jhdf.setFile(id); } catch (DependencyException e) { throw new MissingLibraryException(JHDFServiceImpl.NO_JHDF_MSG, e); } }
featureName + CellH5Constants.CLASS_LABELS; boolean hasClassification = false; if (jhdf.exists(pathToClassDefinition)) { String classColorHexString; HDF5CompoundDataMap[] classDef = jhdf.readCompoundArrayDataMap(pathToClassDefinition); for (int cls = 0; cls < classDef.length; cls++) { classColorHexString = (String) classDef[cls].get("color"); classes = jhdf.readCompoundArrayDataMap(coord.pathToPosition + featureName + CellH5Constants.PREDICTED_CLASS_LABELS); if (jhdf.exists(pathToBoundingBox)) { bbox = jhdf.readCompoundArrayDataMap(pathToBoundingBox); times = jhdf.readCompoundArrayDataMap( coord.pathToPosition + CellH5Constants.OBJECT + cellObjectName); int roiChannel = getChannelIndexOfCellObjectName(cellObjectName);
@Test public void testMember() { List<String> member = service.getMember("/member_1/"); assertEquals(member.get(0), "member_3"); }
@Test public void testReadIntBlockArray() { MDIntArray matrix = service.readIntBlockArray("/member_1/member_3/int_matrix", new int[]{0, 0, 0}, new int[]{10, 1, 8}); assertEquals(matrix.get(6, 0, 4), 178); }
@Test public void testGetShape() { int[] shape = service.getShape("/member_1/member_3/int_matrix"); assertEquals(shape.length, 3); assertEquals(shape[0], 10); assertEquals(shape[1], 9); assertEquals(shape[2], 8); }
@Test public void testGetFile() { assertEquals(TEST_FILE, new File(service.getFile()).getName()); }
for (String plate : jhdf.getMember(path_to_plate)) { String path_to_well = path_to_plate + plate + CellH5Constants.WELL; LOGGER.info("Well :" + path_to_well ); for (String well : jhdf.getMember(path_to_well)) { String path_to_site = path_to_well + well + CellH5Constants.SITE; LOGGER.info("Site :" + path_to_site ); for (String site : jhdf.getMember(path_to_site)) { CellH5PositionList.add(new CellH5Coordinate(plate, well, site)); if (jhdf.exists(coord.pathToImageData)) { CoreMetadata m = new CoreMetadata(); core.add(m); int[] ctzyx = jhdf.getShape(coord.pathToImageData); m.sizeC = ctzyx[0]; m.sizeT = ctzyx[1]; m.interleaved = false; m.indexed = true; int bpp = jhdf.getElementSize(coord.pathToImageData); if (bpp==1) { m.pixelType = FormatTools.UINT8; if (jhdf.exists(coord.pathToSegmentationData)) { CoreMetadata m = new CoreMetadata(); core.add(m); int[] ctzyx = jhdf.getShape(coord.pathToSegmentationData); m.sizeC = ctzyx[0];
ServiceFactory factory = new ServiceFactory(); jhdf = factory.getInstance(JHDFService.class); jhdf.setFileForWrite(id); } catch (DependencyException e) { throw new MissingLibraryException(JHDFServiceImpl.NO_JHDF_MSG, e); jhdf.createGroup(CellH5Constants.DEFINITION + CellH5Reader.CellH5Constants.OBJECT); jhdf.createGroup(CellH5Constants.DEFINITION + CellH5Reader.CellH5Constants.FEATURE); jhdf.createGroup(CellH5Constants.DEFINITION + CellH5Reader.CellH5Constants.IMAGE); jhdf.initIntArray(outputPath, new long[] {sizeC, sizeT, sizeZ, sizeY, sizeX}, bpp);
int width = getSizeX(); int elementSize = jhdf.getElementSize(CellH5PathsToImageData.get(series)); MDIntArray test = jhdf.readIntBlockArray(CellH5PathsToImageData.get(series), arrayOrigin, arrayDimension);
private void initializeJHDFService(String id) throws IOException, MissingLibraryException { try { ServiceFactory factory = new ServiceFactory(); jhdf = factory.getInstance(JHDFService.class); jhdf.setFile(id); } catch (DependencyException e) { throw new MissingLibraryException(JHDFServiceImpl.NO_JHDF_MSG, e); } }
featureName + CellH5Constants.CLASS_LABELS; boolean hasClassification = false; if (jhdf.exists(pathToClassDefinition)) { String classColorHexString; HDF5CompoundDataMap[] classDef = jhdf.readCompoundArrayDataMap(pathToClassDefinition); for (int cls = 0; cls < classDef.length; cls++) { classColorHexString = (String) classDef[cls].get("color"); classes = jhdf.readCompoundArrayDataMap(coord.pathToPosition + featureName + CellH5Constants.PREDICTED_CLASS_LABELS); if (jhdf.exists(pathToBoundingBox)) { bbox = jhdf.readCompoundArrayDataMap(pathToBoundingBox); times = jhdf.readCompoundArrayDataMap( coord.pathToPosition + CellH5Constants.OBJECT + cellObjectName); int roiChannel = getChannelIndexOfCellObjectName(cellObjectName);
private void parseCellObjects() { String rootObject = CellH5Constants.DEFINITION + CellH5Constants.OBJECT; List<String> allObjects = jhdf.getMember(rootObject); for (String objectName : allObjects) { String objectType = (String) jhdf.readCompoundArrayDataMap( rootObject + objectName)[0].get("type"); if (objectType.equals("region")) { cellObjectNames.add(objectName); LOGGER.debug("CellH5Reader: Found cell object {}", objectName); } } }
@BeforeMethod public void setUp() throws DependencyException, IOException { ServiceFactory sf = new ServiceFactory(); service = sf.getInstance(JHDFService.class); URL file = JHDFServiceTest.class.getResource(TEST_FILE); service.setFile(file.getPath()); }
@Override public void close() throws IOException { jhdf.close(); super.close(); }
@Override public void close(boolean fileOnly) throws IOException { super.close(fileOnly); if (!fileOnly) { seriesCount = 0; CellH5PositionList.clear(); CellH5PathsToImageData.clear(); cellObjectNames.clear(); if (jhdf != null) { jhdf.close(); } jhdf = null; lastChannel = 0; } }