Skip to content

Commit

Permalink
work-around for an a little bit annoying behavior in N5ImageLoader @t…
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed Oct 11, 2024
1 parent e61dfc9 commit 691e863
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,20 @@ public static SpimData2 resaveN5(

if ( format == StorageFormat.N5 && URITools.isFile( n5Params.n5URI )) // local file
{
sdReduced.getSequenceDescription().setImgLoader( new N5ImageLoader( n5Params.n5URI, sdReduced.getSequenceDescription() ) );
File f;
try
{
// might trigger Exception in thread "main" java.lang.IllegalArgumentException: URI is not absolute
f = new File( n5Params.n5URI );
}
catch ( Exception e )
{
f = new File( n5Params.n5URI.toString() );
}

// we need to init with File and not with URI, since otherwise the N5ImageLoader will trigger the exception above if this object is re-used
// this seems to not matter when opening directly from disc...
sdReduced.getSequenceDescription().setImgLoader( new N5ImageLoader( f, sdReduced.getSequenceDescription() ) );
n5Writer.close();
}
else if ( format == StorageFormat.N5 ) // some cloud location
Expand Down

0 comments on commit 691e863

Please sign in to comment.