Skip to content

Commit

Permalink
fix: test URI of underlying imgloaders, not the XML location
Browse files Browse the repository at this point in the history
add: getUnderlyingImageLoader() methods
  • Loading branch information
StephanPreibisch committed Nov 6, 2024
1 parent 08699a4 commit fbe8957
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.HashSet;
import java.util.List;

import bdv.img.n5.N5ImageLoader;
import fiji.util.gui.GenericDialogPlus;
import ij.gui.GenericDialog;
import mpicbg.spim.data.SpimDataException;
Expand All @@ -57,13 +58,15 @@
import mpicbg.spim.data.sequence.Angle;
import mpicbg.spim.data.sequence.Channel;
import mpicbg.spim.data.sequence.Illumination;
import mpicbg.spim.data.sequence.ImgLoader;
import mpicbg.spim.data.sequence.Tile;
import mpicbg.spim.data.sequence.TimePoint;
import net.preibisch.legacy.io.IOFunctions;
import net.preibisch.mvrecon.fiji.plugin.util.GUIHelper;
import net.preibisch.mvrecon.fiji.plugin.util.PluginHelper;
import net.preibisch.mvrecon.fiji.spimdata.EmptyEntity;
import net.preibisch.mvrecon.fiji.spimdata.NamePattern;
import net.preibisch.mvrecon.fiji.spimdata.imgloaders.splitting.SplitViewerImgLoader;
import util.URITools;

/**
Expand Down Expand Up @@ -153,9 +156,32 @@ public GenericLoadParseQueryXML( final X io )
*/
public AS getData()
{
final URI uri = getXMLURI();
final L loader = data.getSequenceDescription().getImgLoader();

if ( !isPrefetched && ( URITools.isS3( uri ) || URITools.isGC( uri ) ) )
final URI uri;

if ( N5ImageLoader.class.isInstance( loader ) )
{
uri = ((N5ImageLoader)loader).getN5URI();
}
else if ( SplitViewerImgLoader.class.isInstance( loader ) )
{
BasicImgLoader underlyingLoader = loader;

while ( SplitViewerImgLoader.class.isInstance( underlyingLoader = ((SplitViewerImgLoader)underlyingLoader ).getUnderlyingImgLoader() ) ) {}


if ( N5ImageLoader.class.isInstance( underlyingLoader ) )
uri = ((N5ImageLoader)underlyingLoader).getN5URI();
else
uri = null;
}
else
{
uri = null;
}

if ( uri != null && !isPrefetched && ( URITools.isS3( uri ) || URITools.isGC( uri ) ) )
{
IOFunctions.println( "Setting cloud fetcher threads for '" + uri + "' to: " + URITools.cloudThreads );
URITools.setNumFetcherThreads( data.getSequenceDescription().getImgLoader(), URITools.cloudThreads );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.util.HashMap;

import bdv.ViewerImgLoader;
import mpicbg.spim.data.sequence.ImgLoader;
import mpicbg.spim.data.sequence.SequenceDescription;
import mpicbg.spim.data.sequence.SetupImgLoader;
Expand Down Expand Up @@ -72,6 +73,11 @@ public SplitImgLoader(
return getSplitSetupImgLoader( underlyingImgLoader, new2oldSetupId.get( setupId ), setupId, newSetupId2Interval.get( setupId ) );
}

public ImgLoader getUnderlyingImgLoader()
{
return underlyingImgLoader;
}

private final synchronized < T > SplitSetupImgLoader< ? > getSplitSetupImgLoader( final ImgLoader underlyingImgLoader, final int oldSetupId, final int newSetupId, final Interval interval )
{
SplitSetupImgLoader< ? > sil = splitSetupImgLoaders.get( newSetupId );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.util.HashMap;

import mpicbg.spim.data.sequence.ImgLoader;
import mpicbg.spim.data.sequence.MultiResolutionImgLoader;
import mpicbg.spim.data.sequence.MultiResolutionSetupImgLoader;
import mpicbg.spim.data.sequence.SequenceDescription;
Expand Down Expand Up @@ -72,6 +73,11 @@ public SplitMultiResolutionImgLoader(
return getSplitSetupImgLoader( underlyingImgLoader, new2oldSetupId.get( setupId ), setupId, newSetupId2Interval.get( setupId ) );
}

public MultiResolutionImgLoader getUnderlyingImgLoader()
{
return underlyingImgLoader;
}

private final synchronized < T > SplitMultiResolutionSetupImgLoader< ? > getSplitSetupImgLoader( final MultiResolutionImgLoader underlyingImgLoader, final int oldSetupId, final int newSetupId, final Interval interval )
{
SplitMultiResolutionSetupImgLoader< ? > sil = splitSetupImgLoaders.get( newSetupId );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ private final synchronized SplitViewerSetupImgLoader<?,?> createNewSetupImgLoade
return new SplitViewerSetupImgLoader<>( Cast.unchecked( setupImgLoader ), interval );
}

public ViewerImgLoader getUnderlyingImgLoader()
{
return underlyingImgLoader;
}

public Future< Void > prefetch( final int parallelism )
{
if ( N5ImageLoader.class.isInstance( underlyingImgLoader ) )
Expand Down

0 comments on commit fbe8957

Please sign in to comment.