diff --git a/view-simulation-results/src/main/java/org/vcell/N5/N5ImageHandler.java b/view-simulation-results/src/main/java/org/vcell/N5/N5ImageHandler.java
index 82d8bd8..3a9a14e 100644
--- a/view-simulation-results/src/main/java/org/vcell/N5/N5ImageHandler.java
+++ b/view-simulation-results/src/main/java/org/vcell/N5/N5ImageHandler.java
@@ -1,6 +1,7 @@
package org.vcell.N5;
+import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.scijava.command.Command;
@@ -42,6 +43,13 @@ public void run() {
setExampleJSONData();
// N5ImageHandler.logService.setLevel(LogService.DEBUG);
exportTable.displayExportTable();
+ Thread thread = new Thread(() -> {
+ // For some reason getting a standard client takes three seconds.
+ // So create one upon initialization, while the user is focused on the GUI
+ // and by the time they open an Image it's already loaded.
+ SimResultsLoader.s3ClientBuilder = AmazonS3ClientBuilder.standard();
+ });
+ thread.start();
}
public static Logger getLogger(Class classToLog){
diff --git a/view-simulation-results/src/main/java/org/vcell/N5/SimResultsLoader.java b/view-simulation-results/src/main/java/org/vcell/N5/SimResultsLoader.java
index f0804dc..f7d21d0 100644
--- a/view-simulation-results/src/main/java/org/vcell/N5/SimResultsLoader.java
+++ b/view-simulation-results/src/main/java/org/vcell/N5/SimResultsLoader.java
@@ -9,7 +9,6 @@
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.google.gson.GsonBuilder;
import ij.ImagePlus;
-import ij.plugin.Duplicator;
import net.imglib2.cache.img.CachedCellImg;
import net.imglib2.img.display.imagej.ImageJFunctions;
import net.imglib2.type.numeric.real.DoubleType;
@@ -24,6 +23,7 @@
import org.janelia.saalfeldlab.n5.s3.N5AmazonS3Reader;
import org.scijava.log.Logger;
import org.vcell.N5.UI.N5ExportTable;
+import org.vcell.N5.UI.ImageIntoMemory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
@@ -49,10 +49,12 @@ public class SimResultsLoader {
private String s3ObjectKey;
private URI uri;
private String dataSetChosen;
- private String userSetFileName = null;
+ public String userSetFileName = null;
private static final String defaultS3Region = "site2-low";
+ private N5Reader n5AmazonS3Reader;
private static final Logger logger = N5ImageHandler.getLogger(SimResultsLoader.class);
+ public static AmazonS3ClientBuilder s3ClientBuilder;
public SimResultsLoader(){
@@ -70,10 +72,8 @@ public SimResultsLoader(String stringURI, String userSetFileName){
}
}
- void createS3Client(){
+ void createS3ClientAndReader(){
logger.debug("Creating S3 Client with url: " + uri);
- AmazonS3ClientBuilder s3ClientBuilder = AmazonS3ClientBuilder.standard();
-
if (uri.getHost().equals("minikube.remote") || uri.getHost().equals("minikube.island")){
SSLContext sslContext = null;
try {
@@ -104,6 +104,8 @@ public boolean verify(String hostname, SSLSession session) {
s3ClientBuilder.withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()));
s3ClientBuilder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(uri.getScheme() + "://" + uri.getAuthority(), defaultS3Region));
this.s3Client = s3ClientBuilder.build();
+ S3KeyValueAccess amazonS3KeyValueAccess = new S3KeyValueAccess(s3Client, bucketName, false);
+ n5AmazonS3Reader = new N5KeyValueReader(amazonS3KeyValueAccess, s3ObjectKey, new GsonBuilder(), false);
}
/**
@@ -112,9 +114,7 @@ public boolean verify(String hostname, SSLSession session) {
don't originate from amazon this is not a format we can possibly mimic, so we have to use path based buckets because
it's the fallback style chosen by the N5 libraries if standard format is unavailable.
*/
- ImagePlus getImgPlusFromN5File() throws IOException {
- S3KeyValueAccess amazonS3KeyValueAccess = new S3KeyValueAccess(s3Client, bucketName, false);
- N5KeyValueReader n5AmazonS3Reader = new N5KeyValueReader(amazonS3KeyValueAccess, s3ObjectKey, new GsonBuilder(), false);
+ public ImagePlus getImgPlusFromN5File() throws IOException {
// N5AmazonS3Reader n5AmazonS3Reader = new N5AmazonS3Reader(s3Client, bucketName, "/" + s3ObjectKey);
long start = System.currentTimeMillis();
@@ -155,23 +155,10 @@ private void setUnits(N5Reader n5Reader, ImagePlus imagePlus){
}
}
-// private static ImagePlus getSetOfImage(ImagePlus imagePlus){
-// int startZ = 0, startTime = 0, startChannel = 0;
-// int endZ = 5, endTime = 2, endChannel = 1;
-// ImagePlus newImage = IJ.createHyperStack(imagePlus.getTitle() + " In Memory", imagePlus.getWidth(),
-// imagePlus.getHeight(), endChannel, endZ, endTime, imagePlus.getBitDepth());
-// for (startChannel = startChannel; startChannel < endChannel; startChannel++){
-// for (startZ = startZ; startZ < endZ; startZ++){
-// for (startTime = startTime; startTime < endTime; startTime++){
-// int index = imagePlus.getStackIndex(startChannel, startZ, startTime);
-// newImage.getImageStack().addSlice("" + startTime + "" + startChannel + "" + startZ,
-// imagePlus.getStack().getProcessor(index), index);
-// }
-// }
-// }
-// newImage.setDimensions(endChannel, endZ, endTime);
-// return newImage;
-// }
+ public ArrayList getN5Dimensions(){
+ return n5AmazonS3Reader.getAttribute(dataSetChosen, "dimensions", ArrayList.class);
+ }
+
public static void openN5FileDataset(ArrayListIntro
stored remotely on VCell servers, allowing applications such as ImageJ
to directly access the results of these simulations and perform analyses.
- Simulation solvers generating 2- or 3-dimensional spatial - domains can be visualized in ImageJ using this plugin. - Spatial dimensions and time directly correspond to fields within an ImageJ - image. The image's channels depict different variables within a simulation. + Virtual Cell has special techniques for spatial simulation results so that they are visually compelling while accurate to their + source data. Those automatic techniques are not implemented within this plugin, so if an export is visually different + from VCell's please go to Image -> Adjust -> Brightness/Contrast, and adjust it to a point where it is similar.
-- Each N5 store is a direct mapping to a VCell simulation, and contains one or more - datasets. Each dataset holds numerical data and metadata corresponding to an Image in ImageJ. - Each N5 store is fully identified through its N5 URL which can be shared and opened by other applications - which support the N5 format. -
-For VCell exports generated from your local VCell installation:
+Either, Click the recent export button.
+XYZ: The XYZ dimensions directly correspond to the simulations XYZ.
+Channel: The different channels represent the variables exported, + and the last channel always represents the geometric domains for your spatial export. +
+Or, Open the export table and view all past exports with their affiliated metadata.
+Time: Time directly corresponds to the simulations time.
+For VCell exports generated from your local VCell installation:
+Select the appropriate export and click the "Open" button.
From N5 URL (VCell Install Not Required):