@Test(dependsOnMethods = {"testMetadataLevel"}) public void testMetadataLevelEquivilentDimensions() { assertEquals(wrapper.getSeriesCount(), minimalWrapper.getSeriesCount()); for (int i = 0; i < minimalWrapper.getSeriesCount(); i++) { wrapper.setSeries(i); minimalWrapper.setSeries(i); assertEquals(wrapper.getSizeX(), minimalWrapper.getSizeX()); assertEquals(wrapper.getSizeY(), minimalWrapper.getSizeY()); assertEquals(wrapper.getSizeZ(), minimalWrapper.getSizeZ()); assertEquals(wrapper.getSizeC(), minimalWrapper.getSizeC()); assertEquals(wrapper.getSizeT(), minimalWrapper.getSizeT()); assertEquals(wrapper.getPixelType(), minimalWrapper.getPixelType()); assertEquals(wrapper.isLittleEndian(), minimalWrapper.isLittleEndian()); } }
/** * Parse the binary data to generate min/max values and allow an md to be calculated. * * @param series * @return The SHA1 message digest for the binary data. */ public MessageDigest parseData(String fileName, int series, ImportSize size) throws FormatException, IOException, ServerError { reader.setSeries(series); int maxPlaneSize = sizes.getMaxPlaneWidth() * sizes.getMaxPlaneHeight(); if (((long) reader.getSizeX() * (long) reader.getSizeY()) > maxPlaneSize) { return null; } int bytesPerPixel = getBytesPerPixel(reader.getPixelType()); MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Required SHA-1 message digest algorithm unavailable."); } int planeNo = 1; for (int t = 0; t < size.sizeT; t++) { for (int c = 0; c < size.sizeC; c++) { for (int z = 0; z < size.sizeZ; z++) { parseDataByPlane(size, z, c, t, bytesPerPixel, fileName, md); notifyObservers(new ImportEvent.IMPORT_STEP(planeNo, series, reader.getSeriesCount())); planeNo++; } } } return md; }