Changeset 7375
- Timestamp:
- 12/09/10 13:15:35 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/bio-formats/src/loci/formats/in/OpenlabReader.java
r7055 r7375 108 108 109 109 private String gain, detectorOffset, xPos, yPos, zPos; 110 private boolean specialPlateNames = false; 110 111 111 112 // -- Constructor -- … … 142 143 lastPlane = no; 143 144 144 if (no >= planeOffsets[series].length) return buf; 145 int index = planeOffsets[series][no]; 146 147 long first = planes[index].planeOffset; 148 long last = no == planeOffsets[series].length - 1 || 149 planeOffsets[series][no + 1] >= planes.length ? in.length() : 150 planes[planeOffsets[series][no + 1]].planeOffset; 145 PlaneInfo planeInfo = null; 146 if (specialPlateNames) { 147 planeInfo = getPlane(getZCTCoords(no)); 148 } 149 else if (no < planeOffsets[series].length) { 150 int index = planeOffsets[series][no]; 151 planeInfo = planes[index]; 152 } 153 if (planeInfo == null) return buf; 154 155 long first = planeInfo.planeOffset; 156 long last = first + FormatTools.getPlaneSize(this) * 2; 151 157 in.seek(first); 152 158 153 159 int bpp = FormatTools.getBytesPerPixel(getPixelType()); 154 160 155 if (!plane s[index].pict) {161 if (!planeInfo.pict) { 156 162 if (version == 2) { 157 163 readPlane(in, x, y, w, h, buf); … … 188 194 b = null; 189 195 } 190 if (plane s[index].volumeType == MAC_256_GREYS ||191 plane s[index].volumeType == MAC_256_COLORS)196 if (planeInfo.volumeType == MAC_256_GREYS || 197 planeInfo.volumeType == MAC_256_COLORS) 192 198 { 193 199 for (int i=0; i<buf.length; i++) { … … 229 235 r.close(); 230 236 LOGGER.debug("", exc); 231 in.seek(plane s[index].planeOffset - 298);237 in.seek(planeInfo.planeOffset - 298); 232 238 233 239 if (in.readByte() == 1) in.skipBytes(128); … … 298 304 gain = detectorOffset = null; 299 305 xPos = yPos = zPos = null; 306 specialPlateNames = false; 300 307 } 301 308 } … … 684 691 core[s].dimensionOrder = "XY"; 685 692 for (PlaneInfo plane : planes) { 686 if (plane == null) continue; 687 if (plane.series == s) { 688 String name = plane.planeName; 693 if (plane == null || plane.series != s) continue; 694 695 String name = plane.planeName; 696 697 // check for a specific name format: 698 // <channel name><optional timepoint>_<plate>_<well>_<Z section> 699 700 String[] tokens = name.split("_"); 701 if (tokens.length == 4) { 702 specialPlateNames = true; 703 704 if (!uniqueZ.contains(tokens[3])) { 705 uniqueZ.add(tokens[3]); 706 } 707 plane.channelName = tokens[0]; 708 int endIndex = 0; 709 while (endIndex < plane.channelName.length() && 710 !Character.isDigit(plane.channelName.charAt(endIndex))) 711 { 712 endIndex++; 713 } 714 String timepoint = plane.channelName.substring(endIndex); 715 if (timepoint.equals("")) timepoint = "1"; 716 plane.channelName = plane.channelName.substring(0, endIndex); 717 718 if (!uniqueC.contains(plane.channelName)) { 719 uniqueC.add(plane.channelName); 720 } 721 if (!uniqueT.contains(timepoint)) { 722 uniqueT.add(timepoint); 723 } 724 725 core[s].dimensionOrder = "XYCTZ"; 726 plane.wavelength = uniqueC.indexOf(plane.channelName); 727 plane.timepoint = uniqueT.indexOf(timepoint); 728 plane.zPosition = uniqueZ.indexOf(tokens[3]); 729 } 730 else { 689 731 for (String axis : axes) { 690 732 Vector<String> unique = null; … … 717 759 } 718 760 761 if (specialPlateNames) { 762 core[s].sizeC *= uniqueC.size(); 763 core[s].sizeT = uniqueT.size(); 764 core[s].sizeZ = uniqueZ.size(); 765 core[s].imageCount = core[s].sizeC * core[s].sizeZ * core[s].sizeT; 766 return; 767 } 768 719 769 if (core[s].rgb && uniqueC.size() <= 1) { 720 770 core[s].dimensionOrder = core[s].dimensionOrder.replaceAll("C", ""); … … 750 800 } 751 801 802 private PlaneInfo getPlane(int[] zct) { 803 for (PlaneInfo plane : planes) { 804 if (plane != null && plane.zPosition == zct[0] && 805 plane.wavelength == zct[1] && plane.timepoint == zct[2] && 806 plane.series == getSeries()) 807 { 808 return plane; 809 } 810 } 811 return null; 812 } 813 752 814 // -- Helper classes -- 753 815 … … 757 819 protected int zPosition; 758 820 protected int wavelength; 821 protected int timepoint; 759 822 protected String planeName; 760 823 protected long timestamp; … … 765 828 protected int height; 766 829 protected int series = -1; 830 protected String channelName; 767 831 } 768 832
Note: See TracChangeset
for help on using the changeset viewer.