Create an ImageStack from an avi file with given path. @param path Directoy+filename of the avi file @param firstFrame Number of first frame to read (first frame of the file is 1) @param lastFrame Number of last frame to read or 0 for reading all, -1 for all but last... @param isVirtual Whet
(String path, int firstFrame, int lastFrame, boolean isVirtual, boolean convertToGray, boolean flipVertical)
| 412 | * For virtual stacks, not that I/O errors may also occur later, when reading the frames. |
| 413 | */ |
| 414 | public ImageStack makeStack (String path, int firstFrame, int lastFrame, |
| 415 | boolean isVirtual, boolean convertToGray, boolean flipVertical) { |
| 416 | this.firstFrame = firstFrame; |
| 417 | this.lastFrame = lastFrame; |
| 418 | this.isVirtual = isVirtual; |
| 419 | this.convertToGray = convertToGray; |
| 420 | this.flipVertical = flipVertical; |
| 421 | IJ.showProgress(.001); |
| 422 | try { |
| 423 | readAVI(path); |
| 424 | } catch (OutOfMemoryError e) { |
| 425 | stack.trim(); |
| 426 | errorText = "Out of memory. " + stack.size() + " of " + dwTotalFrames + " frames will be opened."; |
| 427 | } catch (Exception e) { |
| 428 | errorText = exceptionMessage(e); |
| 429 | if (isVirtual || stack==null || stack.size()==0) //return null only if we have really nothing |
| 430 | return null; |
| 431 | } finally { |
| 432 | closeFile(raFile); |
| 433 | if (verbose) |
| 434 | IJ.log("File closed."); |
| 435 | IJ.showProgress(1.0); |
| 436 | } |
| 437 | if (isVirtual && frameInfos != null) |
| 438 | stack = this; |
| 439 | if (stack!=null && cm!=null) |
| 440 | stack.setColorModel(cm); |
| 441 | return stack; |
| 442 | } |
| 443 | |
| 444 | /** Returns a description of the error reading the file with <code>makeStack</code> or null if no error */ |
| 445 | public String getErrorText() { |
no test coverage detected