reusing the same ImageStack for files of different lengths

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

reusing the same ImageStack for files of different lengths

Rod Rinkus
My problem is to iterate through all (many thousands of) AVI files in a folder and, after doing some processing on each one, write it out as raw.  To avoid having Java's 'new' called for every file, I want to reuse the same ImageStack over and over again.  The AVI files have different lengths (numbers of frames) so I just create an ImageStack with more slices than the longest AVI file, e.g., 1000 slices.  So for instance if the AVI currently being processed has only 800 frames, then the last 200 slices are ignored.

The problem is that when I call FileSaver's saveAsRawStack( implus ) function, it gives a null ptr exception if the implus's  ImageStack has more slices than are used by the AVI file being processed.  

Ideally, I'd like to pass SaveAsRawStack() the number of slices to output.  But in lieu of that, is there some other way to do this?

-Rod