List of usage examples for com.mongodb BasicDBObject getInt
public int getInt(final String key)
From source file:tango.mongo.MongoConnector.java
License:Open Source License
public synchronized HashMap<Integer, BasicDBObject> getObjects(ObjectId nucleusId, int channelIdx) { BasicDBObject query = new BasicDBObject("nucleus_id", nucleusId).append("channelIdx", channelIdx); DBCursor cursor = object3D.find(query); HashMap<Integer, BasicDBObject> res = new HashMap<Integer, BasicDBObject>(cursor.size()); while (cursor.hasNext()) { BasicDBObject nuc = (BasicDBObject) cursor.next(); res.put(nuc.getInt("idx"), nuc); }/*from w ww . j a va 2 s . c o m*/ cursor.close(); return res; }
From source file:tango.mongo.MongoConnector.java
License:Open Source License
public synchronized ImageHandler getInputImage(ObjectId field_id, int idx) { BasicDBObject query = new BasicDBObject("field_id", field_id).append("fileRank", idx); GridFSDBFile f = this.gfsField.findOne(query); if (f != null) { ImageHandler res = createImage(f); if (res != null) { return res; }/*ww w .j a v a2 s .co m*/ } // open from directory BasicDBObject field = this.getField(field_id); String error = "could'nt open file:" + idx + " from field:" + field.getString("name") + " please relink files by launching the command \"import files\""; if (field.containsField("files")) { BasicDBList files = (BasicDBList) field.get("files"); if (files.size() > 1) { // separated files if (idx >= files.size()) { IJ.log(error); } else { BasicDBObject fileObj = (BasicDBObject) files.get(idx); File file = new File(fileObj.getString("path")); if (file.exists()) { return ImageOpener.OpenChannel(file, 0, 0, 0); } } } else { BasicDBObject fileObj = (BasicDBObject) files.get(0); File file = new File(fileObj.getString("path")); if (file.exists()) { return ImageOpener.OpenChannel(file, idx, fileObj.getInt("series"), fileObj.getInt("timePoint")); } } } else { IJ.log(error); } return null; }
From source file:tango.mongo.MongoConnector.java
License:Open Source License
public synchronized byte[] createInputImageThumbnail(ObjectId field_id, int idx) { BasicDBObject query = new BasicDBObject("field_id", field_id).append("fileRank", idx); GridFSDBFile f = this.gfsField.findOne(query); if (f != null) { ImageHandler res = createImage(f); if (res != null) { return res.getThumbNail(Field.tmbSize, Field.tmbSize); }//from ww w.j a v a 2 s . c o m } // open from directory BasicDBObject field = this.getField(field_id); String error = "could'nt open file:" + idx + " from field:" + field.getString("name") + " please relink files by launching the command \"import files\""; if (field.containsField("files")) { BasicDBList files = (BasicDBList) field.get("files"); if (files.size() > 1) { // separated files if (idx >= files.size()) { IJ.log(error); } else { BasicDBObject fileObj = (BasicDBObject) files.get(idx); File file = new File(fileObj.getString("path")); if (file.exists()) { return ImageOpener.openThumbnail(file, 0, 0, 0, Field.tmbSize, Field.tmbSize); } } } else { BasicDBObject fileObj = (BasicDBObject) files.get(0); File file = new File(fileObj.getString("path")); if (file.exists()) { return ImageOpener.openThumbnail(file, idx, fileObj.getInt("series"), fileObj.getInt("timePoint"), Field.tmbSize, Field.tmbSize); } } } else { IJ.log(error); } return null; }
From source file:tango.parameter.IntParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id) && DBO.get(id) != null) { number.setValue(DBO.getInt(id)); }/*ww w . j ava 2 s . c om*/ setColor(); }
From source file:tango.parameter.SliderParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id) && DBO.get(id) != null) { int value = DBO.getInt(id); if (value < this.min) { slider.setValue(min);/*www.ja va 2s .com*/ } else if (value > this.max) { slider.setValue(max); } else { slider.setValue(value); } } setColor(); }
From source file:tango.parameter.SpinnerParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id)) { model.setValue(new Integer(DBO.getInt(id))); }// w ww . j a va 2 s . c om setColor(); }
From source file:tango.parameter.StructureParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id)) { int idx = DBO.getInt(id) + 1; if (choice.getItemCount() > idx) { choice.setSelectedIndex(idx); }// w ww . j av a 2s. com } setColor(); }