I need to save and re-load thousands of ROI polygons on a stack of images, actually a 30-frame-per second movie for 30+ minutes, so at least 54,000 frames. There can be multiple ROIs on a single image (frame) in the stack, and the size and number of vertices for each ROI is different. The ROI polygons are tracking the edges of shapes as they change over time.
The movie stack is usually too big to hold in memory at once. I post-process it, churning through it frame by frame to track my shapes. I can save the ROI objects to binary files one frame at a time, but that generates 54,000+ files to keep together. Alternatively, if I try to allocate a container object to hold all 54,000+ ROI frames and then save that to one file, I quickly run out of resources.
I’d like to save all the ROIs to one file that I can randomly access and modify. If I want the third ROI polygon on frame 100, I want to be able to load it immediately. I also want to be able to insert and delete ROIs into the saved file.
What’s the best file format for doing this? Is there an accepted format or application? ImageJ has a native ROI format, but I don’t know much about it. My application is programmed in IDL right now. IDL has its own ROI class, but like I said, I’d rather not write them all out to separate files, and I don’t have the resources to combine them all in one file. XML? Thanks.