Examples of ImageFile


Examples of org.cellprofiler.imageset.ImageFile

      ep.setSubpredicates(a);
      for (boolean testcase: new boolean [] {true, false}) {
        for (String filename:(testcase? pos:neg)) {
          File rootFile = new File(System.getProperty("user.home"));
          File testFile = new File(rootFile, filename);
          ImageFile imageFile = new ImageFile(testFile.toURI());
          assertEquals(ep.eval(imageFile), testcase);
        }
      }
    } catch (BadFilterExpressionException e) {
      fail();
View Full Code Here

Examples of org.cellprofiler.imageset.ImageFile

  @Test
  public void testEvalFile() {
    FileNamePredicate pred = new FileNamePredicate();
    try {
      pred.setSubpredicates(Expects.expects("foo.jpg"));
      ImageFile imgfile = new ImageFile(new URI("file:///imaging/analysis/foo.jpg"));
      pred.eval(imgfile);
    } catch (BadFilterExpressionException e) {
      fail("File predicate takes a subpredicate");
    } catch (URISyntaxException e) {
      fail();
View Full Code Here

Examples of org.cellprofiler.imageset.ImageFile

  @Test
  public void testEvalHTTP() {
    FileNamePredicate pred = new FileNamePredicate();
    try {
      pred.setSubpredicates(Expects.expects("bar.jpg"));
      ImageFile imgfile = new ImageFile(new URI("http://www.cellprofiler.org/linked_files/bar.jpg"));
      pred.eval(imgfile);
    } catch (BadFilterExpressionException e) {
      fail("File predicate takes a subpredicate");
    } catch (URISyntaxException e) {
      fail();
View Full Code Here

Examples of org.cellprofiler.imageset.ImageFile

  @Test
  public void testEvalOMERO() {
    FileNamePredicate pred = new FileNamePredicate();
    try {
      pred.setSubpredicates(Expects.expects("iid=12345"));
      ImageFile imgfile = new ImageFile(new URI("omero:iid=12345"));
      pred.eval(imgfile);
    } catch (BadFilterExpressionException e) {
      fail("File predicate takes a subpredicate");
    } catch (URISyntaxException e) {
      fail();
View Full Code Here

Examples of org.cellprofiler.imageset.ImageFile

    File root = new File(System.getProperty("user.home"));
    File fileAtPath = new File(root, "foo.jpg");
    String expectedPath = root.getAbsolutePath();
    try {
      pred.setSubpredicates(Expects.expects(expectedPath));
      ImageFile imgfile = new ImageFile(fileAtPath.toURI());
      pred.eval(imgfile);
    } catch (BadFilterExpressionException e) {
      fail("Path predicate takes a subpredicate.");
    }
  }
View Full Code Here

Examples of org.cellprofiler.imageset.ImageFile

  @Test
  public void testEvalHTTP() {
    PathPredicate pred = new PathPredicate();
    try {
      pred.setSubpredicates(Expects.expects("http://www.cellprofiler.org/linked_files"));
      ImageFile imgfile = new ImageFile(new URI("http://www.cellprofiler.org/linked_files/bar.jpg"));
      pred.eval(imgfile);
    } catch (BadFilterExpressionException e) {
      fail("Path predicate takes a subpredicate.");
    } catch (URISyntaxException e) {
      // TODO Auto-generated catch block
View Full Code Here

Examples of org.cellprofiler.imageset.ImageFile

   * @param url construct an ImageFile based on this URL
   * @return true to keep, false to filter out
   * @throws BadFilterExpressionException if the expression cannot be parsed
   */
  static public boolean filter(String expression, URI url) throws BadFilterExpressionException {
    return filter(expression, new ImageFile(url), ImageFile.class);
  }
View Full Code Here

Examples of org.dddlib.image.api.pojo.ImageFile

        String file = getClass().getResource("/aaa.jpg").getFile();
        ImageAccess imageAccess = new CacheImageAccess(cache);
        String uuid = imageAccess.saveImageFile(FileUtils.readFileToByteArray(new File(file)), "aaa.jpg");
        System.out.println(uuid);
        assertTrue(uuid != null);
        ImageFile imageFile = imageAccess.getImageFile(uuid);
        assertTrue(imageFile.getContent() != null);
        assertTrue(imageFile.getFileName().equals("aaa.jpg"));
    }
View Full Code Here

Examples of org.dddlib.image.api.pojo.ImageFile

        Cache redisCache = new RedisBasedCache("127.0.0.1", 6379);
        ImageAccess imageAccess = new CacheImageAccess(redisCache);
        String uuid = imageAccess.saveImageFile(FileUtils.readFileToByteArray(new File(file)), "aaa.jpg");
        System.out.println(uuid);
        assertTrue(uuid != null);
        ImageFile imageFile = imageAccess.getImageFile(uuid);
        assertTrue(imageFile.getContent() != null);
        assertTrue(imageFile.getFileName().equals("aaa.jpg"));
    }
View Full Code Here

Examples of org.dddlib.image.api.pojo.ImageFile

    public String saveImageFile(byte[] content, String filename) {
        assert cache!=null : "cache不能为空";
        assert content!=null : "图片内容不能为空";
        assert filename!=null : "图片文件名不能为空";

        ImageFile imageFile = new ImageFile(content,filename);
        String uuid = UUID.randomUUID().toString().toUpperCase();
        cache.put(uuid, imageFile);
        return uuid;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.