imglib / imglib2-ij

Translation between ImgLib & ImageJ data structures (both 1.x and 2)
Other
4 stars 8 forks source link

Persist changes to virtual stacks #5

Closed hinerm closed 9 years ago

hinerm commented 9 years ago

This allows virtual stacks to work with read/write caches.

hinerm commented 9 years ago

@tpietzsch two things here:

1) there is probably a better way to do the iteration than restricting to RealType..? 2) Copying the full virtual array is dumb. It would be better to just pass the backing array of the source to the projector so it's always being used by ref. But the ramifications/best methods to do so weren't immediately clear to me, since you can't assume the source is an ArrayImg

hinerm commented 9 years ago

@tpietzsch I started https://github.com/imglib/imglib2-ij/commit/08b8d16a011ca882b6d8229b18bdb2cf4d3c64f3 to give the writing a chance to avoid copying data. To get it working we would need a way to unwrap the view to find the underlying NativeImg... I'm assuming that would not be legitimate if given an IntervalView though? So, it may not be worth it.. I'm not sure..

hinerm commented 9 years ago

OK @tpietzsch , because it wasn't obvious I split out the copy reduction logic to its own branch. I vote for merging this as-is and dealing with its performance later as needed, as I'm moving on to other tasks for this hackathon.

hinerm commented 9 years ago

@tpietzsch By adding API to control whether or not setPixels functions or not, this PR no longer forced all ImageJVirtualStacks to be writable, so I went ahead and merged it.

Hopefully we have the best of both worlds now!