Skip to content

Commit 10fc0ba

Browse files
fix a series of URI-related code that can cause issues on Windows
1 parent 09057da commit 10fc0ba

File tree

22 files changed

+49
-36
lines changed

22 files changed

+49
-36
lines changed

src/main/java/net/preibisch/mvrecon/fiji/datasetmanager/FileListDatasetDefinition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,8 +1296,8 @@ else if (resaveAsN5 || resaveAsOMEZARR )
12961296

12971297
final SequenceDescription sd = data.getSequenceDescription();
12981298

1299-
final URI xmlURI = URI.create( URITools.appendName(chosenPathXMLURI, xmlFileName ) );
1300-
final URI n5DatasetURI = URI.create( URITools.appendName(chosenPathDataURI, xmlFileName.subSequence( 0, xmlFileName.length() - 4 ) + (resaveAsN5 ? ".n5" : ".ome.zarr" ) ) );
1299+
final URI xmlURI = URITools.toURI( URITools.appendName(chosenPathXMLURI, xmlFileName ) );
1300+
final URI n5DatasetURI = URITools.toURI( URITools.appendName(chosenPathDataURI, xmlFileName.subSequence( 0, xmlFileName.length() - 4 ) + (resaveAsN5 ? ".n5" : ".ome.zarr" ) ) );
13011301

13021302
IOFunctions.println( (resaveAsN5 ? "N5" : "OME-ZARR" ) + " path: " + n5DatasetURI );
13031303

src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import net.preibisch.mvrecon.fiji.spimdata.XmlIoSpimData2;
4848
import net.preibisch.mvrecon.fiji.spimdata.explorer.ViewSetupExplorer;
4949
import net.preibisch.mvrecon.process.splitting.SplittingTools;
50+
import util.URITools;
5051

5152
public class Split_Views implements PlugIn
5253
{
@@ -219,7 +220,7 @@ public static boolean split( final SpimData2 data, final URI filePath )
219220
return false;
220221
}
221222

222-
return split( data, URI.create( saveAs ), new long[]{ sx, sy, sz }, new long[]{ ox, oy, oz }, minStepSize, assignIllum, optimize, addIPs, density, minPoints, maxPoints, error, exclusionRadius, choice == 0 );
223+
return split( data, URITools.toURI( saveAs ), new long[]{ sx, sy, sz }, new long[]{ ox, oy, oz }, minStepSize, assignIllum, optimize, addIPs, density, minPoints, maxPoints, error, exclusionRadius, choice == 0 );
223224
}
224225

225226
public static Pair< HashMap< String, Integer >, long[] > collectImageSizes( final AbstractSpimData< ? > data )

src/main/java/net/preibisch/mvrecon/fiji/plugin/interactive/MultiResolutionSource.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import net.preibisch.mvrecon.headless.boundingbox.TestBoundingBox;
5858
import net.preibisch.mvrecon.process.deconvolution.DeconViews;
5959
import net.preibisch.mvrecon.process.fusion.FusionTools;
60+
import util.URITools;
6061

