Changeset 7093
- Timestamp:
- 10/19/10 21:23:28 (9 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.2/components/bio-formats/src/loci/formats/in/MetamorphReader.java
r7007 r7093 236 236 internalStamps = null; 237 237 zDistances = stageX = stageY = null; 238 canLookForND = true;239 238 firstSeriesChannels = null; 240 239 sizeX = sizeY = null; … … 261 260 String[] dirList = parent.list(true); 262 261 for (String f : dirList) { 263 if (f.indexOf(stkFile) != -1 && checkSuffix(f, STK_SUFFIX)) 262 int underscore = f.indexOf("_"); 263 if (underscore < 0) underscore = f.indexOf("."); 264 if (underscore < 0) underscore = f.length(); 265 String prefix = f.substring(0, underscore); 266 267 if ((f.indexOf(stkFile) != -1 || stkFile.startsWith(prefix)) && 268 checkSuffix(f, STK_SUFFIX)) 264 269 { 265 270 stkFile = new Location(parent.getAbsolutePath(), f).getAbsolutePath(); … … 284 289 // let's check the parent directory for an .nd file 285 290 Location stk = new Location(id).getAbsoluteFile(); 291 String stkName = stk.getName(); 292 String stkPrefix = stkName; 293 if (stkPrefix.indexOf("_") >= 0) { 294 stkPrefix = stkPrefix.substring(0, stkPrefix.indexOf("_")); 295 } 286 296 Location parent = stk.getParentFile(); 287 297 String[] list = parent.list(true); … … 289 299 if (checkSuffix(f, ND_SUFFIX)) { 290 300 String prefix = f.substring(0, f.lastIndexOf(".")); 291 if (stk .getName().startsWith(prefix)) {301 if (stkName.startsWith(prefix) || prefix.startsWith(stkPrefix)) { 292 302 ndfile = new Location(parent, f).getAbsoluteFile(); 293 303 break; … … 967 977 String name = l.getName(); 968 978 String parent = l.getParent(); 979 980 if (name.indexOf("_") > 0) { 981 String prefix = name.substring(0, name.indexOf("_")); 982 String suffix = name.substring(name.indexOf("_")); 983 984 String basePrefix = new Location(currentId).getName(); 985 int end = basePrefix.indexOf("_"); 986 if (end < 0) end = basePrefix.indexOf("."); 987 basePrefix = basePrefix.substring(0, end); 988 989 if (!basePrefix.equals(prefix)) { 990 name = basePrefix + suffix; 991 Location p = new Location(parent, name); 992 if (p.exists()) return p.getAbsolutePath(); 993 } 994 } 969 995 970 996 // '%' can be converted to '-' -
trunk/components/bio-formats/src/loci/formats/in/MetamorphReader.java
r7055 r7093 236 236 internalStamps = null; 237 237 zDistances = stageX = stageY = null; 238 canLookForND = true;239 238 firstSeriesChannels = null; 240 239 sizeX = sizeY = null; … … 261 260 String[] dirList = parent.list(true); 262 261 for (String f : dirList) { 263 if (f.indexOf(stkFile) != -1 && checkSuffix(f, STK_SUFFIX)) 262 int underscore = f.indexOf("_"); 263 if (underscore < 0) underscore = f.indexOf("."); 264 if (underscore < 0) underscore = f.length(); 265 String prefix = f.substring(0, underscore); 266 267 if ((f.indexOf(stkFile) != -1 || stkFile.startsWith(prefix)) && 268 checkSuffix(f, STK_SUFFIX)) 264 269 { 265 270 stkFile = new Location(parent.getAbsolutePath(), f).getAbsolutePath(); … … 284 289 // let's check the parent directory for an .nd file 285 290 Location stk = new Location(id).getAbsoluteFile(); 291 String stkName = stk.getName(); 292 String stkPrefix = stkName; 293 if (stkPrefix.indexOf("_") >= 0) { 294 stkPrefix = stkPrefix.substring(0, stkPrefix.indexOf("_")); 295 } 286 296 Location parent = stk.getParentFile(); 287 297 String[] list = parent.list(true); … … 289 299 if (checkSuffix(f, ND_SUFFIX)) { 290 300 String prefix = f.substring(0, f.lastIndexOf(".")); 291 if (stk .getName().startsWith(prefix)) {301 if (stkName.startsWith(prefix) || prefix.startsWith(stkPrefix)) { 292 302 ndfile = new Location(parent, f).getAbsoluteFile(); 293 303 break; … … 967 977 String name = l.getName(); 968 978 String parent = l.getParent(); 979 980 if (name.indexOf("_") > 0) { 981 String prefix = name.substring(0, name.indexOf("_")); 982 String suffix = name.substring(name.indexOf("_")); 983 984 String basePrefix = new Location(currentId).getName(); 985 int end = basePrefix.indexOf("_"); 986 if (end < 0) end = basePrefix.indexOf("."); 987 basePrefix = basePrefix.substring(0, end); 988 989 if (!basePrefix.equals(prefix)) { 990 name = basePrefix + suffix; 991 Location p = new Location(parent, name); 992 if (p.exists()) return p.getAbsolutePath(); 993 } 994 } 969 995 970 996 // '%' can be converted to '-'
Note: See TracChangeset
for help on using the changeset viewer.