Refine search
private boolean getCompression(int compression) throws FormatException { switch (compression) { case 0: return false; case 1: return true; default: throw new FormatException("Unsupported compression " + compression); } }
/** * Returns true if the given exception was cause * by a missing or invalid LuraWave license code. */ public static boolean isLicenseCodeException(FormatException exc) { String msg = exc == null ? null : exc.getMessage(); return msg != null && (msg.equals(LuraWaveServiceImpl.NO_LICENSE_MSG) || msg.startsWith(LuraWaveServiceImpl.INVALID_LICENSE_MSG)); }
} catch (FormatException e) { e.printStackTrace(); return null; } catch (IOException e) {
else throw new FormatException("Unsupported bits: " + value); if (values.length > 0) { final double size = computePhysicalSize(1, values[0], units[0]); originX = new Length(size, UNITS.REFERENCEFRAME); addGlobalMeta("X position for position #1", originX); originY = new Length(size, UNITS.REFERENCEFRAME); addGlobalMeta("Y position for position #1", originY); originZ = new Length(size, UNITS.REFERENCEFRAME); addGlobalMeta("Z position for position #1", originZ);
throw new FormatException(e); Double pos = zPosition.value().doubleValue(); if (physicalZ != null && z > 0) { pos += z * physicalZ.value().doubleValue(); store.setPlanePositionZ(FormatTools.createLength(pos, zPosition.unit()), 0, i);
omeMD.setPixelsPhysicalSizeX( FormatTools.createLength( omeMD.getPixelsPhysicalSizeX( 0 ).value().doubleValue() / magnification , omeMD.getPixelsPhysicalSizeX( 0 ).unit()), 0 ); omeMD.setPixelsPhysicalSizeY( FormatTools.createLength( omeMD.getPixelsPhysicalSizeY( 0 ).value().doubleValue() / magnification , omeMD.getPixelsPhysicalSizeY( 0 ).unit()), 0 ); break; default: throw new FormatException( "Cannot read image with pixel type = " + omeMD.getPixelsType( 0 ) );
throw new FormatException(NO_WLZ_MSG, e); final Length stageY = meta.getStageLabelY(0); final Length stageZ = meta.getStageLabelZ(0); oX = (int) Math.rint(stageX.value(UNITS.REFERENCEFRAME).doubleValue()); oY = (int) Math.rint(stageY.value(UNITS.REFERENCEFRAME).doubleValue()); oZ = (int) Math.rint(stageZ.value(UNITS.REFERENCEFRAME).doubleValue());
@Test public void testDEFLATE() throws FormatException, IOException { TiffCompression compression = TiffCompression.DEFLATE; try { assertNotNull(compression.decompress(DATA, OPTIONS)); } catch (FormatException e) { if (!(e.getCause() instanceof ZipException)) { fail("Unexpected exception: " + e); } } }
headerFile = id.substring(0, id.lastIndexOf(".")) + ".HDR"; if (!new Location(headerFile).exists()) { throw new FormatException("Could not find matching .hdr file."); xPos = new Length(number, UNITS.REFERENCEFRAME); addGlobalMeta("X position for position #1", xPos); yPos = new Length(number, UNITS.REFERENCEFRAME); addGlobalMeta("Y position for position #1", yPos);
throw new FormatException(e); Double pos = zPosition.value().doubleValue(); if (physicalZ != null && z > 0) { pos += z * physicalZ.value().doubleValue(); store.setPlanePositionZ(FormatTools.createLength(pos, zPosition.unit()), 0, i);
throw new FormatException(NO_WLZ_MSG, e); final Length stageY = meta.getStageLabelY(0); final Length stageZ = meta.getStageLabelZ(0); oX = (int) Math.rint(stageX.value(UNITS.REFERENCEFRAME).doubleValue()); oY = (int) Math.rint(stageY.value(UNITS.REFERENCEFRAME).doubleValue()); oZ = (int) Math.rint(stageZ.value(UNITS.REFERENCEFRAME).doubleValue());
@Test public void testLZW() throws FormatException, IOException { TiffCompression compression = TiffCompression.LZW; try { assertNotNull(compression.decompress(DATA, OPTIONS)); } catch (FormatException e) { if (!(e.getCause() instanceof EOFException)) { fail("Unexpected exception: " + e); } } }
else throw new FormatException("Unsupported bits: " + value); if (values.length > 0) { final double size = computePhysicalSize(1, values[0], units[0]); originX = new Length(size, UNITS.REFERENCEFRAME); addGlobalMeta("X position for position #1", originX); originY = new Length(size, UNITS.REFERENCEFRAME); addGlobalMeta("Y position for position #1", originY); originZ = new Length(size, UNITS.REFERENCEFRAME); addGlobalMeta("Z position for position #1", originZ);
Location xml = new Location(parent, XML_FILES[0]); if (!xml.exists()) { throw new FormatException("Could not find XML file " + xml.getAbsolutePath()); Unit<Length> firstZUnit = planes[i][0].positionZ.unit(); double firstZ = planes[i][0].positionZ.value().doubleValue(); double lastZ = planes[i][planes[i].length - 1].positionZ.value(firstZUnit).doubleValue(); double averageStep = (lastZ - firstZ) / (getSizeZ() - 1); store.setPixelsPhysicalSizeZ(FormatTools.getPhysicalSizeZ(averageStep, firstZUnit), i);
throw new FormatException("Invalid server address"); throw new FormatException("Invalid username"); throw new FormatException("Invalid password"); throw new FormatException("Invalid image ID"); throw new FormatException("Could not find Image with ID=" + iid + " in group '" + group + "'."); if (px != null && px.value().doubleValue() > 0) { store.setPixelsPhysicalSizeX(px, 0); if (py != null && py.value().doubleValue() > 0) { store.setPixelsPhysicalSizeY(py, 0); if (pz != null && pz.value().doubleValue() > 0) { store.setPixelsPhysicalSizeZ(pz, 0); throw new FormatException(e);
@Override public void setCompression(String compress) throws FormatException { // check that this is a valid type for (int i=0; i<compressionTypes.length; i++) { if (compressionTypes[i].equals(compress)) { compression = compress; return; } } throw new FormatException("Invalid compression type: " + compress); }
/** * Returns true if the given exception was cause * by a missing or invalid LuraWave license code. */ public static boolean isLicenseCodeException(FormatException exc) { String msg = exc == null ? null : exc.getMessage(); return msg != null && (msg.equals(LuraWaveServiceImpl.NO_LICENSE_MSG) || msg.startsWith(LuraWaveServiceImpl.INVALID_LICENSE_MSG)); }
/** * Write a summary of each record to STDOUT * * @param args * @throws IOException */ static public void main(String [] args) throws IOException{ try (IM3Reader reader = new IM3Reader()) { reader.setId(args[0]); reader.writeSummary(); } catch (FormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
@Test public void testPROPRIETARY_DEFLATE() throws FormatException, IOException { TiffCompression compression = TiffCompression.PROPRIETARY_DEFLATE; try { assertNotNull(compression.decompress(DATA, OPTIONS)); } catch (FormatException e) { if (!(e.getCause() instanceof ZipException)) { fail("Unexpected exception: " + e); } } }
headerFile = id.substring(0, id.lastIndexOf(".")) + ".HDR"; if (!new Location(headerFile).exists()) { throw new FormatException("Could not find matching .hdr file."); xPos = new Length(number, UNITS.REFERENCEFRAME); addGlobalMeta("X position for position #1", xPos); yPos = new Length(number, UNITS.REFERENCEFRAME); addGlobalMeta("Y position for position #1", yPos);