Changeset 3929
 Timestamp:
 04/16/08 17:08:07 (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/loci/formats/in/ND2Reader.java
r3928 r3929 495 495 } 496 496 for (int j = off; j<len; j+=8) { 497 tsT.add(new Double(arr2double(b, j))); 498 } 499 addMeta("ts_t", tsT); 500 // adds the whole vector of times to the meta data 501 // I do not know if this will run in to trouble with the 502 // size limits on the length of strings in the hash table 503 addMeta("ts_t_sz", new Integer(tsT.size())); 504 // adds the length of the acq time vector to the hash table 505 // as a double check 497 double s = DataTools.bytesToDouble(b, j, 8, true); 498 tsT.add(new Double(s)); 499 addMeta("timestamp " + (tsT.size()  1), String.valueOf(s)); 500 } 506 501 } 507 502 … … 618 613 store.setImageCreationDate( 619 614 DataTools.convertDate(System.currentTimeMillis(), DataTools.UNIX), i); 620 // CTR CHECK 621 // for (int j=0; j<core.sizeC[i]; j++) { 622 // store.setLogicalChannel(j, null, null, null, null, null, null, null, 623 // null, null, null, null, null, null, null, null, null, null, null, 624 // null, null, null, null, null, new Integer(i)); 625 // } 626 } 627 //addMeta("ts", ts.elementAt(25)); 628 //addMeta("tssz", new Integer(ts.size())); 615 616 if (tsT.size() > 0) { 617 setSeries(i); 618 for (int n=0; n<core.imageCount[i]; n++) { 619 int[] coords = getZCTCoords(n); 620 store.setPlaneTheZ(new Integer(coords[0]), i, 0, n); 621 store.setPlaneTheC(new Integer(coords[1]), i, 0, n); 622 store.setPlaneTheT(new Integer(coords[2]), i, 0, n); 623 float stamp = ((Double) tsT.get(coords[2])).floatValue(); 624 store.setPlaneTimingDeltaT(new Float(stamp), i, 0, n); 625 } 626 } 627 } 628 setSeries(0); 629 629 630 630 return; … … 1024 1024 if (!ts.contains(new Long(v))) { 1025 1025 ts.add(new Long(v)); 1026 addMeta(" changes", new Integer(ts.size()));1026 addMeta("number of timepoints", new Integer(ts.size())); 1027 1027 } 1028 1028 } … … 1089 1089 } 1090 1090 1091 /**1092 * Helper function for parsing acq times.1093 * Code from http://www.captain.at/howtojavaconvertbinarydata.php1094 */1095 private double arr2double(byte[] arr, int start) {1096 // I am not sure what the protocol on this is1097 int i = 0;1098 int len = 8;1099 int cnt = 0;1100 byte[] tmp = new byte[len];1101 for (i = start; i < (start + len); i++) {1102 tmp[cnt] = arr[i];1103 cnt++;1104 }1105 long accum = 0;1106 i = 0;1107 for (int shiftBy = 0; shiftBy < 64; shiftBy += 8) {1108 accum = ((long) (tmp[i] & 0xff)) << shiftBy;1109 i++;1110 }1111 return Double.longBitsToDouble(accum);1112 }1113 1114 1091 }
Note: See TracChangeset
for help on using the changeset viewer.