Skip to content

Commit

Permalink
Light Refactor
Browse files Browse the repository at this point in the history
Make the code slightly more clean, removing unused variables.
  • Loading branch information
AvocadoMoon committed Oct 3, 2023
1 parent b336363 commit 0b4cd4e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 34 deletions.
27 changes: 2 additions & 25 deletions src/main/java/org/vcell/vcellfiji/N5ImageHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -112,9 +104,6 @@ public void displayN5Results(ArrayList<String> 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:
Expand Down Expand Up @@ -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<String, String> credentials, HashMap<String, String> endpoint){
AmazonS3ClientBuilder s3ClientBuilder = AmazonS3ClientBuilder.standard();
URI uri = URI.create(url);
Expand Down Expand Up @@ -221,6 +202,7 @@ public void createS3Client(String url, HashMap<String, String> credentials, Hash
return;
}

//creds not null, but region is
this.s3Client = s3ClientBuilder.withRegion(defaultRegion).build();
}

Expand All @@ -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();

}
}
6 changes: 0 additions & 6 deletions src/main/java/org/vcell/vcellfiji/UI/VCellGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 0 additions & 3 deletions src/test/java/org/vcell/vcellfiji/N5ImageHandlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/

public class N5ImageHandlerTest {

private final String n5FileName = "nfive/test_image.n5";

private File getTestResourceFiles(String filePath){
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0b4cd4e

Please sign in to comment.