From c2f71e3464a0159670847a57d2a6434bd23a81bf Mon Sep 17 00:00:00 2001
From: Valentin Debarnot <valentin.debarnot@gmail.com>
Date: Mon, 13 Nov 2023 10:55:01 +0100
Subject: [PATCH] fixing path?\

---
 src/src/EigenPSF_Manager.java                  |  4 ++--
 src/src/eigenpsf/Params.java                   |  6 +++---
 src/src/eigenpsf/lib/Loader.java               |  6 +++---
 src/src/eigenpsf/processing/SIFTDetection.java | 16 ++++++++--------
 src/src/eigenpsf/project/ProjectTable.java     |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/src/EigenPSF_Manager.java b/src/src/EigenPSF_Manager.java
index 0d49ee3..7511b09 100644
--- a/src/src/EigenPSF_Manager.java
+++ b/src/src/EigenPSF_Manager.java
@@ -27,8 +27,8 @@ public class EigenPSF_Manager implements PlugIn {
 			@Override
 			public void run() {
 				String pathUtils = EigenPSF_Manager.class.getProtectionDomain().getCodeSource().getLocation().getPath();
-				int idx = pathUtils.lastIndexOf('/');
-				pathUtils =pathUtils.substring(0,idx+1) + "EigenPSFExt_Utils/";
+				int idx = pathUtils.lastIndexOf(File.separator);
+				pathUtils =pathUtils.substring(0,idx+1) + "EigenPSFExt_Utils"+File.separator;
 				//File file1 = new File(pathUtils + "LogC.txt");
 				//File file2 = new File(pathUtils + "LogJava.txt");
 				try {
diff --git a/src/src/eigenpsf/Params.java b/src/src/eigenpsf/Params.java
index 2e83f62..612b876 100644
--- a/src/src/eigenpsf/Params.java
+++ b/src/src/eigenpsf/Params.java
@@ -24,15 +24,15 @@ import eigenpsf.stack.ZStack;
 public class Params {
 	
 	// Handle the paths to load basis, should be done with internet link at the end.
-	public static String[] PathToGitList = {"/home/esoubies/Bureau/","/home/valentin/Documents/", "/Users/dsage/git/"};
+	//public static String[] PathToGitList = {"/home/esoubies/Bureau/","/home/valentin/Documents/", "/Users/dsage/git/"};
 
 	public static int dim = 2;					       // dimension of the problem	
 	public static int[] psf_visible_width = {17,17,1}; // estimated essential support of the PSF (should be forced to be odd)
 	public static double factorDiamBack = 2;       // factor such that the local background of a bead is estimated on a patch of size factorDiamBack*support 
 	
 	public static double thresholdDetection = 0.5; // threshold parameter in [0,1]
-	public static String PathToSingularValues ="superresolved_psf_estimation/code/Outputs/Subspaces/Gaussian"+dim+"D_singularvalues.csv";
-	public static String PathToSbasis ="superresolved_psf_estimation/code/Outputs/Subspaces/Gaussian"+dim+"D_sbasis_scale";
+	//public static String PathToSingularValues ="superresolved_psf_estimation/code/Outputs/Subspaces/Gaussian"+dim+"D_singularvalues.csv";
+	//public static String PathToSbasis ="superresolved_psf_estimation/code/Outputs/Subspaces/Gaussian"+dim+"D_sbasis_scale";
 
 	public static int Nscale = 3; 				   // number of precomputed scaled basis, set to 1 to compute it automatically
 	public static int NbasisVectSIFT = 3; 		   // number of basis used to compute vectorial SIFT
diff --git a/src/src/eigenpsf/lib/Loader.java b/src/src/eigenpsf/lib/Loader.java
index 95a4d52..242c855 100644
--- a/src/src/eigenpsf/lib/Loader.java
+++ b/src/src/eigenpsf/lib/Loader.java
@@ -104,7 +104,7 @@ public class Loader {
 	}*/
 	
 	public static void searchSIFTBasis(Project project) {
-		File f = new File(project.pathUtils + "SIFTbasis/");
+		File f = new File(project.pathUtils + "SIFTbasis"+File.separator);
 		if (f.exists() && f.isDirectory()) {
 		   project.setStatusSIFTBasis(true);
 		} else {
@@ -127,9 +127,9 @@ public class Loader {
 		}
 		if (project.isSIFTbasis) {
 			// TODO : loop over the types of Basis + Menu in the GUI to select which ?
-			File directory=new File(project.pathUtils + "SIFTbasis/Gaussian/2D");
+			File directory=new File(project.pathUtils + "SIFTbasis"+File.separator+"Gaussian"+File.separator+"2D");
 		    Params.NbasisVectSIFT_max2D =directory.list().length-1;
-		    directory=new File(project.pathUtils + "SIFTbasis/Gaussian/3D");
+		    directory=new File(project.pathUtils + "SIFTbasis"+File.separator+"Gaussian"+File.separator+"3D");
 		    Params.NbasisVectSIFT_max3D =directory.list().length-1;
 		}
 
diff --git a/src/src/eigenpsf/processing/SIFTDetection.java b/src/src/eigenpsf/processing/SIFTDetection.java
index ffec69e..73a3616 100644
--- a/src/src/eigenpsf/processing/SIFTDetection.java
+++ b/src/src/eigenpsf/processing/SIFTDetection.java
@@ -56,12 +56,12 @@ public class SIFTDetection extends AbstractDetection {
 
 		// Scale space maxima
 		// load basis
-		String PathToGit = " ";
-		for (int k=0; k<Params.PathToGitList.length; k++) {
-			Path folder = Paths.get(Params.PathToGitList[k]);
-			if (Files.exists(folder))
-				PathToGit=Params.PathToGitList[k];
-		}
+		//String PathToGit = " ";
+		//for (int k=0; k<Params.PathToGitList.length; k++) {
+		//	Path folder = Paths.get(Params.PathToGitList[k]);
+		//	if (Files.exists(folder))
+		//		PathToGit=Params.PathToGitList[k];
+		//}
 		// -- Old version when trying to do a list of Dict with different scale to avoid recomputing the scales
 		/*String PathToSingularValues = PathToGit+Params.PathToSingularValues;
 		List<Dict> listDict= new ArrayList<Dict>();
@@ -71,8 +71,8 @@ public class SIFTDetection extends AbstractDetection {
 			listDict.add(sbasis);
 		}*/
 		//-----------------	
-		String PathToSingularValues = project.pathUtils + "SIFTbasis/Gaussian/" + Params.dim + "D/singularvalues.csv";
-		String PathToSbasis = project.pathUtils + "SIFTbasis/Gaussian/" + Params.dim + "D/Elem_";
+		String PathToSingularValues = project.pathUtils + "SIFTbasis"+File.separator+"Gaussian"+File.separator + Params.dim + "D"+File.separator+"singularvalues.csv";
+		String PathToSbasis = project.pathUtils + "SIFTbasis"+File.separator+"Gaussian" + File.separator + Params.dim + "D"+File.separator+"Elem_";
 		Dict sbasis = new Dict(PathToSbasis,PathToSingularValues,Params.dim,Params.NbasisVectSIFT);
 
 		// -- Old version when trying to do a list of Dict with different scale to avoid recomputing the scales
diff --git a/src/src/eigenpsf/project/ProjectTable.java b/src/src/eigenpsf/project/ProjectTable.java
index 833abe2..1bd2ca7 100644
--- a/src/src/eigenpsf/project/ProjectTable.java
+++ b/src/src/eigenpsf/project/ProjectTable.java
@@ -219,7 +219,7 @@ public class ProjectTable extends CustomizedTable implements MouseListener {
 			setToolTipText(tip);
 			
 			try {
-					Image image = new IconLoader().get("/resources/" + text + ".png");
+					Image image = new IconLoader().get(File.separator+"resources"+File.separator + text + ".png");
 					Image scaled = image.getScaledInstance(22, 22, Image.SCALE_SMOOTH);
 					icon = new ImageIcon(scaled);
 					setIcon(icon);
-- 
GitLab