Now you should get compile errors...
Fix them as indicated above, and detailed in the following.
To adapt an "old" ImgLoader:
Assume for example OldImageLoader
1.) copy OldImageLoader to LegacyOldImageLoader
2.) in LegacyOldImageLoader: change implements ImgLoader<...> to implements LegacyImgLoader<...>
3.) Let OldImageLoader extends LegacyImgLoaderWrapper.
For each public constructor, just call super( new LegacyOldImageLoader( ... constructor parameters ... )
Remove the rest of the code.
This satisfies all requirements of the ImgLoader interface. If you need to expose additional public API from your OldImageLoader, you can forward to the LegacyOldImageLoader which is available as member variable legacyImgLoader.
To adapt an "old" ViewerImgLoader:
For example CatmaidImageLoader
1.) copy CatmaidImageLoader to LegacyCatmaidImageLoader
2.) in LegacyCatmaidImageLoader:
2.1) change extends AbstractViewerImgLoader to extends AbstractLegacyViewerImgLoader:
import bdv.AbstractViewerImgLoader;
public class CatmaidImageLoader extends AbstractViewerImgLoader< ARGBType, VolatileARGBType >
import bdv.spimdata.legacy.AbstractLegacyViewerImgLoader;
public class LegacyCatmaidImageLoader extends AbstractLegacyViewerImgLoader< ARGBType, VolatileARGBType >
2.2) if you use VolatileGlobalCellCache in your ImgLoader:
VolatileGlobalCellCache no longer has generic parameters. The generic parameter moved to the per-image CellCache.
Also VolatileGlobalCellCache is no longer constructed with an CacheArrayLoader. This also moved to the per-image CellCache.
-> Remove generics from VolatileGlobalCellCache
-> Add generic parameter to per-image CellCache
-> remove CacheArrayLoader parameter fron VolatileGlobalCellCache constructor. Instead, store your CacheArrayLoader into a member variable and use it to construct per-image CellCache.
Here are all the lines that needed to be changed in LegacyCatmaidImageLoader:
private final VolatileGlobalCellCache< VolatileIntArray > cache;
...
cache = new VolatileGlobalCellCache< VolatileIntArray >(
new CatmaidVolatileIntArrayLoader( urlFormat, tileWidth, tileHeight, zScales ), 1, 1, numScales, 10 );
...
final CellCache< VolatileIntArray > c =
cache.new VolatileCellCache< VolatileIntArray >( view.getTimePointId(), view.getViewSetupId(), level, cacheHints, loader );
...
public VolatileGlobalCellCache< VolatileIntArray > getCache()
And here is what they changed to:
private final VolatileGlobalCellCache cache;
private final CatmaidVolatileIntArrayLoader loader;
...
cache = new VolatileGlobalCellCache( 1, 1, numScales, 10 );
loader = new CatmaidVolatileIntArrayLoader( urlFormat, tileWidth, tileHeight, zScales );
...
final CellCache< VolatileIntArray > c =
cache.new VolatileCellCache< VolatileIntArray >( view.getTimePointId(), view.getViewSetupId(), level, cacheHints, loader );
...
public VolatileGlobalCellCache getCache()
3.) Let CatmaidImageLoader extend LegacyViewerImgLoaderWrapper< ARGBType, VolatileARGBType, LegacyCatmaidImageLoader >
For each public constructor, just call super( new LegacyCatmaidImageLoader( ... constructor parameters ... )
Remove the rest of the code.
The full CatmaidImageLoader looks like this:
package bdv.img.catmaid;
import net.imglib2.type.numeric.ARGBType;
import net.imglib2.type.volatiles.VolatileARGBType;
import bdv.spimdata.legacy.LegacyViewerImgLoaderWrapper;
public class CatmaidImageLoader extends LegacyViewerImgLoaderWrapper< ARGBType, VolatileARGBType, LegacyCatmaidImageLoader >
{
public CatmaidImageLoader(
final long width,
final long height,
final long depth,
final double zScale,
final int numScales,
final String urlFormat,
final int tileWidth,
final int tileHeight )
{
super( new LegacyCatmaidImageLoader( width, height, depth, zScale, numScales, urlFormat, tileWidth, tileHeight ) );
}
}