Changeset 6553
- Timestamp:
- 06/22/10 15:38:25 (9 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.2/components/bio-formats/src/loci/formats/in/VisitechReader.java
r6301 r6553 107 107 while (s.read() != (byte) 0xf0); 108 108 s.skipBytes(1); 109 if (s.readInt() == 0) s.skipBytes(4 + ((plane + 164) * planeIndex)); 109 110 int paddingBytes = 111 (int) (s.length() - s.getFilePointer() - div * plane) / (div - 1); 112 113 if (s.readInt() == 0) { 114 s.skipBytes(4 + ((plane + paddingBytes) * planeIndex)); 115 } 110 116 else { 111 117 if (planeIndex == 0) s.seek(s.getFilePointer() - 4); 112 else s.skipBytes((plane + 164) * planeIndex - 4);118 else s.skipBytes((plane + paddingBytes) * planeIndex - 4); 113 119 } 114 120 … … 169 175 int numSeries = 0; 170 176 String[] tokens = s.split("\n"); 177 int estimatedSeriesCount = 0, estimatedSizeC = 0; 171 178 for (String token : tokens) { 172 179 token = token.trim(); … … 218 225 } 219 226 } 220 } 227 else if (token.indexOf("Document created") != -1) { 228 estimatedSeriesCount++; 229 estimatedSizeC++; 230 } 231 } 232 233 if (numSeries == 0) { 234 numSeries = estimatedSeriesCount; 235 core[0].sizeC *= estimatedSizeC; 236 } 237 if (getSizeC() == 0) core[0].sizeC = estimatedSizeC; 238 239 if (getSizeC() == 0) core[0].sizeC = 1; 240 if (getSizeZ() == 0) core[0].sizeZ = 1; 241 242 // find pixels files - we think there is one channel per file 243 244 files = new Vector<String>(); 245 246 int ndx = currentId.lastIndexOf(File.separator) + 1; 247 String base = currentId.substring(ndx, currentId.lastIndexOf(" ")); 248 249 File f = new File(currentId).getAbsoluteFile(); 250 String file = f.exists() ? f.getParent() + File.separator : ""; 251 252 if (numSeries == 0) numSeries = 1; 253 for (int i=0; i<getSizeC(); i++) { 254 String pixelsFile = file + base + " " + (i + 1) + ".xys"; 255 Location p = new Location(pixelsFile); 256 if (p.exists()) files.add(p.getAbsolutePath()); 257 else { 258 if (numSeries > 1) { 259 core[0].sizeC -= (getSizeC() / numSeries); 260 numSeries--; 261 } 262 else if (getSizeC() > 1) core[0].sizeC--; 263 } 264 } 265 files.add(currentId); 221 266 222 267 if (getSizeT() == 0) { … … 224 269 if (getSizeT() == 0) core[0].sizeT = 1; 225 270 } 271 226 272 if (getImageCount() == 0) { 227 273 core[0].imageCount = getSizeZ() * getSizeC() * getSizeT(); 228 274 } 229 230 275 if (numSeries > 1) { 231 276 int x = getSizeX(); … … 259 304 } 260 305 261 // find pixels files - we think there is one channel per file262 263 files = new Vector<String>();264 265 int ndx = currentId.lastIndexOf(File.separator) + 1;266 String base = currentId.substring(ndx, currentId.lastIndexOf(" "));267 268 File f = new File(currentId).getAbsoluteFile();269 String file = f.exists() ? f.getParent() + File.separator : "";270 271 if (numSeries == 0) numSeries = 1;272 for (int i=0; i<getSizeC()*numSeries; i++) {273 files.add(file + base + " " + (i + 1) + ".xys");274 }275 files.add(currentId);276 306 277 307 MetadataStore store = makeFilterMetadata(); -
trunk/components/bio-formats/src/loci/formats/in/VisitechReader.java
r6301 r6553 107 107 while (s.read() != (byte) 0xf0); 108 108 s.skipBytes(1); 109 if (s.readInt() == 0) s.skipBytes(4 + ((plane + 164) * planeIndex)); 109 110 int paddingBytes = 111 (int) (s.length() - s.getFilePointer() - div * plane) / (div - 1); 112 113 if (s.readInt() == 0) { 114 s.skipBytes(4 + ((plane + paddingBytes) * planeIndex)); 115 } 110 116 else { 111 117 if (planeIndex == 0) s.seek(s.getFilePointer() - 4); 112 else s.skipBytes((plane + 164) * planeIndex - 4);118 else s.skipBytes((plane + paddingBytes) * planeIndex - 4); 113 119 } 114 120 … … 169 175 int numSeries = 0; 170 176 String[] tokens = s.split("\n"); 177 int estimatedSeriesCount = 0, estimatedSizeC = 0; 171 178 for (String token : tokens) { 172 179 token = token.trim(); … … 218 225 } 219 226 } 220 } 227 else if (token.indexOf("Document created") != -1) { 228 estimatedSeriesCount++; 229 estimatedSizeC++; 230 } 231 } 232 233 if (numSeries == 0) { 234 numSeries = estimatedSeriesCount; 235 core[0].sizeC *= estimatedSizeC; 236 } 237 if (getSizeC() == 0) core[0].sizeC = estimatedSizeC; 238 239 if (getSizeC() == 0) core[0].sizeC = 1; 240 if (getSizeZ() == 0) core[0].sizeZ = 1; 241 242 // find pixels files - we think there is one channel per file 243 244 files = new Vector<String>(); 245 246 int ndx = currentId.lastIndexOf(File.separator) + 1; 247 String base = currentId.substring(ndx, currentId.lastIndexOf(" ")); 248 249 File f = new File(currentId).getAbsoluteFile(); 250 String file = f.exists() ? f.getParent() + File.separator : ""; 251 252 if (numSeries == 0) numSeries = 1; 253 for (int i=0; i<getSizeC(); i++) { 254 String pixelsFile = file + base + " " + (i + 1) + ".xys"; 255 Location p = new Location(pixelsFile); 256 if (p.exists()) files.add(p.getAbsolutePath()); 257 else { 258 if (numSeries > 1) { 259 core[0].sizeC -= (getSizeC() / numSeries); 260 numSeries--; 261 } 262 else if (getSizeC() > 1) core[0].sizeC--; 263 } 264 } 265 files.add(currentId); 221 266 222 267 if (getSizeT() == 0) { … … 224 269 if (getSizeT() == 0) core[0].sizeT = 1; 225 270 } 271 226 272 if (getImageCount() == 0) { 227 273 core[0].imageCount = getSizeZ() * getSizeC() * getSizeT(); 228 274 } 229 230 275 if (numSeries > 1) { 231 276 int x = getSizeX(); … … 259 304 } 260 305 261 // find pixels files - we think there is one channel per file262 263 files = new Vector<String>();264 265 int ndx = currentId.lastIndexOf(File.separator) + 1;266 String base = currentId.substring(ndx, currentId.lastIndexOf(" "));267 268 File f = new File(currentId).getAbsoluteFile();269 String file = f.exists() ? f.getParent() + File.separator : "";270 271 if (numSeries == 0) numSeries = 1;272 for (int i=0; i<getSizeC()*numSeries; i++) {273 files.add(file + base + " " + (i + 1) + ".xys");274 }275 files.add(currentId);276 306 277 307 MetadataStore store = makeFilterMetadata();
Note: See TracChangeset
for help on using the changeset viewer.