Skip to content
Snippets Groups Projects
Commit 160cc1d6 authored by Tobias Pietzsch's avatar Tobias Pietzsch
Browse files

contruct ImgOpener with a Context that works (for now) in both Eclipse and Fiji

parent 1c6284a9
No related branches found
No related tags found
No related merge requests found
...@@ -709,6 +709,10 @@ public class ExportSpimSequencePlugIn implements PlugIn ...@@ -709,6 +709,10 @@ public class ExportSpimSequencePlugIn implements PlugIn
public static void main( final String[] args ) public static void main( final String[] args )
{ {
Bead_Registration.spimDataDirectory = "/Users/pietzsch/workspace/data/openspim";
Bead_Registration.fileNamePattern = "spim_TL{tt}_Angle{a}.tif";
Bead_Registration.timepoints = "0";
Bead_Registration.angles = "0";
new ExportSpimSequencePlugIn().run( null ); new ExportSpimSequencePlugIn().run( null );
} }
} }
package bdv.ij.export.imgloader; package bdv.ij.export.imgloader;
import ij.IJ;
import ij.ImagePlus; import ij.ImagePlus;
import io.scif.SCIFIOService;
import io.scif.img.ImgIOException; import io.scif.img.ImgIOException;
import io.scif.img.ImgOpener; import io.scif.img.ImgOpener;
...@@ -21,6 +21,10 @@ import net.imglib2.meta.ImgPlus; ...@@ -21,6 +21,10 @@ import net.imglib2.meta.ImgPlus;
import net.imglib2.type.numeric.integer.UnsignedByteType; import net.imglib2.type.numeric.integer.UnsignedByteType;
import net.imglib2.type.numeric.integer.UnsignedShortType; import net.imglib2.type.numeric.integer.UnsignedShortType;
import org.scijava.Context;
import org.scijava.app.AppService;
import org.scijava.app.StatusService;
/** /**
* This {@link ImgLoader} loads images that represent a 3D stack in a single * This {@link ImgLoader} loads images that represent a 3D stack in a single
...@@ -33,7 +37,7 @@ import net.imglib2.type.numeric.integer.UnsignedShortType; ...@@ -33,7 +37,7 @@ import net.imglib2.type.numeric.integer.UnsignedShortType;
*/ */
public class StackImageLoader implements BasicImgLoader< UnsignedShortType > public class StackImageLoader implements BasicImgLoader< UnsignedShortType >
{ {
private ImgOpener opener; private final ImgOpener opener;
private final ArrayImgFactory< UnsignedShortType > factory; private final ArrayImgFactory< UnsignedShortType > factory;
...@@ -47,14 +51,7 @@ public class StackImageLoader implements BasicImgLoader< UnsignedShortType > ...@@ -47,14 +51,7 @@ public class StackImageLoader implements BasicImgLoader< UnsignedShortType >
{ {
this.filenames = filenames; this.filenames = filenames;
this.useImageJOpener = useImageJOpener; this.useImageJOpener = useImageJOpener;
try opener = useImageJOpener ? null : new ImgOpener( new Context( SCIFIOService.class, AppService.class, StatusService.class ) );
{
opener = new ImgOpener();
}
catch ( final Exception e )
{
e.printStackTrace();
}
factory = new ArrayImgFactory< UnsignedShortType >(); factory = new ArrayImgFactory< UnsignedShortType >();
type = new UnsignedShortType(); type = new UnsignedShortType();
} }
...@@ -65,11 +62,6 @@ public class StackImageLoader implements BasicImgLoader< UnsignedShortType > ...@@ -65,11 +62,6 @@ public class StackImageLoader implements BasicImgLoader< UnsignedShortType >
final String fn = filenames.get( view ); final String fn = filenames.get( view );
if ( useImageJOpener ) if ( useImageJOpener )
{ {
if ( opener == null )
{
IJ.showMessage( "Error", "Error: Could not create io.scif.img.ImgOpener" );
return null;
}
final ImagePlus imp = new ImagePlus( fn ); final ImagePlus imp = new ImagePlus( fn );
if ( imp.getType() == ImagePlus.GRAY16 ) if ( imp.getType() == ImagePlus.GRAY16 )
return new ImgPlus< UnsignedShortType >( ImageJFunctions.wrapShort( imp ) ); return new ImgPlus< UnsignedShortType >( ImageJFunctions.wrapShort( imp ) );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment