diff --git a/pom.xml b/pom.xml index e2de9b8..828c8a1 100644 --- a/pom.xml +++ b/pom.xml @@ -5,26 +5,26 @@ org.scijava pom-scijava - 31.1.0 + 37.0.0 sc.fiji spim_data - 2.2.8-SNAPSHOT + 2.3.0-SNAPSHOT SPIM Data representation of multi-angle, multi-channel (etc.) SPIM images and their registration - http://github.com/bigdataviewer/spimdata + https://github.com/bigdataviewer/spimdata 2013 BigDataViewer - https://imagej.net/BigDataViewer + https://imagej.net/plugins/bdv Simplified BSD License - http://opensource.org/licenses/BSD-2-Clause + https://opensource.org/licenses/BSD-2-Clause repo @@ -33,7 +33,7 @@ tpietzsch Tobias Pietzsch - https://imagej.net/User:Pietzsch + https://imagej.net/people/tpietzsch founder lead @@ -47,7 +47,7 @@ StephanPreibisch Stephan Preibisch - https://imagej.net/User:StephanP + https://imagej.net/people/StephanPreibisch founder lead @@ -60,7 +60,7 @@ ctrueden Curtis Rueden - https://imagej.net/User:Rueden + https://imagej.net/people/ctrueden maintainer @@ -69,7 +69,7 @@ Johannes Schindelin - https://imagej.net/User:Schindelin + https://imagej.net/people/dscho dscho founder @@ -79,7 +79,7 @@ Stephan Saalfeld - https://imagej.net/User:Saalfeld + https://imagej.net/people/axtimwalde axtimwalde @@ -146,6 +146,8 @@ net.sf.trove4j trove4j + + junit junit diff --git a/src/main/java/mpicbg/spim/data/SpimDataExample2.java b/src/main/java/mpicbg/spim/data/SpimDataExample2.java index c7d47b2..7f25341 100644 --- a/src/main/java/mpicbg/spim/data/SpimDataExample2.java +++ b/src/main/java/mpicbg/spim/data/SpimDataExample2.java @@ -29,6 +29,7 @@ package mpicbg.spim.data; import java.io.IOException; +import java.net.URI; import java.text.ParseException; import java.util.ArrayList; import java.util.HashMap; @@ -175,7 +176,7 @@ public static void exampleSequenceDescription() throws IOException, ParseExcepti final Document doc = new Document( io.toXml( sequence, null ) ); new XMLOutputter( Format.getPrettyFormat() ).output( doc, System.out ); - final SequenceDescription fromXml = io.fromXml( doc.getRootElement(), null ); + final SequenceDescription fromXml = io.fromXml( doc.getRootElement(), ( URI ) null ); new XMLOutputter( Format.getPrettyFormat() ).output( new Document( new XmlIoSequenceDescription().toXml( fromXml, null ) ), System.out ); } diff --git a/src/main/java/mpicbg/spim/data/XmlHelpers.java b/src/main/java/mpicbg/spim/data/XmlHelpers.java index 1b3dfe7..5847344 100644 --- a/src/main/java/mpicbg/spim/data/XmlHelpers.java +++ b/src/main/java/mpicbg/spim/data/XmlHelpers.java @@ -30,6 +30,8 @@ import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import net.imglib2.Dimensions; import net.imglib2.FinalDimensions; @@ -270,7 +272,7 @@ public static File loadPath( final Element parent, final String name, final Stri { final Element elem = parent.getChild( name ); final String path = ( elem == null ) ? defaultRelativePath : elem.getText(); - final boolean isRelative = ( elem == null ) ? true : elem.getAttributeValue( "type" ).equals( "relative" ); + final boolean isRelative = ( elem == null ) || elem.getAttributeValue( "type" ).equals( "relative" ); if ( isRelative ) { if ( basePath == null ) @@ -282,6 +284,31 @@ public static File loadPath( final Element parent, final String name, final Stri return new File( path ); } + public static URI loadPathURI( final Element parent, final String name, final String defaultRelativePath, final URI basePath ) + { + final Element elem = parent.getChild( name ); + final String path = ( elem == null ) ? defaultRelativePath : elem.getText(); + final boolean isRelative = ( elem == null ) || elem.getAttributeValue( "type" ).equals( "relative" ); + if ( isRelative ) + { + if ( basePath == null ) + return null; + else + return basePath.resolve( path ); + } + else + { + try + { + return new URI( path ); + } + catch ( URISyntaxException e ) + { + return null; + } + } + } + public static File loadPath( final Element parent, final String name, final File basePath ) { final Element elem = parent.getChild( name ); @@ -301,6 +328,35 @@ public static File loadPath( final Element parent, final String name, final File return new File( path ); } + public static URI loadPathURI( final Element parent, final String name, final URI basePath ) + { + final Element elem = parent.getChild( name ); + if ( elem == null ) + return null; + final String path = elem.getText(); + final String pathType = elem.getAttributeValue( "type" ); + final boolean isRelative = null != pathType && pathType.equals( "relative" ); + if ( isRelative ) + { + if ( basePath == null ) + return null; + else + return basePath.resolve( path ); + } + else + { + try + { + return new URI( path ); + } + catch ( URISyntaxException e ) + { + return null; + } + } + } + + /** * @return {@code true} if the path under {@code parent/name} is stored relative, {@code false} if absolute. */ @@ -358,6 +414,38 @@ public static File getRelativePath( final File file, final File relativeToThis ) } } + /** + * @param basePath if null put the absolute path, otherwise relative to this + */ + public static Element pathElementURI( final String name, final URI path, final URI basePath ) + { + final Element e = new Element( name ); + if ( basePath == null ) + { + e.setAttribute( "type", "absolute" ); + e.setText( path.normalize().toString() ); + } + else + { + // Try to build a relative path. If can't, make it absolute. + URI relativePath = basePath.relativize( path ).normalize(); + if ( relativePath.equals( path ) ) + { + e.setAttribute( "type", "absolute" ); + e.setText( path.toString() ); + } + else + { + if ( relativePath.toString().isEmpty() ) + relativePath = URI.create( "." ); + e.setAttribute( "type", "relative" ); + e.setText( relativePath.toString() ); + } + } + + return e; + } + private static File getRelativePath( final File file, final File relativeToThis, final String relativeInitial ) { File parent = file; diff --git a/src/main/java/mpicbg/spim/data/generic/AbstractSpimData.java b/src/main/java/mpicbg/spim/data/generic/AbstractSpimData.java index cd0365e..b0fd8af 100644 --- a/src/main/java/mpicbg/spim/data/generic/AbstractSpimData.java +++ b/src/main/java/mpicbg/spim/data/generic/AbstractSpimData.java @@ -29,6 +29,7 @@ package mpicbg.spim.data.generic; import java.io.File; +import java.net.URI; import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.registration.ViewRegistrations; @@ -38,7 +39,7 @@ public class AbstractSpimData< S extends AbstractSequenceDescription< ?, ?, ? > /** * Relative paths in the XML should be interpreted with respect to this. */ - private File basePath; + private URI basePathURI; private S sequenceDescription; @@ -46,7 +47,7 @@ public class AbstractSpimData< S extends AbstractSequenceDescription< ?, ?, ? > public AbstractSpimData( final File basePath, final S sequenceDescription, final ViewRegistrations viewRegistrations ) { - this.basePath = basePath; + this.basePathURI = basePath == null ? null : basePath.toURI(); this.sequenceDescription = sequenceDescription; this.viewRegistrations = viewRegistrations; } @@ -59,7 +60,12 @@ public AbstractSpimData( final File basePath, final S sequenceDescription, final */ public File getBasePath() { - return basePath; + return new File( basePathURI ); + } + + public URI getBasePathURI() + { + return basePathURI; } public S getSequenceDescription() @@ -74,7 +80,12 @@ public ViewRegistrations getViewRegistrations() public void setBasePath( final File basePath ) { - this.basePath = basePath; + this.basePathURI = basePath.toURI(); + } + + public void setBasePathURI( final URI basePathURI ) + { + this.basePathURI = basePathURI; } protected void setSequenceDescription( final S sequenceDescription ) diff --git a/src/main/java/mpicbg/spim/data/generic/XmlIoAbstractSpimData.java b/src/main/java/mpicbg/spim/data/generic/XmlIoAbstractSpimData.java index 02415f9..397b02f 100644 --- a/src/main/java/mpicbg/spim/data/generic/XmlIoAbstractSpimData.java +++ b/src/main/java/mpicbg/spim/data/generic/XmlIoAbstractSpimData.java @@ -33,9 +33,22 @@ import static mpicbg.spim.data.XmlKeys.SPIMDATA_VERSION_ATTRIBUTE_CURRENT; import static mpicbg.spim.data.XmlKeys.SPIMDATA_VERSION_ATTRIBUTE_NAME; +import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; +import java.io.FileReader; import java.io.IOException; +import java.io.Reader; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Paths; +import java.util.Objects; + +import org.jdom2.Document; +import org.jdom2.Element; +import org.jdom2.input.SAXBuilder; +import org.jdom2.output.Format; +import org.jdom2.output.XMLOutputter; import mpicbg.spim.data.SpimDataException; import mpicbg.spim.data.SpimDataIOException; @@ -46,12 +59,6 @@ import mpicbg.spim.data.generic.sequence.XmlIoAbstractSequenceDescription; import mpicbg.spim.data.registration.XmlIoViewRegistrations; -import org.jdom2.Document; -import org.jdom2.Element; -import org.jdom2.input.SAXBuilder; -import org.jdom2.output.Format; -import org.jdom2.output.XMLOutputter; - public class XmlIoAbstractSpimData< S extends AbstractSequenceDescription< ?, ?, ? >, T extends AbstractSpimData< S > > extends XmlIoSingleton< T > { private final XmlIoAbstractSequenceDescription< ?, S > xmlIoSequenceDescription; @@ -72,16 +79,31 @@ public XmlIoAbstractSpimData( final Class< T > klass, } public T load( final String xmlFilename ) throws SpimDataException + { + try + { + final File file = new File( xmlFilename ); + final BufferedReader reader = new BufferedReader( new FileReader( file ) ); + return load( reader, file.toURI() ); + } + catch ( final IOException e ) + { + throw new SpimDataIOException( e ); + } + } + + /** + * Load SpimData from the given {@code Reader} (that can read from a local + * file, or S3 for example). The {@code xmlURI} is the URI that the {@code + * xmlReader} reads from, and it is used to construct the base path URI. + */ + public T load( final Reader xmlReader, final URI xmlURI ) throws SpimDataException { final SAXBuilder sax = new SAXBuilder(); Document doc; try { - final File file = new File( xmlFilename ); - if ( file.exists() ) - doc = sax.build( file ); - else - doc = sax.build( xmlFilename ); + doc = sax.build( xmlReader ); } catch ( final Exception e ) { @@ -89,12 +111,13 @@ public T load( final String xmlFilename ) throws SpimDataException } final Element root = doc.getRootElement(); - if ( root.getName() != SPIMDATA_TAG ) + if ( !Objects.equals( root.getName(), SPIMDATA_TAG ) ) throw new RuntimeException( "expected <" + SPIMDATA_TAG + "> root element. wrong file?" ); - return fromXml( root, new File( xmlFilename ) ); + return fromXml( root, xmlURI ); } + public void save( final T spimData, final String xmlFilename ) throws SpimDataException { final File xmlFileDirectory = new File( xmlFilename ).getParentFile(); @@ -139,18 +162,23 @@ public String getVersion( final Element root ) * @return */ public T fromXml( final Element root, final File xmlFile ) throws SpimDataException + { + return fromXml( root, xmlFile.toURI() ); + } + + public T fromXml( final Element root, final URI xmlURI ) throws SpimDataException { final T spimData = super.fromXml( root ); // String version = getVersion( root ); - final File basePath = loadBasePath( root, xmlFile ); - spimData.setBasePath( basePath ); + final URI basePathURI = loadBasePathURI( root, xmlURI ); + spimData.setBasePathURI( basePathURI ); Element elem = root.getChild( xmlIoSequenceDescription.getTag() ); if ( elem == null ) throw new SpimDataIOException( "no <" + xmlIoSequenceDescription.getTag() + "> element found." ); - spimData.setSequenceDescription( xmlIoSequenceDescription.fromXml( elem, basePath ) ); + spimData.setSequenceDescription( xmlIoSequenceDescription.fromXml( elem, basePathURI ) ); elem = root.getChild( xmlIoViewRegistrations.getTag() ); if ( elem == null ) @@ -160,12 +188,23 @@ public T fromXml( final Element root, final File xmlFile ) throws SpimDataExcept return spimData; } - protected File loadBasePath( final Element root, final File xmlFile ) + protected URI loadBasePathURI( final Element root, final URI xmlURI ) throws SpimDataIOException { - File xmlFileParentDirectory = xmlFile.getParentFile(); - if ( xmlFileParentDirectory == null ) - xmlFileParentDirectory = new File( "." ); - return XmlHelpers.loadPath( root, BASEPATH_TAG, ".", xmlFileParentDirectory ); + final URI parent = getParent( xmlURI ); + return XmlHelpers.loadPathURI( root, BASEPATH_TAG, ".", parent ); + } + + private static URI getParent( final URI uri ) throws SpimDataIOException + { + try + { + final String parent = Paths.get( uri.getPath() ).getParent().toString() + "/"; + return new URI( uri.getScheme(), uri.getAuthority(), parent, uri.getQuery(), uri.getFragment() ); + } + catch ( URISyntaxException e ) + { + throw new SpimDataIOException( e ); + } } /** diff --git a/src/main/java/mpicbg/spim/data/generic/sequence/BasicImgLoader.java b/src/main/java/mpicbg/spim/data/generic/sequence/BasicImgLoader.java index 9244840..f0ec3b2 100644 --- a/src/main/java/mpicbg/spim/data/generic/sequence/BasicImgLoader.java +++ b/src/main/java/mpicbg/spim/data/generic/sequence/BasicImgLoader.java @@ -46,5 +46,5 @@ public interface BasicImgLoader * view setup for which to get the {@link BasicSetupImgLoader}. * @return {@link BasicSetupImgLoader} for the specified view setup. */ - public BasicSetupImgLoader< ? > getSetupImgLoader( final int setupId ); + BasicSetupImgLoader< ? > getSetupImgLoader( int setupId ); } diff --git a/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionImgLoader.java b/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionImgLoader.java index 89551b0..55f8426 100644 --- a/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionImgLoader.java +++ b/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionImgLoader.java @@ -47,5 +47,5 @@ public interface BasicMultiResolutionImgLoader extends BasicImgLoader * setup. */ @Override - public BasicMultiResolutionSetupImgLoader< ? > getSetupImgLoader( final int setupId ); + BasicMultiResolutionSetupImgLoader< ? > getSetupImgLoader( int setupId ); } diff --git a/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionSetupImgLoader.java b/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionSetupImgLoader.java index a67176d..53e6846 100644 --- a/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionSetupImgLoader.java +++ b/src/main/java/mpicbg/spim/data/generic/sequence/BasicMultiResolutionSetupImgLoader.java @@ -57,7 +57,7 @@ public interface BasicMultiResolutionSetupImgLoader< T > extends BasicSetupImgLo * optional hints regarding how to load the image. * @return image of type T. */ - public RandomAccessibleInterval< T > getImage( final int timepointId, final int level, ImgLoaderHint... hints ); + RandomAccessibleInterval< T > getImage( int timepointId, final int level, ImgLoaderHint... hints ); /** * Get the sub-sampling factors, indexed by resolution level and dimension. @@ -66,7 +66,7 @@ public interface BasicMultiResolutionSetupImgLoader< T > extends BasicSetupImgLo * * @return sub-sampling factors, indexed by resolution level and dimension. */ - public double[][] getMipmapResolutions(); + double[][] getMipmapResolutions(); /** * Get the transformation from coordinates of the sub-sampled image of a a @@ -75,12 +75,12 @@ public interface BasicMultiResolutionSetupImgLoader< T > extends BasicSetupImgLo * * @return array with one transformation for each mipmap level. */ - public AffineTransform3D[] getMipmapTransforms(); + AffineTransform3D[] getMipmapTransforms(); /** * Get number of resolution levels. * * @return number of resolution levels. */ - public int numMipmapLevels(); + int numMipmapLevels(); } diff --git a/src/main/java/mpicbg/spim/data/generic/sequence/BoundedTypeBasicImgLoader.java b/src/main/java/mpicbg/spim/data/generic/sequence/BoundedTypeBasicImgLoader.java index aff9bf7..23a5e83 100644 --- a/src/main/java/mpicbg/spim/data/generic/sequence/BoundedTypeBasicImgLoader.java +++ b/src/main/java/mpicbg/spim/data/generic/sequence/BoundedTypeBasicImgLoader.java @@ -31,5 +31,5 @@ public interface BoundedTypeBasicImgLoader< T > extends BasicImgLoader { @Override - public BasicSetupImgLoader< ? extends T > getSetupImgLoader( final int setupId ); + BasicSetupImgLoader< ? extends T > getSetupImgLoader( int setupId ); } diff --git a/src/main/java/mpicbg/spim/data/generic/sequence/TypedBasicImgLoader.java b/src/main/java/mpicbg/spim/data/generic/sequence/TypedBasicImgLoader.java index 7d0a065..89d094c 100644 --- a/src/main/java/mpicbg/spim/data/generic/sequence/TypedBasicImgLoader.java +++ b/src/main/java/mpicbg/spim/data/generic/sequence/TypedBasicImgLoader.java @@ -31,5 +31,5 @@ public interface TypedBasicImgLoader< T > extends BoundedTypeBasicImgLoader< T > { @Override - public BasicSetupImgLoader< T > getSetupImgLoader( final int setupId ); + BasicSetupImgLoader< T > getSetupImgLoader( int setupId ); } diff --git a/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoAbstractSequenceDescription.java b/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoAbstractSequenceDescription.java index a0f70da..deb8554 100644 --- a/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoAbstractSequenceDescription.java +++ b/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoAbstractSequenceDescription.java @@ -33,6 +33,7 @@ import static mpicbg.spim.data.XmlKeys.SEQUENCEDESCRIPTION_TAG; import java.io.File; +import java.net.URI; import java.util.HashMap; import mpicbg.spim.data.SpimDataException; @@ -88,8 +89,14 @@ public Element toXml( final T sequenceDescription, final File basePath ) throws return elem; } - @SuppressWarnings( { "unchecked", "rawtypes" } ) public T fromXml( final Element elem, final File basePath ) throws SpimDataException + { + System.out.println( "XmlIoAbstractSequenceDescription.fromXml with File" ); + return fromXml( elem, basePath.toURI() ); + } + + @SuppressWarnings( { "unchecked", "rawtypes" } ) + public T fromXml( final Element elem, final URI basePathURI ) throws SpimDataException { final T sequenceDescription = super.fromXml( elem ); @@ -108,7 +115,7 @@ public T fromXml( final Element elem, final File basePath ) throws SpimDataExcep { final String format = imgLoaderElem.getAttributeValue( IMGLOADER_FORMAT_ATTRIBUTE_NAME ); final XmlIoBasicImgLoader< ? > imgLoaderIo = ImgLoaders.createXmlIoForFormat( format ); - final BasicImgLoader imgLoader = imgLoaderIo.fromXml( imgLoaderElem, basePath, sequenceDescription ); + final BasicImgLoader imgLoader = imgLoaderIo.fromXml( imgLoaderElem, basePathURI, sequenceDescription ); setImgLoader( ( AbstractSequenceDescription ) sequenceDescription, imgLoader ); } else diff --git a/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoBasicImgLoader.java b/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoBasicImgLoader.java index 4bafffd..774666f 100644 --- a/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoBasicImgLoader.java +++ b/src/main/java/mpicbg/spim/data/generic/sequence/XmlIoBasicImgLoader.java @@ -29,12 +29,54 @@ package mpicbg.spim.data.generic.sequence; import java.io.File; +import java.net.URI; import org.jdom2.Element; public interface XmlIoBasicImgLoader< T extends BasicImgLoader > { - public Element toXml( final T imgLoader, final File basePath ); + Element toXml( T imgLoader, File basePath ); - public T fromXml( final Element elem, final File basePath, AbstractSequenceDescription< ?, ?, ? > sequenceDescription ); + /** + * Subclasses that construct ImgLoaders that are able to read from sources + * other than local files should override this method. The default + * implementation falls back to {@link #toXml(BasicImgLoader, File)}, but + * this will fail if the {@code basePathURI} does not refer to a local file. + */ + default Element toXml( final T imgLoader, final URI basePathURI ) + { + final File basePath; + try + { + basePath = basePathURI == null ? null : new File( basePathURI ); + } + catch ( final IllegalArgumentException e ) + { + throw new RuntimeException( "Could not convert base path \"" + basePathURI + "\" into File, and " + this.getClass().getName() + " does not handle base path URIs.", e ); + } + return toXml( imgLoader, basePath ); + } + + T fromXml( Element elem, File basePath, AbstractSequenceDescription< ?, ?, ? > sequenceDescription ); + + /** + * Subclasses that construct ImgLoaders that are able to read from sources + * other than local files should override this method. The default + * implementation falls back to {@link #fromXml(Element, File, + * AbstractSequenceDescription)}, but this will fail if the {@code + * basePathURI} does not refer to a local file. + */ + default T fromXml( final Element elem, final URI basePathURI, AbstractSequenceDescription< ?, ?, ? > sequenceDescription ) + { + final File basePath; + try + { + basePath = basePathURI == null ? null : new File( basePathURI ); + } + catch ( final IllegalArgumentException e ) + { + throw new RuntimeException( "Could not convert base path \"" + basePathURI + "\" into File, and " + this.getClass().getName() + " does not handle base path URIs.", e ); + } + return fromXml( elem, basePath, sequenceDescription ); + } } diff --git a/src/main/java/mpicbg/spim/data/registration/ViewTransform.java b/src/main/java/mpicbg/spim/data/registration/ViewTransform.java index 5070699..5ae31b8 100644 --- a/src/main/java/mpicbg/spim/data/registration/ViewTransform.java +++ b/src/main/java/mpicbg/spim/data/registration/ViewTransform.java @@ -38,7 +38,7 @@ public interface ViewTransform * * @return true, if this transform has a name. */ - public boolean hasName(); + boolean hasName(); /** * Get the name of this transform. @@ -46,7 +46,7 @@ public interface ViewTransform * * @return the name of this transform or null if it is not set. */ - public String getName(); + String getName(); /** * A representation of this {@link ViewTransform} as a 3D {@link AffineGet}. @@ -54,5 +54,5 @@ public interface ViewTransform * * @return 3D affine representation of this transform. */ - public AffineGet asAffine3D(); + AffineGet asAffine3D(); } diff --git a/src/main/java/mpicbg/spim/data/registration/ViewTransformGeneric.java b/src/main/java/mpicbg/spim/data/registration/ViewTransformGeneric.java index b4bfeff..6c85541 100644 --- a/src/main/java/mpicbg/spim/data/registration/ViewTransformGeneric.java +++ b/src/main/java/mpicbg/spim/data/registration/ViewTransformGeneric.java @@ -37,10 +37,10 @@ public interface ViewTransformGeneric extends ViewTransform /** * initialize the transform from a <{@value XmlKeys#VIEWTRANSFORM_TAG}> DOM element. */ - public void init( final Element elem ); + void init( Element elem ); /** * create a <{@value XmlKeys#VIEWTRANSFORM_TAG}> DOM element for this {@link ViewTransform}. */ - public Element toXml(); + Element toXml(); } diff --git a/src/main/java/mpicbg/spim/data/sequence/ImgLoader.java b/src/main/java/mpicbg/spim/data/sequence/ImgLoader.java index f791005..93ae594 100644 --- a/src/main/java/mpicbg/spim/data/sequence/ImgLoader.java +++ b/src/main/java/mpicbg/spim/data/sequence/ImgLoader.java @@ -48,5 +48,5 @@ public interface ImgLoader extends BasicImgLoader * @return {@link SetupImgLoader} for the specified view setup. */ @Override - public SetupImgLoader< ? > getSetupImgLoader( final int setupId ); + SetupImgLoader< ? > getSetupImgLoader( int setupId ); } diff --git a/src/main/java/mpicbg/spim/data/sequence/MultiResolutionImgLoader.java b/src/main/java/mpicbg/spim/data/sequence/MultiResolutionImgLoader.java index 495f881..0a8e2c3 100644 --- a/src/main/java/mpicbg/spim/data/sequence/MultiResolutionImgLoader.java +++ b/src/main/java/mpicbg/spim/data/sequence/MultiResolutionImgLoader.java @@ -49,5 +49,5 @@ public interface MultiResolutionImgLoader extends BasicMultiResolutionImgLoader, * setup. */ @Override - public MultiResolutionSetupImgLoader< ? > getSetupImgLoader( final int setupId ); + MultiResolutionSetupImgLoader< ? > getSetupImgLoader( int setupId ); } diff --git a/src/main/java/mpicbg/spim/data/sequence/MultiResolutionSetupImgLoader.java b/src/main/java/mpicbg/spim/data/sequence/MultiResolutionSetupImgLoader.java index 28eeb16..97acc11 100644 --- a/src/main/java/mpicbg/spim/data/sequence/MultiResolutionSetupImgLoader.java +++ b/src/main/java/mpicbg/spim/data/sequence/MultiResolutionSetupImgLoader.java @@ -56,7 +56,7 @@ public interface MultiResolutionSetupImgLoader< T > extends BasicMultiResolutionSetupImgLoader< T >, SetupImgLoader< T > { @Override - public default RandomAccessibleInterval< FloatType > getFloatImage( final int timepointId, final boolean normalize, final ImgLoaderHint... hints ) + default RandomAccessibleInterval< FloatType > getFloatImage( final int timepointId, final boolean normalize, final ImgLoaderHint... hints ) { return getFloatImage( timepointId, 0, normalize, hints ); } @@ -77,7 +77,7 @@ public default RandomAccessibleInterval< FloatType > getFloatImage( final int ti * @return {@link FloatType} image */ @SuppressWarnings( { "unchecked", "rawtypes" } ) - public default RandomAccessibleInterval< FloatType > getFloatImage( final int timepointId, final int level, final boolean normalize, final ImgLoaderHint... hints ) + default RandomAccessibleInterval< FloatType > getFloatImage( final int timepointId, final int level, final boolean normalize, final ImgLoaderHint... hints ) { final T type = getImageType(); if ( !( type instanceof RealType ) ) @@ -119,7 +119,7 @@ public default RandomAccessibleInterval< FloatType > getFloatImage( final int ti } @Override - public default Dimensions getImageSize( final int timepointId ) + default Dimensions getImageSize( final int timepointId ) { return getImageSize( timepointId, 0 ); } @@ -135,5 +135,5 @@ public default Dimensions getImageSize( final int timepointId ) * resolution level for which to retrieve the image size. * @return the image size, or null if it could not be determined. */ - public Dimensions getImageSize( final int timepointId, final int level ); + Dimensions getImageSize( int timepointId, int level ); } diff --git a/src/main/java/mpicbg/spim/data/sequence/SetupImgLoader.java b/src/main/java/mpicbg/spim/data/sequence/SetupImgLoader.java index e51f405..c6b0110 100644 --- a/src/main/java/mpicbg/spim/data/sequence/SetupImgLoader.java +++ b/src/main/java/mpicbg/spim/data/sequence/SetupImgLoader.java @@ -58,7 +58,7 @@ public interface SetupImgLoader< T > extends BasicSetupImgLoader< T > * optional hints regarding how to load the image. * @return {@link FloatType} image */ - public RandomAccessibleInterval< FloatType > getFloatImage( final int timepointId, boolean normalize, ImgLoaderHint... hints ); + RandomAccessibleInterval< FloatType > getFloatImage( int timepointId, boolean normalize, ImgLoaderHint... hints ); /** * Get the size of an image. If possible, load only the meta-data for the @@ -69,7 +69,7 @@ public interface SetupImgLoader< T > extends BasicSetupImgLoader< T > * timepoint for which to retrieve the image size. * @return the image size, or null if it could not be determined. */ - public Dimensions getImageSize( final int timepointId ); + Dimensions getImageSize( int timepointId ); /** * Get the voxel size of an image. If possible, load only the meta-data for @@ -81,5 +81,5 @@ public interface SetupImgLoader< T > extends BasicSetupImgLoader< T > * timepoint for which to retrieve the voxel size. * @return the voxel size, or null if it could not be determined. */ - public VoxelDimensions getVoxelSize( final int timepointId ); + VoxelDimensions getVoxelSize( int timepointId ); }