we have a data analysis library that we have been building out over the last few years. In a previous version we were able to hand ITK a wrapped pointer to our data for ITK to process. In our new version this is not possible since the data may reside on local disk (Out-of-Core). Is there an “adapter” class in ITK that we can subclass to build a bridge between ITK and our data that would rely on our own iterator (or an STL compliant iterator) to pull data from our data array?
You could look at this discussion, e.g. consider FileFreeImageIO and MRMLIDImageIO to base your class on. MetaImage and HDF5 IOs have streaming support, so you could also look there for some inspiration.
Yes, the HDF5ImageIO class is based on the “StreamingImageIOBase” class and support reading arbitrary regions. I have not used it much.
What type of example are you looking for with streaming?
This most basic would be to use `ImageFileReader::SetRequestedRegion" method to only read part of the image.
Another would be to connect a ImageFileReader->ExtractImageFilter to extract an image.
Another would be some of the classes derived from the ImageSink class like LabelStatisticsImageFilter or MinimumMaximumImageFilter. These filter have a SetNumberOfStreamDivisions method to set the number of chunks to process the data in.
We have our own data handling classes that are roughly equivalent to ITKArray which have all the basic API of an “Array” class. The subclasses from that class will typically hold a “Storage” class. Currently the Storage class that we have implemented uses the typical C++ new/delete with some C++ unique pointer to ensure ownership.
This is currently how we get our own buffer over to ITK for processing:
We should maybe take a look at the StreamingImageIOBase class and see if we can derive something from that to form an “adapter” as a go between our DataArray class and an ItkImage.