Skip to content

Commit

Permalink
fix bug when setting up N5CloudImageLoader >> if it is not instantiat…
Browse files Browse the repository at this point in the history
…ed from XML it needs the N5Reader instance. Otherwise it tries to open it from a File, which will fail
  • Loading branch information
StephanPreibisch committed Sep 25, 2024
1 parent 68a4da7 commit 28aa949
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,21 @@ public static SpimData2 resaveN5(
myPool.shutdown();
try { myPool.awaitTermination( Long.MAX_VALUE, TimeUnit.HOURS ); } catch (InterruptedException e) { e.printStackTrace(); }

n5Writer.close();

if ( format == StorageFormat.N5 && URITools.isFile( n5Params.n5URI )) // local file
{
sdReduced.getSequenceDescription().setImgLoader( new N5ImageLoader( n5Params.n5URI, sdReduced.getSequenceDescription() ) );
n5Writer.close();
}
else if ( format == StorageFormat.N5 ) // some cloud location
sdReduced.getSequenceDescription().setImgLoader( new N5CloudImageLoader( null, n5Params.n5URI, sdReduced.getSequenceDescription() ) );
{
sdReduced.getSequenceDescription().setImgLoader( new N5CloudImageLoader( n5Writer, n5Params.n5URI, sdReduced.getSequenceDescription() ) );
}
else if ( format == StorageFormat.HDF5 )
{
sdReduced.getSequenceDescription().setImgLoader( new Hdf5ImageLoader( new File( URITools.removeFilePrefix( n5Params.n5URI ) ), null, sdReduced.getSequenceDescription() ) );
n5Writer.close();
}
else
throw new RuntimeException( "There is no ImgLoader available for " + format + ". Data is resaved, but we will not be able to load it" );

Expand Down

0 comments on commit 28aa949

Please sign in to comment.