diff --git a/src/main/java/bdv/AbstractSpimSource.java b/src/main/java/bdv/AbstractSpimSource.java index 94b2af70d4671818f0711671d8695fa3f1f17057..ba8e1b93ed17032580371c1c890e55774753434e 100644 --- a/src/main/java/bdv/AbstractSpimSource.java +++ b/src/main/java/bdv/AbstractSpimSource.java @@ -28,8 +28,6 @@ public abstract class AbstractSpimSource< T extends NumericType< T > > implement protected final SequenceViewsLoader sequenceViews; - protected final ViewerImgLoader imgLoader; - protected final int numTimepoints; protected final int numMipmapLevels; @@ -49,9 +47,8 @@ public abstract class AbstractSpimSource< T extends NumericType< T > > implement this.name = name; this.sequenceViews = loader; final SequenceDescription seq = loader.getSequenceDescription(); - imgLoader = ( ViewerImgLoader ) seq.imgLoader; numTimepoints = seq.numTimepoints(); - numMipmapLevels = imgLoader.numMipmapLevels( setup ); + numMipmapLevels = ( ( ViewerImgLoader< ?, ? > ) seq.imgLoader ).numMipmapLevels( setup ); currentSources = new RandomAccessibleInterval[ numMipmapLevels ]; currentInterpolatedSources = new RealRandomAccessible[ numMipmapLevels ][ numInterpolationMethods ]; currentSourceTransforms = new AffineTransform3D[ numMipmapLevels ]; @@ -60,7 +57,6 @@ public abstract class AbstractSpimSource< T extends NumericType< T > > implement interpolatorFactories = new InterpolatorFactory[ numInterpolationMethods ]; interpolatorFactories[ iNearestNeighborMethod ] = new NearestNeighborInterpolatorFactory< T >(); interpolatorFactories[ iNLinearMethod ] = new NLinearInterpolatorFactory< T >(); - loadTimepoint( 0 ); } protected abstract void loadTimepoint( final int timepoint ); diff --git a/src/main/java/bdv/BigDataViewer.java b/src/main/java/bdv/BigDataViewer.java index 026c838cac2c9a907e2380396fe818ca48cb83bb..68ccc0dd00c5528e086c6562be43dfff4a55be32 100644 --- a/src/main/java/bdv/BigDataViewer.java +++ b/src/main/java/bdv/BigDataViewer.java @@ -13,10 +13,12 @@ import javax.swing.JMenuItem; import javax.swing.filechooser.FileFilter; import mpicbg.spim.data.SequenceDescription; +import net.imglib2.Volatile; +import net.imglib2.converter.TypeIdentity; import net.imglib2.display.RealARGBColorConverter; import net.imglib2.type.numeric.ARGBType; -import net.imglib2.type.numeric.integer.UnsignedShortType; -import net.imglib2.type.volatiles.VolatileUnsignedShortType; +import net.imglib2.type.numeric.NumericType; +import net.imglib2.type.numeric.RealType; import org.jdom2.Document; import org.jdom2.Element; @@ -78,35 +80,88 @@ public class BigDataViewer manualTransformationEditor.toggle(); } - private BigDataViewer( final String xmlFilename, final ProgressWriter progressWriter ) throws InstantiationException, IllegalAccessException, ClassNotFoundException, JDOMException, IOException + private static < T extends RealType< T >, V extends Volatile< T > & RealType< V > > void initSetupsRealType( + final SequenceViewsLoader loader, + final T type, + final ArrayList< ConverterSetup > converterSetups, + final ArrayList< SourceAndConverter< ? > > sources ) { - final int width = 800; - final int height = 600; - - final SequenceViewsLoader loader = new SequenceViewsLoader( xmlFilename ); + final double typeMin = type.getMinValue(); + final double typeMax = type.getMaxValue(); final SequenceDescription seq = loader.getSequenceDescription(); - - final ArrayList< ConverterSetup > converterSetups = new ArrayList< ConverterSetup >(); - final ArrayList< SourceAndConverter< ? > > sources = new ArrayList< SourceAndConverter< ? > >(); for ( int setup = 0; setup < seq.numViewSetups(); ++setup ) { - final RealARGBColorConverter< VolatileUnsignedShortType > vconverter = new RealARGBColorConverter< VolatileUnsignedShortType >( 0, 65535 ); - vconverter.setColor( new ARGBType( ARGBType.rgba( 255, 255, 255, 255 ) ) ); - final RealARGBColorConverter< UnsignedShortType > converter = new RealARGBColorConverter< UnsignedShortType >( 0, 65535 ); - converter.setColor( new ARGBType( ARGBType.rgba( 255, 255, 255, 255 ) ) ); - final VolatileSpimSource vs = new VolatileSpimSource( loader, setup, "angle " + seq.setups.get( setup ).getAngle() ); - final SpimSource s = vs.nonVolatile(); + final RealARGBColorConverter< V > vconverter = new RealARGBColorConverter< V >( typeMin, typeMax ); + vconverter.setColor( new ARGBType( 0xffffffff ) ); + final RealARGBColorConverter< T > converter = new RealARGBColorConverter< T >( typeMin, typeMax ); + converter.setColor( new ARGBType( 0xffffffff ) ); + + final VolatileSpimSource< T, V > vs = new VolatileSpimSource< T, V >( loader, setup, "angle " + seq.setups.get( setup ).getAngle() ); + final SpimSource< T > s = vs.nonVolatile(); // Decorate each source with an extra transformation, that can be edited manually in this viewer. - final TransformedSource< VolatileUnsignedShortType > tvs = new TransformedSource< VolatileUnsignedShortType >( vs ); - final TransformedSource< UnsignedShortType > ts = new TransformedSource< UnsignedShortType >( s, tvs ); + final TransformedSource< V > tvs = new TransformedSource< V >( vs ); + final TransformedSource< T > ts = new TransformedSource< T >( s, tvs ); - final SourceAndConverter< VolatileUnsignedShortType > vsoc = new SourceAndConverter< VolatileUnsignedShortType >( tvs, vconverter ); - final SourceAndConverter< UnsignedShortType > soc = new SourceAndConverter< UnsignedShortType >( ts, converter, vsoc ); + final SourceAndConverter< V > vsoc = new SourceAndConverter< V >( tvs, vconverter ); + final SourceAndConverter< T > soc = new SourceAndConverter< T >( ts, converter, vsoc ); sources.add( soc ); converterSetups.add( new RealARGBColorConverterSetup( setup, converter, vconverter ) ); } + } + + private static void initSetupsARGBType( + final SequenceViewsLoader loader, + final ARGBType type, + final ArrayList< ConverterSetup > converterSetups, + final ArrayList< SourceAndConverter< ? > > sources ) + { + final SequenceDescription seq = loader.getSequenceDescription(); + for ( int setup = 0; setup < seq.numViewSetups(); ++setup ) + { + final TypeIdentity< ARGBType > vconverter = new TypeIdentity< ARGBType >(); + final TypeIdentity< ARGBType > converter = new TypeIdentity< ARGBType >(); + +// final VolatileSpimSource< ARGBType, VolatileARGBType > vs = new VolatileSpimSource< ARGBType, VolatileARGBType >( loader, setup, "angle " + seq.setups.get( setup ).getAngle() ); +// final SpimSource< ARGBType > s = vs.nonVolatile(); +// +// // Decorate each source with an extra transformation, that can be edited manually in this viewer. +// final TransformedSource< VolatileARGBType > tvs = new TransformedSource< VolatileARGBType >( vs ); +// final TransformedSource< ARGBType > ts = new TransformedSource< ARGBType >( s, tvs ); +// +// final SourceAndConverter< VolatileARGBType > vsoc = new SourceAndConverter< VolatileARGBType >( tvs, vconverter ); +// final SourceAndConverter< ARGBType > soc = new SourceAndConverter< ARGBType >( ts, converter, vsoc ); +// +// sources.add( soc ); + } + } + + @SuppressWarnings( { "unchecked", "rawtypes" } ) + private static < T extends NumericType< T >, V extends Volatile< T > & NumericType< V > > void initSetups( + final SequenceViewsLoader loader, + final ArrayList< ConverterSetup > converterSetups, + final ArrayList< SourceAndConverter< ? > > sources ) + { + final T type = ( ( ViewerImgLoader< T, V > ) loader.getSequenceDescription().imgLoader ).getImageType(); + if ( RealType.class.isInstance( type ) ) + initSetupsRealType( loader, ( RealType ) type, converterSetups, sources ); + else if ( ARGBType.class.isInstance( type ) ) + initSetupsARGBType( loader, ( ARGBType ) type, converterSetups, sources ); + else throw new IllegalArgumentException( "ImgLoader of type " + type.getClass() + " not supported." ); + } + + private BigDataViewer( final String xmlFilename, final ProgressWriter progressWriter ) throws InstantiationException, IllegalAccessException, ClassNotFoundException, JDOMException, IOException + { + final int width = 800; + final int height = 600; + + final SequenceViewsLoader loader = new SequenceViewsLoader( xmlFilename ); + final SequenceDescription seq = loader.getSequenceDescription(); + + final ArrayList< ConverterSetup > converterSetups = new ArrayList< ConverterSetup >(); + final ArrayList< SourceAndConverter< ? > > sources = new ArrayList< SourceAndConverter< ? > >(); + initSetups( loader, converterSetups, sources ); viewerFrame = new ViewerFrame( width, height, sources, seq.numTimepoints(), ( ( CatmaidImageLoader ) seq.imgLoader ).getCache() ); diff --git a/src/main/java/bdv/SpimSource.java b/src/main/java/bdv/SpimSource.java index 81925a62cbcfc95b4293087ee308e0646969161b..f5c8e6c89b8c1d1511367f7cdb9428cb0f90d89b 100644 --- a/src/main/java/bdv/SpimSource.java +++ b/src/main/java/bdv/SpimSource.java @@ -1,16 +1,22 @@ package bdv; +import mpicbg.spim.data.SequenceDescription; import mpicbg.spim.data.View; import net.imglib2.realtransform.AffineTransform3D; -import net.imglib2.type.numeric.integer.UnsignedShortType; -import net.imglib2.type.volatiles.VolatileUnsignedShortType; +import net.imglib2.type.numeric.NumericType; import net.imglib2.view.Views; -public class SpimSource extends AbstractSpimSource< UnsignedShortType > +public class SpimSource< T extends NumericType< T > > extends AbstractSpimSource< T > { + protected final ViewerImgLoader< T, ? > imgLoader; + + @SuppressWarnings( "unchecked" ) public SpimSource( final SequenceViewsLoader loader, final int setup, final String name ) { super( loader, setup, name ); + final SequenceDescription seq = loader.getSequenceDescription(); + imgLoader = ( ViewerImgLoader< T, ? > ) seq.imgLoader; + loadTimepoint( 0 ); } @Override @@ -19,7 +25,8 @@ public class SpimSource extends AbstractSpimSource< UnsignedShortType > currentTimepoint = timepoint; if ( isPresent( timepoint ) ) { - final UnsignedShortType zero = new VolatileUnsignedShortType( 0 ).get(); + final T zero = imgLoader.getImageType().createVariable(); + zero.setZero(); final View view = sequenceViews.getView( timepoint, setup ); final AffineTransform3D reg = view.getModel(); final AffineTransform3D mipmapTransform = new AffineTransform3D(); @@ -33,7 +40,7 @@ public class SpimSource extends AbstractSpimSource< UnsignedShortType > } currentSourceTransforms[ level ].set( reg ); currentSourceTransforms[ level ].concatenate( mipmapTransform ); - currentSources[ level ] = imgLoader.getUnsignedShortImage( view, level ); + currentSources[ level ] = imgLoader.getImage( view, level ); for ( int method = 0; method < numInterpolationMethods; ++method ) currentInterpolatedSources[ level ][ method ] = Views.interpolate( Views.extendValue( currentSources[ level ], zero ), interpolatorFactories[ method ] ); } @@ -51,8 +58,8 @@ public class SpimSource extends AbstractSpimSource< UnsignedShortType > } @Override - public UnsignedShortType getType() + public T getType() { - return new UnsignedShortType(); + return imgLoader.getImageType(); } } diff --git a/src/main/java/bdv/ViewerImgLoader.java b/src/main/java/bdv/ViewerImgLoader.java index 2355e3084b8a9544e2c193aeed3d2d9807f73a26..61634d081d28c38d0804f1f79df40875fba84537 100644 --- a/src/main/java/bdv/ViewerImgLoader.java +++ b/src/main/java/bdv/ViewerImgLoader.java @@ -3,14 +3,17 @@ package bdv; import mpicbg.spim.data.ImgLoader; import mpicbg.spim.data.View; import net.imglib2.RandomAccessibleInterval; -import net.imglib2.type.numeric.integer.UnsignedShortType; -import net.imglib2.type.volatiles.VolatileUnsignedShortType; +import net.imglib2.Volatile; -public interface ViewerImgLoader extends ImgLoader +public interface ViewerImgLoader< T, V extends Volatile< T > > extends ImgLoader< T > { - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view, final int level ); + public RandomAccessibleInterval< T > getImage( final View view, final int level ); - public RandomAccessibleInterval< VolatileUnsignedShortType > getVolatileUnsignedShortImage( final View view, final int level ); + public T getImageType(); + + public RandomAccessibleInterval< V > getVolatileImage( final View view, final int level ); + + public V getVolatileImageType(); public double[][] getMipmapResolutions( final int setup ); diff --git a/src/main/java/bdv/VolatileSpimSource.java b/src/main/java/bdv/VolatileSpimSource.java index 86d265891fd497a5fae65216eda380f554790bd7..7146faa469538e14443c057bd60f1e11bc153e11 100644 --- a/src/main/java/bdv/VolatileSpimSource.java +++ b/src/main/java/bdv/VolatileSpimSource.java @@ -1,18 +1,27 @@ package bdv; +import mpicbg.spim.data.SequenceDescription; import mpicbg.spim.data.View; +import net.imglib2.Volatile; import net.imglib2.realtransform.AffineTransform3D; -import net.imglib2.type.volatiles.VolatileUnsignedShortType; +import net.imglib2.type.numeric.NumericType; +import net.imglib2.type.numeric.RealType; import net.imglib2.view.Views; -public class VolatileSpimSource extends AbstractSpimSource< VolatileUnsignedShortType > +public class VolatileSpimSource< T extends NumericType< T >, V extends Volatile< T > & NumericType< V > > extends AbstractSpimSource< V > { - protected final SpimSource nonVolatileSource; + protected final SpimSource< T > nonVolatileSource; + protected final ViewerImgLoader< ?, V > imgLoader; + + @SuppressWarnings( "unchecked" ) public VolatileSpimSource( final SequenceViewsLoader loader, final int setup, final String name ) { super( loader, setup, name ); - nonVolatileSource = new SpimSource( loader, setup, name ); + nonVolatileSource = new SpimSource< T >( loader, setup, name ); + final SequenceDescription seq = loader.getSequenceDescription(); + imgLoader = ( ViewerImgLoader< ?, V > ) seq.imgLoader; + loadTimepoint( 0 ); } @Override @@ -21,7 +30,9 @@ public class VolatileSpimSource extends AbstractSpimSource< VolatileUnsignedShor currentTimepoint = timepoint; if ( isPresent( timepoint ) ) { - final VolatileUnsignedShortType zero = new VolatileUnsignedShortType( 128 ); + final V zero = imgLoader.getVolatileImageType().createVariable(); + // TODO: change to zero.setZero(); the following is just for debugging + ( ( RealType< ? > ) zero ).setReal( 128 ); final View view = sequenceViews.getView( timepoint, setup ); final AffineTransform3D reg = view.getModel(); final AffineTransform3D mipmapTransform = new AffineTransform3D(); @@ -35,7 +46,7 @@ public class VolatileSpimSource extends AbstractSpimSource< VolatileUnsignedShor } currentSourceTransforms[ level ].set( reg ); currentSourceTransforms[ level ].concatenate( mipmapTransform ); - currentSources[ level ] = imgLoader.getVolatileUnsignedShortImage( view, level ); + currentSources[ level ] = imgLoader.getVolatileImage( view, level ); for ( int method = 0; method < numInterpolationMethods; ++method ) currentInterpolatedSources[ level ][ method ] = Views.interpolate( Views.extendValue( currentSources[ level ], zero ), interpolatorFactories[ method ] ); } @@ -53,12 +64,12 @@ public class VolatileSpimSource extends AbstractSpimSource< VolatileUnsignedShor } @Override - public VolatileUnsignedShortType getType() + public V getType() { - return new VolatileUnsignedShortType(); + return imgLoader.getVolatileImageType(); } - public SpimSource nonVolatile() + public SpimSource< T > nonVolatile() { return nonVolatileSource; } diff --git a/src/main/java/bdv/export/WriteSequenceToHdf5.java b/src/main/java/bdv/export/WriteSequenceToHdf5.java index 6a9f2aaf6b4df2e804a64f0a70a0ef4e96b1065f..ffe67f628a3a3019d0ab86f247572fc9855a69d0 100644 --- a/src/main/java/bdv/export/WriteSequenceToHdf5.java +++ b/src/main/java/bdv/export/WriteSequenceToHdf5.java @@ -165,7 +165,8 @@ public class WriteSequenceToHdf5 final int setupOffsetSeq = partition.getSetupOffset() + partition.getSetupStart(); final int setupOffsetFile = partition.getSetupStart(); final int numSetups = partition.getSetupLength(); - final ImgLoader imgLoader = seq.imgLoader; + @SuppressWarnings( "unchecked" ) + final ImgLoader< UnsignedShortType > imgLoader = ( ImgLoader< UnsignedShortType > ) seq.imgLoader; // for progressWriter // initial 1 is for writing resolutions etc. @@ -231,7 +232,7 @@ public class WriteSequenceToHdf5 progressWriter.out().printf( "proccessing setup %d / %d\n", setup + 1, numSetups ); final View view = new View( seq, timepointSeq, setupSeq, null ); progressWriter.out().println( "loading image" ); - final RandomAccessibleInterval< UnsignedShortType > img = imgLoader.getUnsignedShortImage( view ); + final RandomAccessibleInterval< UnsignedShortType > img = imgLoader.getImage( view ); progressWriter.setProgress( ( double ) numCompletedTasks++ / numTasks ); for ( int level = 0; level < numLevels; ++level ) diff --git a/src/main/java/bdv/ij/ExportImagePlusPlugIn.java b/src/main/java/bdv/ij/ExportImagePlusPlugIn.java index 7667480d09231b42ef47ba1c8ff958e74b348d06..3773eaee37afbb7f9cc7cf5526197ced7b7dac60 100644 --- a/src/main/java/bdv/ij/ExportImagePlusPlugIn.java +++ b/src/main/java/bdv/ij/ExportImagePlusPlugIn.java @@ -21,6 +21,7 @@ import mpicbg.spim.data.ViewRegistration; import mpicbg.spim.data.ViewRegistrations; import mpicbg.spim.data.ViewSetup; import net.imglib2.realtransform.AffineTransform3D; +import net.imglib2.type.numeric.integer.UnsignedShortType; import bdv.export.ProgressWriter; import bdv.export.SubTaskProgressWriter; import bdv.export.WriteSequenceToHdf5; @@ -78,7 +79,7 @@ public class ExportImagePlusPlugIn implements PlugIn return; // create ImgLoader wrapping the image - final ImgLoader imgLoader; + final ImgLoader< UnsignedShortType > imgLoader; switch ( imp.getType() ) { case ImagePlus.GRAY8: diff --git a/src/main/java/bdv/ij/ImportPlugIn.java b/src/main/java/bdv/ij/ImportPlugIn.java index 9b8dd8c8d8a69e73ae2d191e9d20727b09961c27..cb76a1c65f444f5efad1e227057b74a35e4960dc 100644 --- a/src/main/java/bdv/ij/ImportPlugIn.java +++ b/src/main/java/bdv/ij/ImportPlugIn.java @@ -15,6 +15,7 @@ import java.awt.event.TextEvent; import java.io.File; import java.io.IOException; +import mpicbg.spim.data.ImgLoader; import mpicbg.spim.data.SequenceDescription; import mpicbg.spim.data.View; import net.imglib2.RandomAccessibleInterval; @@ -134,7 +135,9 @@ public class ImportPlugIn implements PlugIn final int numSetups = seq.numViewSetups(); timepoint = Math.max( Math.min( timepoint, numTimepoints - 1 ), 0 ); setup = Math.max( Math.min( setup, numSetups - 1 ), 0 ); - final RandomAccessibleInterval< UnsignedShortType > img = seq.imgLoader.getUnsignedShortImage( new View( seq, timepoint, setup, null ) ); + @SuppressWarnings( "unchecked" ) + final ImgLoader< UnsignedShortType > il = ( ImgLoader< UnsignedShortType > ) seq.imgLoader; + final RandomAccessibleInterval< UnsignedShortType > img = il.getImage( new View( seq, timepoint, setup, null ) ); final ImagePlus imp = net.imglib2.img.display.imagej.ImageJFunctions.wrap( img, "" ).duplicate(); imp.setTitle( new File( xmlFile ).getName() + " " + timepoint + " " + setup ); imp.show(); diff --git a/src/main/java/bdv/ij/export/FusionResult.java b/src/main/java/bdv/ij/export/FusionResult.java index 8e5556416286272025cca765795b6914a544eeea..7a91803605ec03260d3b56ee7a53800b99957e90 100644 --- a/src/main/java/bdv/ij/export/FusionResult.java +++ b/src/main/java/bdv/ij/export/FusionResult.java @@ -4,14 +4,15 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import bdv.ij.export.imgloader.FusionImageLoader; import mpicbg.spim.data.ImgLoader; import mpicbg.spim.data.SequenceDescription; import mpicbg.spim.data.ViewRegistration; import mpicbg.spim.data.ViewRegistrations; import mpicbg.spim.data.ViewSetup; import net.imglib2.realtransform.AffineTransform3D; +import net.imglib2.type.numeric.integer.UnsignedShortType; import net.imglib2.type.numeric.real.FloatType; +import bdv.ij.export.imgloader.FusionImageLoader; public class FusionResult { @@ -32,7 +33,7 @@ public class FusionResult public FusionResult( final String filepath, final String filepattern, final List< Integer > timepoints, final int referenceTimePoint, final int numSlices, final double sliceValueMin, final double sliceValueMax, final List< AffineTransform3D > fusionTransforms ) { - final ImgLoader fusionLoader = new FusionImageLoader< FloatType >( filepath +"/" + filepattern, numSlices, new FusionImageLoader.Gray32ImagePlusLoader(), sliceValueMin, sliceValueMax ); + final ImgLoader< UnsignedShortType > fusionLoader = new FusionImageLoader< FloatType >( filepath +"/" + filepattern, numSlices, new FusionImageLoader.Gray32ImagePlusLoader(), sliceValueMin, sliceValueMax ); desc = new SequenceDescription( Arrays.asList( new ViewSetup( 0, 0, 0, 0, 0, 0, numSlices, 1, 1, 1 ) ), timepoints, null, fusionLoader ); final ArrayList< ViewRegistration > registrations = new ArrayList< ViewRegistration >(); for ( int timepoint = 0; timepoint < timepoints.size(); ++timepoint ) @@ -42,7 +43,7 @@ public class FusionResult public FusionResult( final String filepath, final String filepattern, final List< Integer > channels, final List< Integer > timepoints, final int referenceTimePoint, final int numSlices, final double sliceValueMin, final double sliceValueMax, final List< AffineTransform3D > fusionTransforms ) { - final ImgLoader fusionLoader = new FusionImageLoader< FloatType >( filepath +"/" + filepattern, numSlices, new FusionImageLoader.Gray32ImagePlusLoader(), sliceValueMin, sliceValueMax ); + final ImgLoader< UnsignedShortType > fusionLoader = new FusionImageLoader< FloatType >( filepath +"/" + filepattern, numSlices, new FusionImageLoader.Gray32ImagePlusLoader(), sliceValueMin, sliceValueMax ); final ArrayList< ViewSetup > setups = new ArrayList< ViewSetup >(); for ( int id = 0; id < channels.size(); ++id ) setups.add( new ViewSetup( id, 0, 0, channels.get( id ), 0, 0, numSlices, 1, 1, 1 ) ); diff --git a/src/main/java/bdv/ij/export/SetupAggregator.java b/src/main/java/bdv/ij/export/SetupAggregator.java index 23d750abea9d4b04b34cc28fbd35361f9ab489de..e0f40383772231946c937d285ad710c121847451 100644 --- a/src/main/java/bdv/ij/export/SetupAggregator.java +++ b/src/main/java/bdv/ij/export/SetupAggregator.java @@ -54,7 +54,7 @@ public class SetupAggregator /** * An {@link ImgLoader} that forwards to wrapped source sequences. */ - protected final ImgLoader imgLoader; + protected final ImgLoader< UnsignedShortType > imgLoader; /** * Create an empty aggregator. @@ -67,7 +67,7 @@ public class SetupAggregator setups = new ArrayList< ViewSetupWrapper >(); perSetupResolutions = new ArrayList< int[][] >(); perSetupSubdivisions = new ArrayList< int[][] >(); - imgLoader = new ImgLoader() + imgLoader = new ImgLoader< UnsignedShortType >() { @Override public void init( final Element elem, final File basePath ) @@ -82,16 +82,18 @@ public class SetupAggregator } @Override - public RandomAccessibleInterval< FloatType > getImage( final View view ) + public RandomAccessibleInterval< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "not implemented" ); } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view ) { final ViewSetupWrapper w = ( ViewSetupWrapper ) view.getSetup(); - return w.getSourceSequence().imgLoader.getUnsignedShortImage( new View( w.getSourceSequence(), view.getTimepointIndex(), w.getSourceSetupIndex(), view.getModel() ) ); + @SuppressWarnings( "unchecked" ) + final ImgLoader< UnsignedShortType > il = ( ImgLoader< UnsignedShortType > ) w.getSourceSequence().imgLoader; + return il.getImage( new View( w.getSourceSequence(), view.getTimepointIndex(), w.getSourceSetupIndex(), view.getModel() ) ); } }; } diff --git a/src/main/java/bdv/ij/export/SpimRegistrationSequence.java b/src/main/java/bdv/ij/export/SpimRegistrationSequence.java index 80b1c9ad2f0acfd0a5bada9c92b0ab8798a6455a..cd98eba5a8a13bb71c01c59c3144b4bd34e9ef5f 100644 --- a/src/main/java/bdv/ij/export/SpimRegistrationSequence.java +++ b/src/main/java/bdv/ij/export/SpimRegistrationSequence.java @@ -8,8 +8,6 @@ import java.util.List; import javax.vecmath.Point3f; -import bdv.ij.export.imgloader.HuiskenImageLoader; -import bdv.ij.export.imgloader.StackImageLoader; import mpicbg.spim.data.ImgLoader; import mpicbg.spim.data.SequenceDescription; import mpicbg.spim.data.ViewRegistration; @@ -24,7 +22,10 @@ import mpicbg.spim.registration.bead.BeadRegistration; import net.imglib2.FinalRealInterval; import net.imglib2.RealInterval; import net.imglib2.realtransform.AffineTransform3D; +import net.imglib2.type.numeric.integer.UnsignedShortType; import spimopener.SPIMExperiment; +import bdv.ij.export.imgloader.HuiskenImageLoader; +import bdv.ij.export.imgloader.StackImageLoader; public class SpimRegistrationSequence { @@ -38,7 +39,7 @@ public class SpimRegistrationSequence { this.conf = conf; final ArrayList< ViewSetup > setups = createViewSetups( conf ); - final ImgLoader imgLoader = createImageLoader( conf, setups ); + final ImgLoader< UnsignedShortType > imgLoader = createImageLoader( conf, setups ); viewRegistrations = createViewRegistrations( conf, setups ); sequenceDescription = new SequenceDescription( setups, makeList( conf.timepoints ), new File( conf.inputdirectory ), imgLoader ); @@ -64,7 +65,7 @@ public class SpimRegistrationSequence return viewRegistrations; } - protected static ImgLoader createImageLoader( final SPIMConfiguration conf, final ArrayList< ViewSetup > setups ) + protected static ImgLoader< UnsignedShortType > createImageLoader( final SPIMConfiguration conf, final ArrayList< ViewSetup > setups ) { final int numTimepoints = conf.timepoints.length; final int numSetups = setups.size(); diff --git a/src/main/java/bdv/ij/export/imgloader/FusionImageLoader.java b/src/main/java/bdv/ij/export/imgloader/FusionImageLoader.java index 0b082b7cb11b493bb1a4e8c18819004164d2873b..74ed2c5a1fe81898bbdc56a028e8c5b7348390a6 100644 --- a/src/main/java/bdv/ij/export/imgloader/FusionImageLoader.java +++ b/src/main/java/bdv/ij/export/imgloader/FusionImageLoader.java @@ -35,12 +35,12 @@ import org.jdom2.Element; * template to get the slice filenames. * * This {@link ImgLoader} is used for exporting spim sequences to hdf5. Only the - * {@link #getUnsignedShortImage(View)} method is implemented because this is + * {@link #getImage(View)} method is implemented because this is * the only method required for exporting to hdf5. * * @author Tobias Pietzsch <tobias.pietzsch@gmail.com> */ -public class FusionImageLoader< T extends RealType< T > > implements ImgLoader +public class FusionImageLoader< T extends RealType< T > > implements ImgLoader< UnsignedShortType > { private final String pattern; @@ -96,13 +96,13 @@ public class FusionImageLoader< T extends RealType< T > > implements ImgLoader * not implemented. */ @Override - public RandomAccessibleInterval< FloatType > getImage( final View view ) + public RandomAccessibleInterval< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "not implemented" ); } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view ) { final int tp = view.getTimepoint(); final int c = view.getSetup().getChannel(); diff --git a/src/main/java/bdv/ij/export/imgloader/HuiskenImageLoader.java b/src/main/java/bdv/ij/export/imgloader/HuiskenImageLoader.java index f36c01245fbed61828ffcbcac9a31c17321b02e7..9d639b7bc44bfa6898c3c1367669df45f18b1533 100644 --- a/src/main/java/bdv/ij/export/imgloader/HuiskenImageLoader.java +++ b/src/main/java/bdv/ij/export/imgloader/HuiskenImageLoader.java @@ -29,7 +29,7 @@ import spimopener.SPIMExperiment; * * @author Tobias Pietzsch <tobias.pietzsch@gmail.com> */ -public class HuiskenImageLoader implements ImgLoader +public class HuiskenImageLoader implements ImgLoader< UnsignedShortType > { private File expFile; @@ -82,7 +82,7 @@ public class HuiskenImageLoader implements ImgLoader } @Override - public ImgPlus< UnsignedShortType > getUnsignedShortImage( final View view ) + public ImgPlus< UnsignedShortType > getImage( final View view ) { ensureExpIsOpen(); @@ -106,7 +106,7 @@ public class HuiskenImageLoader implements ImgLoader } @Override - public ImgPlus< FloatType > getImage( final View view ) + public ImgPlus< FloatType > getFloatImage( final View view ) { ensureExpIsOpen(); diff --git a/src/main/java/bdv/ij/export/imgloader/ImagePlusImgLoader.java b/src/main/java/bdv/ij/export/imgloader/ImagePlusImgLoader.java index 5a11007e688410d7cb5ba0df00d77e64ce960f70..17081799f0b160b69fe0bc70e9bfa8a6087b50c9 100644 --- a/src/main/java/bdv/ij/export/imgloader/ImagePlusImgLoader.java +++ b/src/main/java/bdv/ij/export/imgloader/ImagePlusImgLoader.java @@ -22,12 +22,12 @@ import org.jdom2.Element; /** * This {@link ImgLoader} implementation returns a wrapped, converted * {@link ImagePlus}. It is used for exporting {@link ImagePlus} to hdf5. Only - * the {@link #getUnsignedShortImage(View)} method is implemented because this + * the {@link #getImage(View)} method is implemented because this * is the only method required for exporting to hdf5. * * @author Tobias Pietzsch <tobias.pietzsch@gmail.com> */ -public class ImagePlusImgLoader< T extends RealType< T > > implements ImgLoader +public class ImagePlusImgLoader< T extends RealType< T > > implements ImgLoader< UnsignedShortType > { public static enum MinMaxOption { @@ -141,13 +141,13 @@ public class ImagePlusImgLoader< T extends RealType< T > > implements ImgLoader * not implemented. */ @Override - public RandomAccessibleInterval< FloatType > getImage( final View view ) + public RandomAccessibleInterval< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "not implemented" ); } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view ) { RandomAccessibleInterval< T > img = wrappedImp; if ( isMultiFrame ) diff --git a/src/main/java/bdv/ij/export/imgloader/StackImageLoader.java b/src/main/java/bdv/ij/export/imgloader/StackImageLoader.java index f58e23e9996e8b0191cc7a93c9aa88a3d6129510..a3ac85e8610ee7169af4ae2bac3a09c87837971b 100644 --- a/src/main/java/bdv/ij/export/imgloader/StackImageLoader.java +++ b/src/main/java/bdv/ij/export/imgloader/StackImageLoader.java @@ -26,12 +26,12 @@ import org.jdom2.Element; * <code>view.getSetupIndex() + numViewSetups * view.getTimepointIndex()</code>. * * This {@link ImgLoader} is used for exporting spim sequences to hdf5. Only the - * {@link #getUnsignedShortImage(View)} method is implemented because this is + * {@link #getImage(View)} method is implemented because this is * the only method required for exporting to hdf5. * * @author Tobias Pietzsch <tobias.pietzsch@gmail.com> */ -public class StackImageLoader implements ImgLoader +public class StackImageLoader implements ImgLoader< UnsignedShortType > { private final ImgOpener opener; @@ -77,13 +77,13 @@ public class StackImageLoader implements ImgLoader * not implemented. */ @Override - public ImgPlus< FloatType > getImage( final View view ) + public ImgPlus< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "not implemented" ); } @Override - public ImgPlus< UnsignedShortType > getUnsignedShortImage( final View view ) + public ImgPlus< UnsignedShortType > getImage( final View view ) { final int setup = view.getSetupIndex(); final int timepoint = view.getTimepointIndex(); diff --git a/src/main/java/bdv/ij/export/tiles/TileImgLoader.java b/src/main/java/bdv/ij/export/tiles/TileImgLoader.java index 4a2bc22d4ec2ee169498706bad90cdf9ece3385c..d396c6b792100a7231dee25c61a81a869bb5816e 100644 --- a/src/main/java/bdv/ij/export/tiles/TileImgLoader.java +++ b/src/main/java/bdv/ij/export/tiles/TileImgLoader.java @@ -32,7 +32,7 @@ import org.jdom2.input.SAXBuilder; import bdv.ij.export.tiles.CellVoyagerDataExporter.ChannelInfo; -public class TileImgLoader implements ImgLoader +public class TileImgLoader implements ImgLoader< UnsignedShortType > { private static final Namespace NAMESPACE = Namespace.getNamespace( "bts", "http://www.yokogawa.co.jp/BTS/BTSSchema/1.0" ); @@ -70,7 +70,7 @@ public class TileImgLoader implements ImgLoader } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view ) { final int setupIndex = view.getSetupIndex(); @@ -187,7 +187,7 @@ public class TileImgLoader implements ImgLoader } @Override - public RandomAccessibleInterval< FloatType > getImage( final View view ) + public RandomAccessibleInterval< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "not implemented" ); } diff --git a/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java b/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java index b12784f766eefe0f594593d1e3da311d58937a6c..dfbdca615817f853968fdd6655660a8e2d2795ea 100644 --- a/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java +++ b/src/main/java/bdv/img/catmaid/CatmaidImageLoader.java @@ -22,7 +22,7 @@ import bdv.img.cache.VolatileGlobalCellCache.LoadingStrategy; import bdv.img.cache.VolatileImgCells; import bdv.img.cache.VolatileImgCells.CellCache; -public class CatmaidImageLoader implements ViewerImgLoader +public class CatmaidImageLoader implements ViewerImgLoader< UnsignedShortType, VolatileUnsignedShortType > { private long width; @@ -103,19 +103,19 @@ public class CatmaidImageLoader implements ViewerImgLoader } @Override - public RandomAccessibleInterval< FloatType > getImage( final View view ) + public RandomAccessibleInterval< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "not implemented" ); } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view ) { - return getUnsignedShortImage( view, 0 ); + return getImage( view, 0 ); } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view, final int level ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view, final int level ) { final CellImg< UnsignedShortType, VolatileShortArray, VolatileCell< VolatileShortArray > > img = prepareCachedImage( view, level, LoadingStrategy.BLOCKING ); final UnsignedShortType linkedType = new UnsignedShortType( img ); @@ -124,7 +124,7 @@ public class CatmaidImageLoader implements ViewerImgLoader } @Override - public RandomAccessibleInterval< VolatileUnsignedShortType > getVolatileUnsignedShortImage( final View view, final int level ) + public RandomAccessibleInterval< VolatileUnsignedShortType > getVolatileImage( final View view, final int level ) { final CellImg< VolatileUnsignedShortType, VolatileShortArray, VolatileCell< VolatileShortArray > > img = prepareCachedImage( view, level, LoadingStrategy.VOLATILE ); final VolatileUnsignedShortType linkedType = new VolatileUnsignedShortType( img ); @@ -164,4 +164,21 @@ public class CatmaidImageLoader implements ViewerImgLoader { return cache; } + + private final UnsignedShortType type = new UnsignedShortType(); + + private final VolatileUnsignedShortType volatileType = new VolatileUnsignedShortType(); + + @Override + public UnsignedShortType getImageType() + { + return type; + } + + @Override + public VolatileUnsignedShortType getVolatileImageType() + { + return volatileType; + } + } diff --git a/src/main/java/bdv/img/hdf5/Hdf5ImageLoader.java b/src/main/java/bdv/img/hdf5/Hdf5ImageLoader.java index 3ee33b856543e535307dc22a6818b63b04e60769..1b6e87a1390a00635aa649d27631159ff55547d2 100644 --- a/src/main/java/bdv/img/hdf5/Hdf5ImageLoader.java +++ b/src/main/java/bdv/img/hdf5/Hdf5ImageLoader.java @@ -34,7 +34,7 @@ import ch.systemsx.cisd.hdf5.HDF5DataSetInformation; import ch.systemsx.cisd.hdf5.HDF5Factory; import ch.systemsx.cisd.hdf5.IHDF5Reader; -public class Hdf5ImageLoader implements ViewerImgLoader +public class Hdf5ImageLoader implements ViewerImgLoader< UnsignedShortType, VolatileUnsignedShortType > { protected File hdf5File; @@ -222,19 +222,19 @@ public class Hdf5ImageLoader implements ViewerImgLoader } @Override - public RandomAccessibleInterval< FloatType > getImage( final View view ) + public RandomAccessibleInterval< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "currently not used" ); } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view ) { - return getUnsignedShortImage( view, 0 ); + return getImage( view, 0 ); } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view, final int level ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view, final int level ) { if ( ! existsImageData( view, level ) ) { @@ -248,7 +248,7 @@ public class Hdf5ImageLoader implements ViewerImgLoader } @Override - public RandomAccessibleInterval< VolatileUnsignedShortType > getVolatileUnsignedShortImage( final View view, final int level ) + public RandomAccessibleInterval< VolatileUnsignedShortType > getVolatileImage( final View view, final int level ) { if ( ! existsImageData( view, level ) ) { @@ -392,4 +392,20 @@ public class Hdf5ImageLoader implements ViewerImgLoader } } } + + private final UnsignedShortType type = new UnsignedShortType(); + + private final VolatileUnsignedShortType volatileType = new VolatileUnsignedShortType(); + + @Override + public UnsignedShortType getImageType() + { + return type; + } + + @Override + public VolatileUnsignedShortType getVolatileImageType() + { + return volatileType; + } } diff --git a/src/main/java/bdv/tools/InitializeViewerState.java b/src/main/java/bdv/tools/InitializeViewerState.java index f9d34ea8525b624585e34d375b136153c6e30449..7e671062000a9c1a748de1c48fe0f16faf0592ba 100644 --- a/src/main/java/bdv/tools/InitializeViewerState.java +++ b/src/main/java/bdv/tools/InitializeViewerState.java @@ -131,7 +131,10 @@ public class InitializeViewerState { final ViewerState state = viewer.getState(); final Source< ? > source = state.getSources().get( state.getCurrentSource() ).getSpimSource(); - final RandomAccessibleInterval< UnsignedShortType > img = ( RandomAccessibleInterval ) source.getSource( state.getCurrentTimepoint(), source.getNumMipmapLevels() - 1 ); + if ( ! UnsignedShortType.class.isInstance( source.getType() ) ) + return; + @SuppressWarnings( "unchecked" ) + final RandomAccessibleInterval< UnsignedShortType > img = ( RandomAccessibleInterval< UnsignedShortType > ) source.getSource( state.getCurrentTimepoint(), source.getNumMipmapLevels() - 1 ); final long z = ( img.min( 2 ) + img.max( 2 ) + 1 ) / 2; final int numBins = 6535; diff --git a/src/main/java/bdv/tools/crop/CropDialog.java b/src/main/java/bdv/tools/crop/CropDialog.java index 7b23df7939715fcba68b9d384743e740df920274..4d59e4e357815d793578a2e68059aded022a089d 100644 --- a/src/main/java/bdv/tools/crop/CropDialog.java +++ b/src/main/java/bdv/tools/crop/CropDialog.java @@ -29,13 +29,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.filechooser.FileFilter; -import bdv.export.WriteSequenceToHdf5; -import bdv.export.WriteSequenceToXml; -import bdv.img.hdf5.Hdf5ImageLoader; -import bdv.img.hdf5.Util; -import bdv.viewer.Source; -import bdv.viewer.ViewerPanel; -import bdv.viewer.state.SourceState; import mpicbg.spim.data.SequenceDescription; import mpicbg.spim.data.View; import mpicbg.spim.data.ViewRegistration; @@ -45,6 +38,13 @@ import net.imglib2.RealInterval; import net.imglib2.realtransform.AffineTransform3D; import net.imglib2.type.numeric.integer.UnsignedShortType; import net.imglib2.util.Intervals; +import bdv.export.WriteSequenceToHdf5; +import bdv.export.WriteSequenceToXml; +import bdv.img.hdf5.Hdf5ImageLoader; +import bdv.img.hdf5.Util; +import bdv.viewer.Source; +import bdv.viewer.ViewerPanel; +import bdv.viewer.state.SourceState; public class CropDialog extends JDialog { @@ -250,6 +250,7 @@ public class CropDialog extends JDialog * @param hdf5File * @param xmlFile */ + @SuppressWarnings( "unchecked" ) public void cropGlobal( final int minTimepointIndex, final int maxTimepointIndex, final File hdf5File, final File xmlFile ) throws IOException { final AffineTransform3D globalToCropTransform = new AffineTransform3D(); @@ -265,7 +266,7 @@ public class CropDialog extends JDialog final RealInterval cropInterval = Intervals.createMinSizeReal( x, y, z, w, h, d ); final ArrayList< Source< UnsignedShortType > > sources = new ArrayList< Source< UnsignedShortType > >(); for( final SourceState< ? > s : viewer.getState().getSources() ) - sources.add( ( Source ) s.getSpimSource() ); + sources.add( ( Source< UnsignedShortType > ) s.getSpimSource() ); final ArrayList< Integer > timepoints = new ArrayList< Integer >(); final ArrayList< Integer > cropperTimepointMap = new ArrayList< Integer >(); for ( int tp = minTimepointIndex; tp <= maxTimepointIndex; ++tp ) diff --git a/src/main/java/bdv/tools/crop/CropImgLoader.java b/src/main/java/bdv/tools/crop/CropImgLoader.java index 5fe19b5a7099c5a7310e9f60da76d76cdb188469..f05b216396d5db3b637da12378b63a3159982f74 100644 --- a/src/main/java/bdv/tools/crop/CropImgLoader.java +++ b/src/main/java/bdv/tools/crop/CropImgLoader.java @@ -33,7 +33,7 @@ import bdv.viewer.Source; * * @author Tobias Pietzsch <tobias.pietzsch@gmail.com> */ -public class CropImgLoader implements ImgLoader +public class CropImgLoader implements ImgLoader< UnsignedShortType > { private final ArrayList< Source< UnsignedShortType > > sources; @@ -73,7 +73,7 @@ public class CropImgLoader implements ImgLoader * not implemented. */ @Override - public RandomAccessibleInterval< FloatType > getImage( final View view ) + public RandomAccessibleInterval< FloatType > getFloatImage( final View view ) { throw new UnsupportedOperationException( "not implemented" ); } @@ -86,7 +86,7 @@ public class CropImgLoader implements ImgLoader } @Override - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( final View view ) + public RandomAccessibleInterval< UnsignedShortType > getImage( final View view ) { final Pair< RandomAccessibleInterval< UnsignedShortType >, AffineTransform3D > pair = cropView( view ); return pair.getA(); diff --git a/src/main/java/mpicbg/spim/data/ImgLoader.java b/src/main/java/mpicbg/spim/data/ImgLoader.java index 306ecb4e028450644ff112274722a33aeecee690..1b65ef397b980dbd2ce488b7b25524984b3c2190 100644 --- a/src/main/java/mpicbg/spim/data/ImgLoader.java +++ b/src/main/java/mpicbg/spim/data/ImgLoader.java @@ -8,7 +8,7 @@ import net.imglib2.type.numeric.real.FloatType; import org.jdom2.Element; -public interface ImgLoader +public interface ImgLoader< T > { /** * initialize the loader from a "ImageLoader" DOM element. @@ -27,7 +27,7 @@ public interface ImgLoader * timepoint and setup for which to retrieve the image. * @return {@link FloatType} image normalized to range [0,1] */ - public RandomAccessibleInterval< FloatType > getImage( View view ); + public RandomAccessibleInterval< FloatType > getFloatImage( View view ); /** * Get {@link UnsignedShortType} un-normalized image. @@ -36,5 +36,5 @@ public interface ImgLoader * timepoint and setup for which to retrieve the image. * @return {@link UnsignedShortType} image. */ - public RandomAccessibleInterval< UnsignedShortType > getUnsignedShortImage( View view ); + public RandomAccessibleInterval< T > getImage( View view ); } diff --git a/src/main/java/mpicbg/spim/data/SequenceDescription.java b/src/main/java/mpicbg/spim/data/SequenceDescription.java index efea09fb8259dcae3f4c0545d9dc66902c3451a4..abc3f6c177357853da2e2b4b1a8f13dcad4aaf82 100644 --- a/src/main/java/mpicbg/spim/data/SequenceDescription.java +++ b/src/main/java/mpicbg/spim/data/SequenceDescription.java @@ -39,10 +39,10 @@ public class SequenceDescription /** * load images for every view. might be null. */ - public final ImgLoader imgLoader; + public final ImgLoader< ? > imgLoader; // TODO: make protected and use getter - public SequenceDescription( final List< ? extends ViewSetup > setups, final List< Integer > timepoints, final File basePath, final ImgLoader imgLoader ) + public SequenceDescription( final List< ? extends ViewSetup > setups, final List< Integer > timepoints, final File basePath, final ImgLoader< ? > imgLoader ) { this.timepoints = new ArrayList< Integer >( timepoints ); this.setups = new ArrayList< ViewSetup >( setups ); @@ -111,13 +111,13 @@ public class SequenceDescription return basePath; } - protected static ImgLoader createImgLoaderFromXml( final Element sequenceDescription, final File basePath ) throws InstantiationException, IllegalAccessException, ClassNotFoundException + protected static ImgLoader< ? > createImgLoaderFromXml( final Element sequenceDescription, final File basePath ) throws InstantiationException, IllegalAccessException, ClassNotFoundException { final Element elem = sequenceDescription.getChild( "ImageLoader" ); String classn = elem.getAttributeValue( "class" ); if ( classn.equals( "viewer.hdf5.Hdf5ImageLoader" ) ) classn = "bdv.img.hdf5.Hdf5ImageLoader"; - final ImgLoader imgLoader = ( ImgLoader ) Class.forName( classn ).newInstance(); + final ImgLoader< ? > imgLoader = ( ImgLoader< ? > ) Class.forName( classn ).newInstance(); imgLoader.init( elem, basePath ); return imgLoader; }