Skip to content

Commit

Permalink
Merge pull request #28 from virtualcell/view-simulation-results-helpe…
Browse files Browse the repository at this point in the history
…r-menu

View simulation results helper menu
  • Loading branch information
AvocadoMoon authored Feb 1, 2024
2 parents 09ac133 + 0e46ea9 commit 32784d7
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 2 deletions.
6 changes: 6 additions & 0 deletions view-simulation-results/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@
<artifactId>jsoup</artifactId>
<version>1.16.1</version>
</dependency>

<dependency>
<groupId>org.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>0.20.0</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.vcell.N5.UI;

import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;

import javax.swing.*;
import java.awt.*;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;

public class HelpExplanation {
private JDialog jDialog;

public HelpExplanation(){
int height = 400;
int width = 700;

JPanel helperPanel = new JPanel();
JTextPane textPane = new JTextPane();

Parser parser = Parser.builder().build();
String md;
URL mdPath = ClassLoader.getSystemClassLoader().getResource("Help.md");
try {
md = new String(Files.readAllBytes(Paths.get(mdPath.getPath())));
} catch (IOException e) {
throw new RuntimeException(e);
}
Node node = parser.parse(md);
HtmlRenderer renderer = HtmlRenderer.builder().build();
String text = renderer.render(node);
textPane.setContentType("text/html");
textPane.setSize(width, height);
textPane.setPreferredSize(new Dimension(width, height));
textPane.setText(text);
textPane.setEditable(false);

JScrollPane scrollPane = new JScrollPane(textPane);
scrollPane.setSize(width, height);
helperPanel.setSize(width, height);
helperPanel.add(scrollPane);


JOptionPane pane = new JOptionPane(helperPanel, JOptionPane.PLAIN_MESSAGE, 0, null, new Object[]{"Close"});
jDialog = pane.createDialog("Helper Menu");
jDialog.setModal(false);
jDialog.setPreferredSize(new Dimension(width, height));
}

public void displayHelpMenu(){
jDialog.setVisible(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public class N5ViewerGUI extends JFrame implements ActionListener {
private N5ExportTable n5ExportTable;

public JButton mostRecentExport;
private JButton questionMark;

public RemoteFileSelection remoteFileSelection;
private HelpExplanation helpExplanation;

public N5ViewerGUI(N5ImageHandler n5ImageHandler) {
thisJFrame = this;
Expand Down Expand Up @@ -68,14 +70,19 @@ public N5ViewerGUI(N5ImageHandler n5ImageHandler) {
mainPanelConstraints.gridy = 0;
mainPanelConstraints.gridx = 4;
openInMemory = new JLabel();
openInMemory.setText("Open Image in Memory");
openInMemory.setText("Open in Memory");
mainPanel.add(openInMemory, mainPanelConstraints);

mainPanelConstraints.gridy = 0;
mainPanelConstraints.gridx = 5;
openMemoryCheckBox = new JCheckBox();
mainPanel.add(openMemoryCheckBox, mainPanelConstraints);

mainPanelConstraints.gridy = 0;
mainPanelConstraints.gridx = 6;
questionMark = new JButton("?");
mainPanel.add(questionMark, mainPanelConstraints);


GridBagConstraints datasetConstraints = new GridBagConstraints();
datasetConstraints.gridx = 0;
Expand Down Expand Up @@ -111,7 +118,7 @@ public N5ViewerGUI(N5ImageHandler n5ImageHandler) {


localFiles.addActionListener(this);

questionMark.addActionListener(this);
remoteFiles.addActionListener(this);
exportTableButton.addActionListener(this);

Expand All @@ -125,6 +132,7 @@ public N5ViewerGUI(N5ImageHandler n5ImageHandler) {


n5ExportTable = new N5ExportTable(n5ImageHandler);
helpExplanation = new HelpExplanation();
}

public void updateDatasetList(ArrayList<String> arrayList){
Expand All @@ -149,6 +157,8 @@ public void actionPerformed(ActionEvent e) {
remoteFileSelection.setVisible(true);
} else if (e.getSource() == exportTableButton) {
n5ExportTable.displayExportTable();
} else if (e.getSource() == questionMark) {
helpExplanation.displayHelpMenu();
}
}

Expand Down
30 changes: 30 additions & 0 deletions view-simulation-results/src/main/resources/Help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
### Intro
The VCell (https://vcell.org/) application can export spatial simulation results into multiple formats, with
.N5 (https://imagej.net/libs/n5) being one of them. N5 exports are
stored remotely on VCell servers, allowing applications such as ImageJ
to directly access the results of these simulations and perform analyses.

### VCell Spatial Simulation
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.

### N5 and Datasets
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.


### Accessing Simulation Results

For VCell exports generated from your local VCell installation:
- Either, Click the recent export button.

- Or, Open the export table and view all past exports with their affiliated metadata.

From N5 URL (VCell Install Not Required):
- Click the 'Remote Files' button, paste the N5 URL,
then select dataset from list.

0 comments on commit 32784d7

Please sign in to comment.