From 0b4cd4e86c808d1b8d3aa316e89dab75536fed31 Mon Sep 17 00:00:00 2001 From: Ezequiel Valencia Date: Tue, 3 Oct 2023 15:13:07 -0400 Subject: [PATCH] Light Refactor Make the code slightly more clean, removing unused variables. --- .../org/vcell/vcellfiji/N5ImageHandler.java | 27 ++----------------- .../java/org/vcell/vcellfiji/UI/VCellGUI.java | 6 ----- .../vcell/vcellfiji/N5ImageHandlerTest.java | 3 --- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/main/java/org/vcell/vcellfiji/N5ImageHandler.java b/src/main/java/org/vcell/vcellfiji/N5ImageHandler.java index 84cf8fe..d28d167 100644 --- a/src/main/java/org/vcell/vcellfiji/N5ImageHandler.java +++ b/src/main/java/org/vcell/vcellfiji/N5ImageHandler.java @@ -32,14 +32,6 @@ import java.util.Arrays; import java.util.HashMap; -// Command plugins -/* TODO: - Security check for the S3Client builder, there seems to be an encrypted version of it and that should be checked - Test cases for handling all cases regarding - - - - */ /* Able to open N5 files locally, display the datasets that can be chosen from it, and open the datasets within ImageJ. @@ -112,9 +104,6 @@ public void displayN5Results(ArrayList datasetList){ public ImagePlus getImgPlusFromN5File(String selectedDataset, N5Reader n5Reader) throws IOException { -// N5CosemMetadataParser metadataParser = new N5CosemMetadataParser(); -// CosemToImagePlus cosemToImagePlus = new CosemToImagePlus(); - // Theres definitly a better way to do this, I trie using a variable to change the cached cells first parameter type but it didn't seem to work :/ switch (n5Reader.getDatasetAttributes(selectedDataset).getDataType()){ case UINT8: @@ -179,15 +168,7 @@ public void loadN5Dataset(String selectedDataset) throws IOException { } } - // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-region-selection.html - // Chain of handling region is what gets set by client builder - // AWS_REGION Environmental variable on computer - // The AWS default profile on the computer - // Use Amazon Elastic computing instance metadata to determine region - // Does this mean that region is only known for buckets hosted on Amazons servers? Is that why the error is thrown? Should I use the EC2 builder to find the region? - // Throw error - - //Can make it so that our bucket links contain the region in it, making it significantly easier to determine it + //When creating client's try to make one for an Amazon link, otherwise use our custom url scheme public void createS3Client(String url, HashMap credentials, HashMap endpoint){ AmazonS3ClientBuilder s3ClientBuilder = AmazonS3ClientBuilder.standard(); URI uri = URI.create(url); @@ -221,6 +202,7 @@ public void createS3Client(String url, HashMap credentials, Hash return; } + //creds not null, but region is this.s3Client = s3ClientBuilder.withRegion(defaultRegion).build(); } @@ -246,9 +228,4 @@ public File getSelectedLocalFile() { return selectedLocalFile; } - public static void main(String[] args) { -// new N5ImageHandler().getS3N5DatasetList("s3://janelia-cosem-datasets/jrc_macrophage-2/jrc_macrophage-2.n5", null, null); - new N5ImageHandler().run(); - - } } diff --git a/src/main/java/org/vcell/vcellfiji/UI/VCellGUI.java b/src/main/java/org/vcell/vcellfiji/UI/VCellGUI.java index a4f74bb..eb5b40b 100644 --- a/src/main/java/org/vcell/vcellfiji/UI/VCellGUI.java +++ b/src/main/java/org/vcell/vcellfiji/UI/VCellGUI.java @@ -22,12 +22,6 @@ public class VCellGUI extends JFrame { public VCellGUI() { jFrame = this; localFileDialog = new JFileChooser(); -// try { -// UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); -// SwingUtilities.updateComponentTreeUI(jFrame); -// } catch (Exception e) { -// throw new RuntimeException(e); -// } this.setTitle("VCell Manager"); diff --git a/src/test/java/org/vcell/vcellfiji/N5ImageHandlerTest.java b/src/test/java/org/vcell/vcellfiji/N5ImageHandlerTest.java index 145fd9d..92f9a88 100644 --- a/src/test/java/org/vcell/vcellfiji/N5ImageHandlerTest.java +++ b/src/test/java/org/vcell/vcellfiji/N5ImageHandlerTest.java @@ -25,7 +25,6 @@ */ public class N5ImageHandlerTest { - private final String n5FileName = "nfive/test_image.n5"; private File getTestResourceFiles(String filePath){ @@ -66,8 +65,6 @@ public void testS3Client() throws IOException { credentials.put("AccessKey", "jj"); credentials.put("SecretKey", "jj"); - String testBucketName = "nfive"; - final String s3KeyPath = "s3://" + testBucketName + "/test_image.n5"; final String s3ProxyURL = "/" + this.n5FileName; N5ImageHandler n5ImageHandler = new N5ImageHandler();