6162
public class MultiResolutionSource implements Source< VolatileFloatType >
6263
{
@@ -141,9 +142,9 @@ public static void main( String[] args ) throws SpimDataException
141142

142143
// load drosophila
143144
if ( System.getProperty("os.name").toLowerCase().contains( "mac" ) )
144-
spimData = new XmlIoSpimData2().load( URI.create( "/Users/preibischs/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml" ) );
145+
spimData = new XmlIoSpimData2().load( URITools.toURI( "/Users/preibischs/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml" ) );
145146
else
146-
spimData = new XmlIoSpimData2().load( URI.create( "/home/steffi/Desktop/HisYFP-SPIM/dataset.xml" ) );
147+
spimData = new XmlIoSpimData2().load( URITools.toURI( "/home/steffi/Desktop/HisYFP-SPIM/dataset.xml" ) );
147148

148149
final BoundingBox boundingBox = TestBoundingBox.getBoundingBox( spimData, "My Bounding Box" );
149150

src/main/java/net/preibisch/mvrecon/fiji/plugin/queryXML/GenericLoadParseQueryXML.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public boolean queryXML(
374374
if ( xmlURI.trim().length() == 0 || xmlURI.trim().toLowerCase().equals( "beads" ) ||
375375
xmlURI.trim().toLowerCase().equals( "fractal" ) || xmlURI.trim().toLowerCase().equals( "define" ) )
376376
{
377-
uri = URI.create( xmlURI );
377+
uri = URI.create( xmlURI ); // URI.create is necessary here
378378

379379
this.data = null;
380380
this.attributes = null;

src/main/java/net/preibisch/mvrecon/fiji/spimdata/XmlIoSpimData2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public XmlIoSpimData2()
104104
public void save( final SpimData2 spimData, String xmlPath ) throws SpimDataException
105105
{
106106
// old loading code with copying files
107-
this.lastURI = URITools.toURI( xmlPath ); //URI.create( xmlPath );
107+
this.lastURI = URITools.toURI( xmlPath );
108108

109109
try
110110
{

src/main/java/net/preibisch/mvrecon/fiji/spimdata/interestpoints/InterestPointsN5.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public boolean saveInterestPoints( final boolean forceWrite )
148148

149149
try
150150
{
151-
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URI.create( URITools.appendName( baseDir, baseN5 ) ) );
151+
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URITools.toURI( URITools.appendName( baseDir, baseN5 ) ) );
152152

153153
/*
154154
if ( URITools.isFile( baseDir ) )
@@ -248,7 +248,7 @@ public boolean saveCorrespondingInterestPoints(boolean forceWrite)
248248

249249
try
250250
{
251-
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URI.create( URITools.appendName( baseDir, baseN5 ) ) );
251+
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URITools.toURI( URITools.appendName( baseDir, baseN5 ) ) );
252252

253253
/*
254254
if ( URITools.isFile( baseDir ) )
@@ -365,7 +365,7 @@ protected boolean loadInterestPoints()
365365
try
366366
{
367367

368-
final N5Reader n5 = URITools.instantiateN5Reader( StorageFormat.N5, URI.create( URITools.appendName( baseDir, baseN5 ) ) );
368+
final N5Reader n5 = URITools.instantiateN5Reader( StorageFormat.N5, URITools.toURI( URITools.appendName( baseDir, baseN5 ) ) );
369369

370370
/*
371371
if ( URITools.isFile( baseDir ) )
@@ -474,7 +474,7 @@ protected boolean loadCorrespondences()
474474
{
475475
try
476476
{
477-
final N5Reader n5 = URITools.instantiateN5Reader( StorageFormat.N5, URI.create( URITools.appendName( baseDir, baseN5 ) ) );;
477+
final N5Reader n5 = URITools.instantiateN5Reader( StorageFormat.N5, URITools.toURI( URITools.appendName( baseDir, baseN5 ) ) );;
478478

479479
/*
480480
if ( URITools.isFile( baseDir ) )
@@ -601,7 +601,7 @@ public boolean deleteInterestPoints()
601601
{
602602
try
603603
{
604-
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URI.create( URITools.appendName( baseDir, baseN5 ) ) );
604+
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URITools.toURI( URITools.appendName( baseDir, baseN5 ) ) );
605605

606606
/*
607607
if ( URITools.isFile( baseDir ) )
@@ -631,7 +631,7 @@ public boolean deleteCorrespondingInterestPoints()
631631
{
632632
try
633633
{
634-
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URI.create( URITools.appendName( baseDir, baseN5 ) ) );
634+
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URITools.toURI( URITools.appendName( baseDir, baseN5 ) ) );
635635

636636
/*
637637
if ( URITools.isFile( baseDir ) )

src/main/java/net/preibisch/mvrecon/fiji/spimdata/pointspreadfunctions/PointSpreadFunction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public synchronized Img< FloatType > load()
126126
else
127127
{
128128
// load the .n5
129-
final N5Reader n5Reader = URITools.instantiateN5Reader( StorageFormat.N5, URI.create( URITools.appendName( xmlBasePath, subPath ) ) );
129+
final N5Reader n5Reader = URITools.instantiateN5Reader( StorageFormat.N5, URITools.toURI( URITools.appendName( xmlBasePath, subPath ) ) );
130130
final Img<FloatType> img = Cast.unchecked( N5Utils.open( n5Reader, file ) );
131131

132132
n5Reader.close();
@@ -140,7 +140,7 @@ public synchronized boolean save()
140140
if ( img == null )
141141
return false;
142142

143-
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URI.create( URITools.appendName( xmlBasePath, subPath ) ) );
143+
final N5Writer n5Writer = URITools.instantiateN5Writer( StorageFormat.N5, URITools.toURI( URITools.appendName( xmlBasePath, subPath ) ) );
144144

145145
if ( n5Writer.datasetExists( file ) )
146146
n5Writer.remove( file );

src/main/java/net/preibisch/mvrecon/headless/boundingbox/TestRealDataBoundingBox.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import net.preibisch.mvrecon.process.boundingbox.BoundingBoxMinFilterThreshold;
4343
import net.preibisch.mvrecon.process.deconvolution.DeconViews;
4444
import net.preibisch.mvrecon.process.fusion.FusionTools;
45+
import util.URITools;
4546

4647
public class TestRealDataBoundingBox
4748
{
@@ -53,7 +54,7 @@ public static void main( String[] args ) throws SpimDataException
5354
final ExecutorService service = DeconViews.createExecutorService();
5455

5556
// test a real scenario
56-
final SpimData2 spimData = new XmlIoSpimData2().load( URI.create( "/Users/spreibi/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml" ) );
57+
final SpimData2 spimData = new XmlIoSpimData2().load( URITools.toURI( "/Users/spreibi/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml" ) );
5758

5859
final List< ViewId > viewIds = new ArrayList< ViewId >();
5960
viewIds.addAll( spimData.getSequenceDescription().getViewDescriptions().values() );

src/main/java/net/preibisch/mvrecon/headless/deconvolution/TestDeconvolution.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
import net.preibisch.mvrecon.process.interestpointregistration.pairwise.constellation.grouping.Group;
7070
import net.preibisch.mvrecon.process.psf.PSFCombination;
7171
import net.preibisch.simulation.imgloader.SimulatedBeadsImgLoader;
72+
import util.URITools;
7273

7374
public class TestDeconvolution
7475
{
@@ -84,7 +85,7 @@ public static void main( String[] args ) throws SpimDataException
8485
groups = Group.toGroups( spimData.getSequenceDescription().getViewDescriptions().values() );
8586

8687
// load drosophila
87-
spimData = new XmlIoSpimData2().load( URI.create( "/Users/spreibi/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml" ) );
88+
spimData = new XmlIoSpimData2().load( URITools.toURI( "/Users/spreibi/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml" ) );
8889
groups = selectViews( spimData.getSequenceDescription().getViewDescriptions().values() );
8990
groups = Group.toGroups( spimData.getSequenceDescription().getViewDescriptions().values() );
9091

src/main/java/net/preibisch/mvrecon/headless/deconvolution/TestDeconvolutionMul.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
import net.preibisch.mvrecon.process.fusion.transformed.weightcombination.CombineWeightsRandomAccessibleInterval.CombineType;
7373
import net.preibisch.mvrecon.process.interestpointregistration.pairwise.constellation.grouping.Group;
7474
import net.preibisch.mvrecon.process.psf.PSFCombination;
75+
import util.URITools;
7576

7677
public class TestDeconvolutionMul
7778
{
@@ -80,7 +81,7 @@ public static void main( String[] args ) throws SpimDataException
8081
new ImageJ();
8182

8283
// load drosophila
83-
SpimData2 spimData = new XmlIoSpimData2().load( URI.create( "Z:/Betzig/dataset.xml" ) );
84+
SpimData2 spimData = new XmlIoSpimData2().load( URITools.toURI( "Z:/Betzig/dataset.xml" ) );
8485
Collection< Group< ViewDescription > >groups = Group.toGroups( spimData.getSequenceDescription().getViewDescriptions().values() );
8586

8687
BoundingBox bb = BoundingBoxTools.maximalBoundingBox( spimData, new ArrayList<>( spimData.getSequenceDescription().getViewDescriptions().values() ), "All Views" );

0 commit comments

Comments
 (0)