diff --git a/vcell-admin/src/main/java/org/vcell/standalone/VCellClientDevMain.java b/vcell-admin/src/main/java/org/vcell/standalone/VCellClientDevMain.java index 61c20cffd3..21ced10717 100644 --- a/vcell-admin/src/main/java/org/vcell/standalone/VCellClientDevMain.java +++ b/vcell-admin/src/main/java/org/vcell/standalone/VCellClientDevMain.java @@ -53,7 +53,7 @@ public static void main(String[] args) { try { ErrorUtils.setDebug(true); PropertyLoader.loadProperties(ArrayUtils.addAll(REQUIRED_CLIENT_PROPERTIES, REQUIRED_LOCAL_PROPERTIES)); - Injector injector = Guice.createInjector(new VCellServerModule()); + Injector injector = Guice.createInjector(new VCellStandaloneModule()); VCellClientDevMain vcellClientStandalone = injector.getInstance(VCellClientDevMain.class); diff --git a/vcell-admin/src/main/java/org/vcell/standalone/VCellStandaloneModule.java b/vcell-admin/src/main/java/org/vcell/standalone/VCellStandaloneModule.java new file mode 100644 index 0000000000..6863df94fb --- /dev/null +++ b/vcell-admin/src/main/java/org/vcell/standalone/VCellStandaloneModule.java @@ -0,0 +1,25 @@ +package org.vcell.standalone; + +import cbit.vcell.field.db.LocalExternalDataIdentifierServiceImpl; +import cbit.vcell.message.VCMessagingService; +import cbit.vcell.message.jms.activeMQ.VCMessagingServiceActiveMQ; +import cbit.vcell.message.server.bootstrap.LocalVCellConnectionFactory; +import cbit.vcell.message.server.bootstrap.LocalVCellConnectionServiceImpl; +import cbit.vcell.server.LocalVCellConnectionService; +import cbit.vcell.server.VCellConnectionFactory; +import cbit.vcell.simdata.ExternalDataIdentifierService; +import com.google.inject.AbstractModule; +import org.vcell.service.registration.RegistrationService; +import org.vcell.service.registration.localdb.LocaldbRegistrationService; + +public class VCellStandaloneModule extends AbstractModule { + @Override + protected void configure() { + bind(ExternalDataIdentifierService.class).toInstance(new LocalExternalDataIdentifierServiceImpl()); + + bind(LocalVCellConnectionService.class).toInstance(new LocalVCellConnectionServiceImpl()); + bind(VCellConnectionFactory.class).to(LocalVCellConnectionFactory.class).asEagerSingleton(); + + bind(RegistrationService.class).toInstance(new LocaldbRegistrationService()); + } +} diff --git a/vcell-api/src/main/java/org/vcell/rest/VCellApiMain.java b/vcell-api/src/main/java/org/vcell/rest/VCellApiMain.java index 5736fefe3c..7a6130a2f7 100644 --- a/vcell-api/src/main/java/org/vcell/rest/VCellApiMain.java +++ b/vcell-api/src/main/java/org/vcell/rest/VCellApiMain.java @@ -265,6 +265,7 @@ public static void main(String[] args) { private static final String REQUIRED_SERVICE_PROPERTIES[] = { PropertyLoader.vcellServerIDProperty, PropertyLoader.vcellServerPrefixV0, + PropertyLoader.vcellSoftwareVersion, PropertyLoader.installationRoot, PropertyLoader.dbConnectURL, PropertyLoader.dbDriverName, diff --git a/vcell-client/src/main/java/cbit/vcell/client/data/PDEExportDataPanel.java b/vcell-client/src/main/java/cbit/vcell/client/data/PDEExportDataPanel.java index 71ce357397..4ae2159170 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/data/PDEExportDataPanel.java +++ b/vcell-client/src/main/java/cbit/vcell/client/data/PDEExportDataPanel.java @@ -2253,15 +2253,16 @@ private void updateChoiceVariableType(PDEDataContext pdeDataContext){ DataIdentifier[] dataIDArr = pdeDataContext.getDataIdentifiers(); for (int i = 0; i < dataIDArr.length; i++) { -// String vmPrefix = (dataIDArr[i].getVariableType().equals(VariableType.VOLUME) -// ?"V" -// :(dataIDArr[i].getVariableType().equals(VariableType.MEMBRANE)?"M":"?")); + VariableType variableType = dataIDArr[i].getVariableType(); + String varListName = dataIDArr[i].getName();//"("+vmPrefix+") "+dataIDArr[i].getName(); + boolean allowedVolumeExport = variableType.equals(VariableType.VOLUME) || + (variableType.equals(VariableType.POSTPROCESSING) && !getSelectedFormat().equals(ExportFormat.N5)); if(getBothVarRadioButton().isSelected()){ dataIdentifierTreeSet.add(varListName); - }else if(getVolVarRadioButton().isSelected() && (dataIDArr[i].getVariableType().equals(VariableType.VOLUME) || dataIDArr[i].getVariableType().equals(VariableType.POSTPROCESSING))){ + }else if(getVolVarRadioButton().isSelected() && allowedVolumeExport){ dataIdentifierTreeSet.add(varListName); - }else if(getMembVarRadioButton().isSelected() && dataIDArr[i].getVariableType().equals(VariableType.MEMBRANE)){ + }else if(getMembVarRadioButton().isSelected() && variableType.equals(VariableType.MEMBRANE)){ dataIdentifierTreeSet.add(varListName); } } @@ -2433,6 +2434,7 @@ private void updateInterface() { break; case N5: getJRadioButtonROI().setEnabled(false); + getROISelections().setEnabled(false); getJRadioButtonSlice().setEnabled(false); getMembVarRadioButton().setEnabled(false); getBothVarRadioButton().setEnabled(false); diff --git a/vcell-client/src/main/java/cbit/vcell/desktop/ClientLogin.java b/vcell-client/src/main/java/cbit/vcell/desktop/ClientLogin.java index 1c52cd63bc..e5f7d93f11 100644 --- a/vcell-client/src/main/java/cbit/vcell/desktop/ClientLogin.java +++ b/vcell-client/src/main/java/cbit/vcell/desktop/ClientLogin.java @@ -6,12 +6,15 @@ import cbit.vcell.client.server.ClientServerInfo; import cbit.vcell.client.task.AsynchClientTask; import cbit.vcell.server.Auth0ConnectionUtils; +import com.google.inject.Guice; import com.google.inject.Inject; import com.google.inject.Key; +import com.google.inject.name.Named; import com.google.inject.name.Names; import org.vcell.DependencyConstants; import org.vcell.util.document.User; import org.vcell.util.gui.VCellIcons; +import scala.util.parsing.combinator.testing.Str; import javax.swing.*; import java.util.Hashtable; @@ -103,13 +106,18 @@ public void run(Hashtable hashTable) throws Exception { return task; } + @Inject @Named(DependencyConstants.VCELL_QUARKUS_API_HOST) + static String hostname; + @Inject public static AsynchClientTask connectToServer(Auth0ConnectionUtils auth0ConnectionUtils, ClientServerInfo clientServerInfo){ AsynchClientTask task = new AsynchClientTask("Connecting to Server", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) { public void run(Hashtable hashTable) throws Exception { - String hostname = VCellClientMain.injector.getInstance(Key.get(String.class, Names.named(DependencyConstants.VCELL_QUARKUS_API_HOST))); + + +// String hostname = VCellClientMain.injector.getInstance(Key.get(String.class, Names.named(DependencyConstants.VCELL_QUARKUS_API_HOST))); // try server connection boolean login = (boolean)hashTable.get("login"); boolean isGuest = (boolean)hashTable.get("guest"); diff --git a/vcell-client/src/main/java/cbit/vcell/export/gui/N5SettingsPanel.java b/vcell-client/src/main/java/cbit/vcell/export/gui/N5SettingsPanel.java index d8ffb1ae02..191dd2f1a3 100644 --- a/vcell-client/src/main/java/cbit/vcell/export/gui/N5SettingsPanel.java +++ b/vcell-client/src/main/java/cbit/vcell/export/gui/N5SettingsPanel.java @@ -18,43 +18,14 @@ public class N5SettingsPanel extends javax.swing.JPanel implements ExportConstan private javax.swing.JPanel mainPanel = null; private ExportSpecs.SimulationSelector simulationSelector; - private JRadioButton ivjRadioButtonBZIP = null; - private JRadioButton ivjRadioButtonGZIP = null; - private JRadioButton radioButtonRAW = null; - private N5Specs.CompressionLevel compressionLevel = N5Specs.CompressionLevel.RAW; private JLabel dataSetNameLabel = null; private JTextField dataSetName = null; - /** - * Constructor - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + + public N5SettingsPanel() { super(); initialize(); } - /** - * MovieSettingsPanel constructor comment. - * @param layout java.awt.LayoutManager - */ - public N5SettingsPanel(java.awt.LayoutManager layout) { - super(layout); - } - /** - * MovieSettingsPanel constructor comment. - * @param layout java.awt.LayoutManager - * @param isDoubleBuffered boolean - */ - public N5SettingsPanel(java.awt.LayoutManager layout, boolean isDoubleBuffered) { - super(layout, isDoubleBuffered); - } - /** - * MovieSettingsPanel constructor comment. - * @param isDoubleBuffered boolean - */ - public N5SettingsPanel(boolean isDoubleBuffered) { - super(isDoubleBuffered); - } - public void setSimulationSelector(ExportSpecs.SimulationSelector simulationSelector){ this.simulationSelector = simulationSelector; @@ -67,44 +38,24 @@ public void actionPerformed(java.awt.event.ActionEvent e) { this.fireJButtonOKAction_actionPerformed(new java.util.EventObject(this)); if (e.getSource() == getCancelJButton()) this.fireJButtonCancelAction_actionPerformed(new java.util.EventObject(this)); - - if (e.getSource() == getJRadioButtonBZIP()) - compressionLevel = N5Specs.CompressionLevel.BZIP; - if (e.getSource() == getJRadioButtonGZIP()) - compressionLevel = N5Specs.CompressionLevel.GZIP; - if (e.getSource() == getRadioButtonRAW()) - compressionLevel = N5Specs.CompressionLevel.RAW; } catch (Throwable ivjExc){ handleException(ivjExc); } - - // user code begin {2} - // user code end } - /** - * - * @param newListener cbit.vcell.export.ASCIISettingsPanelListener - */ + public void addN5SettingsPanelListener(cbit.vcell.export.gui.ASCIISettingsPanelListener newListener) { fieldASCIISettingsPanelListenerEventMulticaster = cbit.vcell.export.gui.ASCIISettingsPanelListenerEventMulticaster.add(fieldASCIISettingsPanelListenerEventMulticaster, newListener); return; } - /** - * Method to support listener events. - * @param newEvent java.util.EventObject - */ protected void fireJButtonCancelAction_actionPerformed(java.util.EventObject newEvent) { if (fieldASCIISettingsPanelListenerEventMulticaster == null) { return; }; fieldASCIISettingsPanelListenerEventMulticaster.JButtonCancelAction_actionPerformed(newEvent); } - /** - * Method to support listener events. - * @param newEvent java.util.EventObject - */ + protected void fireJButtonOKAction_actionPerformed(java.util.EventObject newEvent) { String dataSetName = getJTextFieldDataSetName().getText(); @@ -118,33 +69,21 @@ protected void fireJButtonOKAction_actionPerformed(java.util.EventObject newEven fieldASCIISettingsPanelListenerEventMulticaster.JButtonOKAction_actionPerformed(newEvent); } - /** - * Return the CancelJButton property value. - * @return javax.swing.JButton - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private javax.swing.JButton getCancelJButton() { if (ivjCancelJButton == null) { try { ivjCancelJButton = new javax.swing.JButton(); ivjCancelJButton.setName("CancelJButton"); ivjCancelJButton.setText("Cancel"); - // user code begin {1} - // user code end } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end handleException(ivjExc); } } return ivjCancelJButton; } - /** - * Return the JButtonOK property value. - * @return javax.swing.JButton - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private javax.swing.JButton getJButtonOK() { if (ivjJButtonOK == null) { try { @@ -153,44 +92,14 @@ private javax.swing.JButton getJButtonOK() { ivjJButtonOK.setFont(new java.awt.Font("dialog", 1, 12)); ivjJButtonOK.setText("OK"); ivjJButtonOK.setMaximumSize(new java.awt.Dimension(100, 50)); - // user code begin {1} - // user code end } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end handleException(ivjExc); } } return ivjJButtonOK; } - /** - * Return the JLabelAdditional property value. - * @return javax.swing.JLabel - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ - private javax.swing.JLabel getJLabelAdditional() { - if (ivjJLabelAdditional == null) { - try { - ivjJLabelAdditional = new javax.swing.JLabel(); - ivjJLabelAdditional.setName("JLabelAdditional"); - ivjJLabelAdditional.setPreferredSize(new java.awt.Dimension(108, 27)); - ivjJLabelAdditional.setText("Additional formatting:"); - // user code begin {1} - // user code end - } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end - handleException(ivjExc); - } - } - return ivjJLabelAdditional; - } - /** - * Return the JLabelDataFormat property value. - * @return javax.swing.JLabel - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private javax.swing.JLabel getJLabelCompressionType() { if (ivjJLabelDataType == null) { try { @@ -216,21 +125,13 @@ private javax.swing.JLabel getJLabelDatasetName() { dataSetNameLabel.setName("JLabelDatasetName"); dataSetNameLabel.setPreferredSize(new java.awt.Dimension(108, 27)); dataSetNameLabel.setText("N5 Dataset Name:"); - // user code begin {1} - // user code end } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end handleException(ivjExc); } } return dataSetNameLabel; } - /** - * Return the JPanel1 property value. - * @return javax.swing.JPanel - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private javax.swing.JPanel getMainPanel() { if (mainPanel == null) { try { @@ -247,21 +148,13 @@ private javax.swing.JPanel getMainPanel() { constraintsCancelJButton.fill = GridBagConstraints.HORIZONTAL; constraintsCancelJButton.gridx = 1; constraintsCancelJButton.gridy = 0; mainPanel.add(getCancelJButton(), constraintsCancelJButton); - // user code begin {1} - // user code end } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end handleException(ivjExc); } } return mainPanel; } - /** - * Return the JRadioButtonCompressed property value. - * @return javax.swing.JRadioButton - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private javax.swing.JRadioButton getJRadioButtonParticles() { if (ivjJRadioButtonParticles == null) { try { @@ -275,11 +168,7 @@ private javax.swing.JRadioButton getJRadioButtonParticles() { } return ivjJRadioButtonParticles; } - /** - * Return the JRadioButtonUncompressed property value. - * @return javax.swing.JRadioButton - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private javax.swing.JRadioButton getJRadioButtonVariables() { if (ivjJRadioButtonVariables == null) { try { @@ -287,77 +176,13 @@ private javax.swing.JRadioButton getJRadioButtonVariables() { ivjJRadioButtonVariables.setName("JRadioButtonVariables"); ivjJRadioButtonVariables.setSelected(true); ivjJRadioButtonVariables.setText("Variable values"); - // user code begin {1} - // user code end } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end handleException(ivjExc); } } return ivjJRadioButtonVariables; } - /** - * Return the JRadioButtonUncompressed property value. - * @return javax.swing.JRadioButton - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ - private javax.swing.JRadioButton getJRadioButtonBZIP() { - if (ivjRadioButtonBZIP == null) { - try { - ivjRadioButtonBZIP = new javax.swing.JRadioButton(); - ivjRadioButtonBZIP.setName("JRadioButtonBZIP"); - ivjRadioButtonBZIP.setSelected(true); - ivjRadioButtonBZIP.setText("BZIP"); - // user code begin {1} - // user code end - } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end - handleException(ivjExc); - } - } - return ivjRadioButtonBZIP; - } - - private JRadioButton getRadioButtonRAW(){ - if (radioButtonRAW == null) { - try { - radioButtonRAW = new javax.swing.JRadioButton(); - radioButtonRAW.setName("JRadioButtonRAW"); - radioButtonRAW.setSelected(true); - radioButtonRAW.setText("RAW"); - // user code begin {1} - // user code end - } catch (java.lang.Throwable ivjExc) { - // user code begin {2} - // user code end - handleException(ivjExc); - } - } - return radioButtonRAW; - } - - /** - * Return the JRadioButtonUncompressed property value. - * @return javax.swing.JRadioButton - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ - private javax.swing.JRadioButton getJRadioButtonGZIP() { - if (ivjRadioButtonGZIP == null) { - try { - ivjRadioButtonGZIP = new javax.swing.JRadioButton(); - ivjRadioButtonGZIP.setName("JRadioButtonGZIP"); - ivjRadioButtonGZIP.setSelected(true); - ivjRadioButtonGZIP.setText("GZIP"); - } catch (java.lang.Throwable ivjExc) { - handleException(ivjExc); - } - } - return ivjRadioButtonGZIP; - } - private javax.swing.JTextField getJTextFieldDataSetName() { if (dataSetName == null) { try { @@ -371,95 +196,36 @@ private javax.swing.JTextField getJTextFieldDataSetName() { return dataSetName; } - /** - * Called whenever the part throws an exception. - * @param exception java.lang.Throwable - */ private void handleException(Throwable exception) { - /* Uncomment the following lines to print uncaught exceptions to stdout */ System.out.println("--------- UNCAUGHT EXCEPTION ---------"); exception.printStackTrace(System.out); } - /** - * Initializes connections - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private void initConnections() throws java.lang.Exception { - // user code begin {1} - // user code end getJButtonOK().addActionListener(this); getJRadioButtonVariables().addItemListener(this); this.addPropertyChangeListener(this); getCancelJButton().addActionListener(this); - - getJRadioButtonGZIP().addActionListener(this); - getJRadioButtonBZIP().addActionListener(this); } - /** - * Initialize the class. - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + private void initialize() { try { - // user code begin {1} - // user code end setName("N5SettingsPanel"); setLayout(new java.awt.GridBagLayout()); setSize(235, 403); - java.awt.GridBagConstraints constraintsJLabelDataType = new java.awt.GridBagConstraints(); - constraintsJLabelDataType.gridx = 0; constraintsJLabelDataType.gridy = 0; - constraintsJLabelDataType.fill = java.awt.GridBagConstraints.HORIZONTAL; - constraintsJLabelDataType.weightx = 1.0; - constraintsJLabelDataType.insets = new Insets(10, 5, 5, 5); - add(getJLabelCompressionType(), constraintsJLabelDataType); - - java.awt.GridBagConstraints constraintsJRadioButtonVariables = new java.awt.GridBagConstraints(); - constraintsJRadioButtonVariables.anchor = GridBagConstraints.WEST; - constraintsJRadioButtonVariables.gridx = 0; constraintsJRadioButtonVariables.gridy = 1; - constraintsJRadioButtonVariables.fill = java.awt.GridBagConstraints.HORIZONTAL; - constraintsJRadioButtonVariables.weightx = 1.0; - constraintsJRadioButtonVariables.insets = new Insets(0, 5, 5, 5); - add(getJRadioButtonBZIP(), constraintsJRadioButtonVariables); - - java.awt.GridBagConstraints constraintsJRadioButtonParticles = new java.awt.GridBagConstraints(); - constraintsJRadioButtonParticles.anchor = GridBagConstraints.WEST; - constraintsJRadioButtonParticles.gridx = 0; constraintsJRadioButtonParticles.gridy = 2; - constraintsJRadioButtonParticles.fill = java.awt.GridBagConstraints.HORIZONTAL; - constraintsJRadioButtonParticles.weightx = 1.0; - constraintsJRadioButtonParticles.insets = new Insets(0, 5, 5, 5); - add(getJRadioButtonGZIP(), constraintsJRadioButtonParticles); - - java.awt.GridBagConstraints constraintsJRadioButtonRAW = new java.awt.GridBagConstraints(); - constraintsJRadioButtonRAW.anchor = GridBagConstraints.WEST; - constraintsJRadioButtonRAW.gridx = 0; constraintsJRadioButtonRAW.gridy = 3; - constraintsJRadioButtonRAW.fill = java.awt.GridBagConstraints.HORIZONTAL; - constraintsJRadioButtonRAW.weightx = 1.0; - constraintsJRadioButtonRAW.insets = new Insets(0, 5, 5, 5); - add(getRadioButtonRAW(), constraintsJRadioButtonRAW); - java.awt.GridBagConstraints constraintsJLabelDataSetName = new java.awt.GridBagConstraints(); - constraintsJLabelDataSetName.anchor = GridBagConstraints.WEST; - constraintsJLabelDataSetName.gridx = 0; constraintsJLabelDataSetName.gridy = 4; + constraintsJLabelDataSetName.gridx = 0; constraintsJLabelDataSetName.gridy = 0; constraintsJLabelDataSetName.fill = java.awt.GridBagConstraints.HORIZONTAL; - constraintsJLabelDataSetName.weightx = 1.0; - constraintsJLabelDataSetName.insets = new Insets(0, 5, 5, 5); add(getJLabelDatasetName(), constraintsJLabelDataSetName); java.awt.GridBagConstraints constraintsJTextFieldDataSetName = new java.awt.GridBagConstraints(); - constraintsJTextFieldDataSetName.anchor = GridBagConstraints.WEST; - constraintsJTextFieldDataSetName.gridx = 0; constraintsJTextFieldDataSetName.gridy = 5; + constraintsJTextFieldDataSetName.gridx = 0; constraintsJTextFieldDataSetName.gridy = 1; constraintsJTextFieldDataSetName.fill = java.awt.GridBagConstraints.HORIZONTAL; constraintsJTextFieldDataSetName.weightx = 1.0; - constraintsJTextFieldDataSetName.insets = new Insets(0, 5, 5, 5); add(getJTextFieldDataSetName(), constraintsJTextFieldDataSetName); - ButtonGroup compressionButtons = new ButtonGroup(); - compressionButtons.add(getJRadioButtonBZIP()); - compressionButtons.add(getJRadioButtonGZIP()); - compressionButtons.add(getRadioButtonRAW()); - java.awt.GridBagConstraints constraintsJPanel1 = new java.awt.GridBagConstraints(); constraintsJPanel1.gridx = 0; constraintsJPanel1.gridy = 6; @@ -478,34 +244,20 @@ public static void main(String[] args) { n5SettingsPanel.initialize(); JFrame jFrame = new JFrame(); jFrame.add(n5SettingsPanel.getMainPanel()); - jFrame.setSize(400, 400); + jFrame.setSize(235, 403); jFrame.setVisible(true); n5SettingsPanel.getMainPanel().show(); } - /** - * Method to handle events for the ItemListener interface. - * @param e java.awt.event.ItemEvent - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ + public void itemStateChanged(java.awt.event.ItemEvent e) { return; } - /** - * Method to handle events for the PropertyChangeListener interface. - * @param evt java.beans.PropertyChangeEvent - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ public void propertyChange(java.beans.PropertyChangeEvent evt) { return; } - /** - * Method to handle events for the ChangeListener interface. - * @param e javax.swing.event.ChangeEvent - */ - /* WARNING: THIS METHOD WILL BE REGENERATED. */ public void stateChanged(javax.swing.event.ChangeEvent e) { return; } @@ -515,7 +267,7 @@ public N5Specs getN5Specs(){ int[] paramScanIndexes = simulationSelector == null ? null : simulationSelector.getselectedParamScanIndexes(); String dataSetName = getJTextFieldDataSetName().getText(); - return new N5Specs(DataType.PDE_VARIABLE_DATA, ExportFormat.N5, compressionLevel, dataSetName); + return new N5Specs(DataType.PDE_VARIABLE_DATA, ExportFormat.N5, N5Specs.CompressionLevel.GZIP, dataSetName); } private JLabel lblSeeVcellHelp; diff --git a/vcell-core/src/main/java/cbit/vcell/export/MeshToImage.java b/vcell-core/src/main/java/cbit/vcell/export/MeshToImage.java new file mode 100644 index 0000000000..b8a08c4492 --- /dev/null +++ b/vcell-core/src/main/java/cbit/vcell/export/MeshToImage.java @@ -0,0 +1,131 @@ +package cbit.vcell.export; + +import cbit.vcell.geometry.GeometryException; +import cbit.vcell.solvers.CartesianMesh; + +public class MeshToImage { + + public record ImageData(double[] data, int sizeX, int sizeY, int sizeZ){ + + } + + public record MeshData(double[] data, int sizeX, int sizeY, int sizeZ){ + + } + + /** + * When a simulation is executed, the borders of this simulation world abruptly end, and because of that + * some elements don't occupy the same region of space as other elements not on the border. For these meshes to be + * considered as images, this can not happen and some atomic length of space must be recognized while still keeping + * the same ratio of space taken. + * @return double[] + */ + public static ImageData convertMeshIntoImage(double[] data, CartesianMesh mesh) throws GeometryException { + int dimensions = mesh.getGeometryDimension(); + if (dimensions == 1){ + throw new GeometryException("Does not support 1D mesh to image conversions"); + } + return convertMeshIntoImage(data, mesh.getSizeX(), mesh.getSizeY(), mesh.getSizeZ(), dimensions > 2); + } + + public static MeshData convertImageIntoMesh(double[] data, CartesianMesh mesh) throws GeometryException { + return convertImageIntoMesh(data, mesh, mesh.getGeometryDimension() > 2); + } + + public static MeshData convertImageIntoMesh(double[] data, CartesianMesh mesh, boolean overRideThreeD) throws GeometryException { + int dim = mesh.getGeometryDimension(); + if (dim == 1){ + throw new GeometryException("Does not support 1D image to mesh conversion"); + } + return convertImageIntoMesh(data, mesh.getSizeX(), mesh.getSizeY(), mesh.getSizeZ(), dim > 2 && overRideThreeD); + } + + public static ImageData convertMeshIntoImage(double[] data, int sizeX, int sizeY, int sizeZ, boolean threeD){ + int newDepth = threeD ? newNumElements(sizeZ) : 1; + int newWidth = newNumElements(sizeX), newHeight = newNumElements(sizeY); + int newSize = newWidth * newHeight * newDepth; + double[] newData = new double[newSize]; + for (int i = 0; i < newWidth; i++){ + int oldI = (int) Math.ceil(i / 2.0); + for (int j = 0; j < newHeight; j++){ + int oldJ = (int) Math.ceil(j / 2.0); + for (int k = 0; k < newDepth; k++){ + int oldK = (int) Math.ceil(k / 2.0); + + int oldIndex = threeD ? coordinateToIndex3D(oldI, oldJ, oldK, sizeX, sizeY) : coordinateToIndex2D(oldI, oldJ, sizeX, sizeY); + int newIndex = threeD ? coordinateToIndex3D(i, j, k, newWidth, newHeight) : coordinateToIndex2D(i, j, newWidth, newHeight); + newData[newIndex] = data[oldIndex]; + } + } + } + return new ImageData(newData, newWidth, newHeight, newDepth); + } + + public static MeshData convertImageIntoMesh(double[] data, int sizeX, int sizeY, int sizeZ, boolean threeD){ + int meshWidth = oldNumElements(sizeX); + int meshHeight = oldNumElements(sizeY); + int meshDepth = threeD ? oldNumElements(sizeZ) : 1; + double[] newData = new double[meshHeight * meshWidth * meshDepth]; + for (int i = 0; i < sizeX; i++){ + int meshI = (int) Math.ceil(i / 2.0); + for (int j = 0; j < sizeY; j++){ + int meshJ = (int) Math.ceil(j / 2.0); + for(int k = 0; k < sizeZ; k++){ + int meshK = (int) Math.ceil(k / 2.0); + + int meshIndex = threeD ? coordinateToIndex3D(meshI, meshJ, meshK, meshWidth, meshHeight) : coordinateToIndex2D(meshI, meshJ, meshWidth, meshHeight); + int imageIndex = threeD ? coordinateToIndex3D(i, j, k, sizeX, sizeY) : coordinateToIndex2D(i, j, sizeX, sizeY); + newData[meshIndex] = data[imageIndex]; + } + } + } + return new MeshData(newData, meshWidth, meshHeight, 1); + } + + + public static int coordinateToIndex2D(int x, int y, int width, int height){ + return (y * width) + x; + } + + public static int coordinateToIndex3D(int x, int y, int z, int width, int height){ + return (z*(height * width)) + (y * width) + x; + } + + public static int newNumElements(int oldNElements){ + return oldNElements == 1 ? 1 : ((oldNElements - 2) * 2) + 2; + } + + public static int oldNumElements(int newNumElements){ + return ((newNumElements - 2) / 2) + 2; + } + + public static double[] getXYFromXYZArray(double[] xyzArray, CartesianMesh mesh, int zSlice){ + return getXYFromXYZArray(xyzArray, mesh.getSizeX(), mesh.getSizeY(), zSlice); + } + + public static double[] getXYFromXYZArray(double[] xyzArray, int sizeX, int sizeY, int zSlice){ + double[] xyArray = new double[sizeX * sizeY]; + int xyIndex = 0; + for (int xyzIndex = (zSlice * sizeX * sizeY); xyzIndex < ((zSlice + 1) * sizeX * sizeY); xyzIndex++){ + xyArray[xyIndex] = xyzArray[xyzIndex]; + xyIndex++; + } + return xyArray; + } +} + + + + + + + + + + + + + + + + diff --git a/vcell-core/src/main/java/cbit/vcell/export/server/N5Exporter.java b/vcell-core/src/main/java/cbit/vcell/export/server/N5Exporter.java index 125aae60c7..4053a0a0c8 100644 --- a/vcell-core/src/main/java/cbit/vcell/export/server/N5Exporter.java +++ b/vcell-core/src/main/java/cbit/vcell/export/server/N5Exporter.java @@ -10,11 +10,14 @@ package cbit.vcell.export.server; +import cbit.vcell.export.MeshToImage; import cbit.vcell.math.VariableType; +import cbit.vcell.model.ModelUnitSystem; import cbit.vcell.resource.PropertyLoader; import cbit.vcell.simdata.*; import cbit.vcell.solver.VCSimulationDataIdentifier; import cbit.vcell.solvers.CartesianMesh; +import cbit.vcell.units.VCUnitDefinition; import com.google.gson.GsonBuilder; import edu.uchc.connjur.wb.ExecutionTrace; import org.apache.commons.codec.binary.Hex; @@ -34,6 +37,7 @@ import java.security.MessageDigest; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; public class N5Exporter implements ExportConstants { @@ -54,7 +58,9 @@ public class N5Exporter implements ExportConstants { VariableType.POINT_VARIABLE, VariableType.NONSPATIAL, VariableType.CONTOUR, - VariableType.CONTOUR_REGION + VariableType.CONTOUR_REGION, + VariableType.MEMBRANE_REGION, + VariableType.VOLUME_REGION )); @@ -63,74 +69,129 @@ public N5Exporter(ExportServiceImpl exportServiceImpl) { } private ExportOutput exportToN5(OutputContext outputContext, long jobID, N5Specs n5Specs, ExportSpecs exportSpecs, FileDataContainerManager fileDataContainerManager) throws Exception { + VCUnitDefinition lengthUnit = ModelUnitSystem.createDefaultVCModelUnitSystem().getLengthUnit(); double[] allTimes = dataServer.getDataSetTimes(user, vcDataID); TimeSpecs timeSpecs = exportSpecs.getTimeSpecs(); String[] variableNames = exportSpecs.getVariableSpecs().getVariableNames(); // output context expects a list of annotated functions, vcData seems to already have a set of annotated functions - int numVariables = variableNames.length + 1; //the extra variable length is for the mask generated for every N5 Export CartesianMesh mesh = dataServer.getMesh(user, vcDataID); + int sizeX = MeshToImage.newNumElements(mesh.getSizeX()), sizeY = MeshToImage.newNumElements(mesh.getSizeY()), sizeZ = MeshToImage.newNumElements(mesh.getSizeZ()); + double lengthPerPixelX = mesh.getExtent().getX() / sizeX, + lengthPerPixelY = mesh.getExtent().getY() / sizeY, + lengthPerPixelZ = mesh.getExtent().getZ() / sizeZ; + int numVariables = variableNames.length + 1; //the extra variable length is for the mask generated for every N5 Export int numTimes = timeSpecs.getEndTimeIndex() - timeSpecs.getBeginTimeIndex(); //end index is an actual index within the array and not representative of length - long[] dimensions = {mesh.getSizeX(), mesh.getSizeY(), numVariables, mesh.getSizeZ(), numTimes + 1}; - // 51X, 51Y, 1Z, 1C, 2T - int[] blockSize = {mesh.getSizeX(), mesh.getSizeY(), 1, mesh.getSizeZ(), 1}; + long[] dimensions = {sizeX, sizeY, numVariables, sizeZ, numTimes + 1}; + int[] blockSize = {sizeX, sizeY, 1, 1, 1}; + + // rewrite so that it still results in a tmp file does not raise File already exists error + N5FSWriter n5FSWriter = new N5FSWriter(getN5FileAbsolutePath(), new GsonBuilder()); + DatasetAttributes datasetAttributes = new DatasetAttributes(dimensions, blockSize, org.janelia.saalfeldlab.n5.DataType.FLOAT64, n5Specs.getCompression()); + n5FSWriter.createDataset(String.valueOf(jobID), datasetAttributes); + + //Create mask double[] mask = new double[mesh.getSizeX()*mesh.getSizeY()*mesh.getSizeZ()]; for (int i =0; i < mesh.getSizeX() * mesh.getSizeY() * mesh.getSizeZ(); i++){ mask[i] = (double) mesh.getSubVolumeFromVolumeIndex(i); } - for (String variableName: variableNames){ - DataIdentifier specie = getSpecificDI(variableName, outputContext); - if (specie != null){ - if (unsupportedTypes.contains(specie.getVariableType())){ - throw new RuntimeException("Tried to export a variable type that is not supported!"); - } else if (specie.getVariableType().equals(VariableType.POSTPROCESSING)) { + HashMap channelInfo = new HashMap<>(); + + boolean containsPostProcessed = containsPostProcessedVariable(variableNames, outputContext); + + if (containsPostProcessed){ + for (String variableName : variableNames){ + if (getSpecificDI(variableName, outputContext).getVariableType().compareEqual(VariableType.POSTPROCESSING)){ File hdf5File = dataServer.getVCellSimFiles(vcDataID.getOwner(), vcDataID).postprocessingFile; Hdf5DataProcessingReaderPure hdf5DataProcessingReaderPure = new Hdf5DataProcessingReaderPure(); DataOperationResults.DataProcessingOutputInfo dataProcessingOutputInfo = hdf5DataProcessingReaderPure.getDataProcessingOutput(new DataOperation.DataProcessingOutputInfoOP(vcDataID,false, outputContext), hdf5File); ISize iSize = dataProcessingOutputInfo.getVariableISize(variableName); - dimensions = new long[]{iSize.getX(), iSize.getY(), numVariables, iSize.getZ(), numTimes + 1}; - blockSize = new int[]{iSize.getX(), iSize.getY(), 1, iSize.getZ(), 1}; - } + lengthPerPixelX = mesh.getExtent().getX() / iSize.getX(); lengthPerPixelY = mesh.getExtent().getY() / iSize.getY(); lengthPerPixelZ = mesh.getExtent().getZ() / iSize.getZ(); + sizeX = iSize.getX(); sizeY = iSize.getY(); sizeZ = iSize.getZ(); + dimensions = new long[]{sizeX, sizeY, numVariables, sizeZ, numTimes + 1}; + blockSize = new int[]{sizeX, sizeY, 1, 1, 1}; + } else { + throw new RuntimeException("All variable types must be of POST-PROCESSING if you want to export a post-processed variable."); + } + } + } else { + for (int i = 0; i < variableNames.length; i++){ + String variableName = variableNames[i]; + DataIdentifier specie = getSpecificDI(variableName, outputContext); + HashMap variableInfo = new HashMap<>(); + variableInfo.put("Name", variableName); + variableInfo.put("Domain", specie.getDomain().getName()); + channelInfo.put(i, variableInfo); } + mask = MeshToImage.convertMeshIntoImage(mask, mesh).data(); } - // rewrite so that it still results in a tmp file does not raise File already exists error - N5FSWriter n5FSWriter = new N5FSWriter(getN5FileAbsolutePath(), new GsonBuilder()); - DatasetAttributes datasetAttributes = new DatasetAttributes(dimensions, blockSize, org.janelia.saalfeldlab.n5.DataType.FLOAT64, n5Specs.getCompression()); - n5FSWriter.createDataset(String.valueOf(jobID), datasetAttributes); - N5Specs.writeImageJMetaData(jobID, dimensions, blockSize, n5Specs.getCompression(), n5FSWriter, n5Specs.dataSetName, numVariables, blockSize[3], allTimes.length, exportSpecs.getHumanReadableExportData().subVolume); + N5Specs.writeImageJMetaData(jobID, dimensions, blockSize, n5Specs.getCompression(), n5FSWriter, + n5Specs.dataSetName, numVariables, sizeZ, allTimes.length, + exportSpecs.getHumanReadableExportData().subVolume, + lengthPerPixelY, lengthPerPixelX, lengthPerPixelZ, lengthUnit.getSymbol(), channelInfo); - //Create mask - for(int timeIndex = timeSpecs.getBeginTimeIndex(); timeIndex <= timeSpecs.getEndTimeIndex(); timeIndex++){ - int normalizedTimeIndex = timeIndex - timeSpecs.getBeginTimeIndex(); - DoubleArrayDataBlock doubleArrayDataBlock = new DoubleArrayDataBlock(blockSize, new long[]{0, 0, 0, 0, normalizedTimeIndex}, mask); - n5FSWriter.writeBlock(String.valueOf(jobID), datasetAttributes, doubleArrayDataBlock); - } - - for (int variableIndex=1; variableIndex < numVariables; variableIndex++){ + int timeLoops = 1; + double progress = 0; + for (int variableIndex=0; variableIndex < (numVariables -1); variableIndex++){ for (int timeIndex=timeSpecs.getBeginTimeIndex(); timeIndex <= timeSpecs.getEndTimeIndex(); timeIndex++){ - int normalizedTimeIndex = timeIndex - timeSpecs.getBeginTimeIndex(); - double[] data = this.dataServer.getSimDataBlock(outputContext, user, this.vcDataID, variableNames[variableIndex - 1], allTimes[timeIndex]).getData(); - DoubleArrayDataBlock doubleArrayDataBlock = new DoubleArrayDataBlock(blockSize, new long[]{0, 0, variableIndex, 0, (normalizedTimeIndex)}, data); - n5FSWriter.writeBlock(String.valueOf(jobID), datasetAttributes, doubleArrayDataBlock); - if(timeIndex % 3 == 0){ - double progress = (double) (variableIndex + normalizedTimeIndex) / (numVariables + (numTimes * numVariables)); + + double[] data = this.dataServer.getSimDataBlock(outputContext, user, this.vcDataID, variableNames[variableIndex], allTimes[timeIndex]).getData(); + data = containsPostProcessed ? data : MeshToImage.convertMeshIntoImage(data, mesh).data(); + for (int z=0; z < sizeZ; z++){ + double[] dataToWrite = MeshToImage.getXYFromXYZArray(data, sizeX, sizeY, z); + DoubleArrayDataBlock doubleArrayDataBlock = new DoubleArrayDataBlock(blockSize, new long[]{0, 0, variableIndex, z, (normalizedTimeIndex)}, dataToWrite); + n5FSWriter.writeBlock(String.valueOf(jobID), datasetAttributes, doubleArrayDataBlock); + } + + + if(timeIndex % 2 == 0){ + progress = (double) (variableIndex + timeLoops) / (numVariables + numTimes + numTimes); exportServiceImpl.fireExportProgress(jobID, vcDataID, N5Specs.n5Suffix.toUpperCase(), progress); } + timeLoops += 1; + } + } + + // write mask + for(int timeIndex = timeSpecs.getBeginTimeIndex(); timeIndex <= timeSpecs.getEndTimeIndex(); timeIndex++){ + int normalizedTimeIndex = timeIndex - timeSpecs.getBeginTimeIndex(); + + for (int z = 0; z < sizeZ; z++){ + double[] writeData = MeshToImage.getXYFromXYZArray(mask, sizeX, sizeY, z); + DoubleArrayDataBlock doubleArrayDataBlock = new DoubleArrayDataBlock(blockSize, new long[]{0, 0, (numVariables - 1), z, normalizedTimeIndex}, writeData); + n5FSWriter.writeBlock(String.valueOf(jobID), datasetAttributes, doubleArrayDataBlock); + } + if(timeIndex % 2 == 0){ + progress = (double) (progress + timeLoops) / (numVariables + numTimes + numTimes); + exportServiceImpl.fireExportProgress(jobID, vcDataID, N5Specs.n5Suffix.toUpperCase(), progress); } + timeLoops += 1; } n5FSWriter.close(); ExportOutput exportOutput = new ExportOutput(true, "." + N5Specs.n5Suffix, vcDataID.getID(), getN5FileNameHash(), fileDataContainerManager); return exportOutput; } + private boolean containsPostProcessedVariable(String[] variableNames, OutputContext outputContext) throws IOException, DataAccessException { + for (String variableName: variableNames){ + DataIdentifier specie = getSpecificDI(variableName, outputContext); + if(specie.getVariableType().compareEqual(VariableType.POSTPROCESSING)){ + return true; + } else if (unsupportedTypes.contains(specie.getVariableType())) { + throw new RuntimeException("Attempting to export unsupported type of: " + specie.getVariableType().getTypeName() + ". The variable with this type is: " + variableName); + } + } + return false; + } + public void initalizeDataControllers(User user, DataServerImpl dataServer, VCSimulationDataIdentifier vcSimulationDataIdentifier) throws IOException, DataAccessException { this.user = user; this.vcDataID = vcSimulationDataIdentifier; diff --git a/vcell-core/src/main/java/cbit/vcell/export/server/N5Specs.java b/vcell-core/src/main/java/cbit/vcell/export/server/N5Specs.java index 9a12889713..eaee030b85 100644 --- a/vcell-core/src/main/java/cbit/vcell/export/server/N5Specs.java +++ b/vcell-core/src/main/java/cbit/vcell/export/server/N5Specs.java @@ -94,10 +94,12 @@ public String toString() { } public static void writeImageJMetaData(long jobID,long[] dimensions, int[] blockSize, Compression compression, N5FSWriter n5FSWriter, String datasetName, int numChannels, int zSlices, - int timeLength, HashMap maskMapping) throws MathException, DataAccessException { + int timeLength, HashMap maskMapping, double pixelHeight, + double pixelWidth, double pixelDepth, String unit, HashMap channelInfo) throws MathException, DataAccessException { try { HashMap compresssionMap = new HashMap<>(){{put("type", compression.getType().toLowerCase());}}; - ImageJMetaData imageJMetaData = ImageJMetaData.generateDefaultRecord(dimensions, blockSize, compresssionMap, datasetName, numChannels, zSlices, timeLength, maskMapping); + ImageJMetaData imageJMetaData = ImageJMetaData.generateDefaultRecord(dimensions, blockSize, compresssionMap, datasetName, numChannels, zSlices, timeLength, + maskMapping, pixelHeight, pixelWidth, pixelDepth, unit, channelInfo); Path path = Path.of(n5FSWriter.getURI().getPath(), String.valueOf(jobID), "attributes.json"); Gson gson = n5FSWriter.getGson(); String jsonRepresentation = gson.toJson(imageJMetaData, ImageJMetaData.class); @@ -112,16 +114,17 @@ public static void writeImageJMetaData(long jobID,long[] dimensions, int[] block record ImageJMetaData(long[] dimensions ,int[] blockSize, HashMap compression, String dataType, String name, double fps, double frameInterval, double pixelWidth, double pixelHeight, double pixelDepth, double xOrigin, double yOrigin, double zOrigin, int numChannels, int numSlices, int numFrames, - int type, String unit, HashMap maskMapping){ + int type, String unit, HashMap maskMapping, HashMap channelInfo){ // https://github.com/saalfeldlab/n5 //https://imagej.nih.gov/ij/developer/api/ij/ij/ImagePlus.html#getType() Grayscale with float types //https://imagej.nih.gov/ij/developer/api/ij/ij/measure/Calibration.html#getUnit() public static ImageJMetaData generateDefaultRecord(long[] dimensions ,int[] blockSize, HashMap compression, String dataSetName, int numChannels, - int numSlices, int numFrames, HashMap maskMapping){ + int numSlices, int numFrames, HashMap maskMapping, double pixelHeight, double pixelWidth, + double pixelDepth, String unit, HashMap channelInfo){ return new ImageJMetaData(dimensions, blockSize, compression, DataType.FLOAT64.name().toLowerCase() ,dataSetName, 0.0, 0.0, - 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, numChannels, numSlices, numFrames, 2, "uM", maskMapping); + pixelWidth, pixelHeight, pixelDepth, 0.0, 0.0, 0.0, numChannels, numSlices, numFrames, 2, unit, maskMapping, channelInfo); } } diff --git a/vcell-core/src/test/java/cbit/vcell/export/MeshToImageTest.java b/vcell-core/src/test/java/cbit/vcell/export/MeshToImageTest.java new file mode 100644 index 0000000000..ec10d53b94 --- /dev/null +++ b/vcell-core/src/test/java/cbit/vcell/export/MeshToImageTest.java @@ -0,0 +1,61 @@ +package cbit.vcell.export; + + +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +import java.util.Random; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + + +@Tag("Fast") +public class MeshToImageTest { + + + + @Test + public void testMeshToImage2D(){ + // 3x4 + final double[] exampleData = {0,1,2,3, 4,5,6,7, 8,9,10,11}; + final double[] expectedTransformation = {0,1,1,2, 3,4,4,5, 3,4,4,5, 6,7,7,8, 6,7,7,8, 9,10,10,11}; + MeshToImage.ImageData result = MeshToImage.convertMeshIntoImage(exampleData, 3, 4, 0, false); + + assertArrayEquals(expectedTransformation, result.data()); + } + + @Test + public void testMeshToImage3D(){ + final double[] exampleData = {0,1, 2,3, 4,5, 6,7, 8,9, 10,11, 12,13, 14,15, 16,17, 18,19, 20,21, 22,23}; + final double[] expectedTransformation = {0, 1, 2, 3, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 14, 15, 14, 15, 16, 17, 12, 13, 14, 15, 14, 15, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23}; + MeshToImage.ImageData result = MeshToImage.convertMeshIntoImage(exampleData, 2, 3, 4, true); + + assertArrayEquals(expectedTransformation, result.data()); + } + + + @Test + public void testFullRound(){ + double[] exampleMesh = {0, 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15,16,17,18,19}; + MeshToImage.ImageData imageResult = MeshToImage.convertMeshIntoImage(exampleMesh, 4, 5, 1, false); + MeshToImage.MeshData meshResult = MeshToImage.convertImageIntoMesh(imageResult.data(), 6, 8, 1, false); + assertArrayEquals(exampleMesh, meshResult.data()); + + Random random = new Random(); + exampleMesh = random.doubles(24).toArray(); + imageResult = MeshToImage.convertMeshIntoImage(exampleMesh, 4, 6, 1, false); + meshResult = MeshToImage.convertImageIntoMesh(imageResult.data(), 6, 10, 1, false); + assertArrayEquals(exampleMesh, meshResult.data()); + + + final double[] exampleImage = {0, 1, 1, 2, 3, 4, 4, 5, 3,4,4,5, 6,7,7,8,6,7,7,8, 9,10,10,11}; + meshResult = MeshToImage.convertImageIntoMesh(exampleImage, 4, 6, 1, false); + imageResult = MeshToImage.convertMeshIntoImage(meshResult.data(), 3, 4, 1, false); + + assertArrayEquals(exampleImage, imageResult.data()); + } + + + + +} diff --git a/vcell-core/src/test/java/cbit/vcell/export/N5ExporterTest.java b/vcell-core/src/test/java/cbit/vcell/export/N5ExporterTest.java index 3590c3730a..ae26485fe4 100644 --- a/vcell-core/src/test/java/cbit/vcell/export/N5ExporterTest.java +++ b/vcell-core/src/test/java/cbit/vcell/export/N5ExporterTest.java @@ -41,6 +41,17 @@ @Tag("Fast") public class N5ExporterTest { + enum TestModels{ + fourDModel("597714292"), + fiveDModel("868220316"), // Ezequiel's Blank 3D Model + fiveDModelPostProcess("868220316"); + + private final String simID; + TestModels(String simID){ + this.simID = simID; + } + } + private N5Reader n5Reader; private DataServerImpl dataServer; private VCSimulationDataIdentifier vcDataID; @@ -49,12 +60,7 @@ public class N5ExporterTest { private User testUser; private CartesianMesh modelMesh; private double[] times; - private static final String fourDModelID = "597714292"; - private static final String fiveDModelID = "1136922340"; - private final ArrayList testModels = new ArrayList<>(Arrays.asList( - fourDModelID, //FRAP Tutorial in VCell, has no Z axis - fiveDModelID //PH-GFP Tutorial in VCell - )); + private ArrayList dataIdentifiers; @@ -93,9 +99,9 @@ public void setUp() throws IOException { File n5ExportDir = new File(temporaryFolder.getAbsolutePath() + "/N5DataExporter"); n5ExportDir.mkdir(); - for(String model: testModels){ + for(TestModels model: TestModels.values()){ for(String extension: fileExtensions){ - String currentFileNameString = String.format(simFileNameTemplate, model, extension); + String currentFileNameString = String.format(simFileNameTemplate, model.simID, extension); InputStream inputStream = Objects.requireNonNull(N5ExporterTest.class.getResourceAsStream("/simdata/n5/ezequiel23/" + currentFileNameString)); File currentFile = new File(tmpSimDataDir.getAbsolutePath() + "/" + currentFileNameString); org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, currentFile); @@ -192,31 +198,22 @@ public void makeN5FileWithSpecificSimulationResults(N5Specs.CompressionLevel com this.n5Reader = new N5FSReader(n5Exporter.getN5FileAbsolutePath()); } - public void setExportTestState(String simKeyID) throws IOException, DataAccessException, MathException { - VCSimulationIdentifier vcSimulationIdentifier = simKeyID.equals(fourDModelID) ? new VCSimulationIdentifier(new KeyValue(fourDModelID), testUser) : - new VCSimulationIdentifier(new KeyValue(fiveDModelID), testUser); + private void setExportTestState(TestModels simModel) throws IOException, DataAccessException, MathException { + VCSimulationIdentifier vcSimulationIdentifier = new VCSimulationIdentifier(new KeyValue(simModel.simID), testUser); + vcDataID = new VCSimulationDataIdentifier(vcSimulationIdentifier, 0); n5Exporter.initalizeDataControllers(testUser, dataServer, vcDataID); dataIdentifiers = new ArrayList<>(Arrays.asList(dataServer.getDataIdentifiers(new OutputContext(new AnnotatedFunction[0]), testUser, vcDataID))); modelMesh = dataServer.getMesh(testUser, vcDataID); times = dataServer.getDataSetTimes(testUser, vcDataID); - if (simKeyID.equals(fourDModelID)){ - // the test model can only support one species at this time + if (simModel == TestModels.fiveDModelPostProcess) { this.variables = new ArrayList<>(Arrays.asList( - getRandomDISpecificVariable(VariableType.VOLUME), - getRandomDISpecificVariable(VariableType.VOLUME_REGION), - getRandomDISpecificVariable(VariableType.MEMBRANE_REGION), - getRandomDI() + getRandomDISpecificVariable(VariableType.POSTPROCESSING) )); - } - else if (simKeyID.equals(fiveDModelID)){ + } else { this.variables = new ArrayList<>(Arrays.asList( - getRandomDISpecificVariable(VariableType.VOLUME), - getRandomDISpecificVariable(VariableType.POSTPROCESSING), - getRandomDISpecificVariable(VariableType.VOLUME_REGION), - getRandomDISpecificVariable(VariableType.MEMBRANE_REGION), - getRandomDI() + getRandomDISpecificVariable(VariableType.VOLUME) )); } } @@ -225,60 +222,40 @@ else if (simKeyID.equals(fiveDModelID)){ @Test public void testMetaData() throws Exception { - for(String model: testModels){ + for(TestModels model: TestModels.values()){ this.setExportTestState(model); - this.makeN5FileWithSpecificSimulationResults(N5Specs.CompressionLevel.RAW, 0, times.length - 1, model); + this.makeN5FileWithSpecificSimulationResults(N5Specs.CompressionLevel.RAW, 0, times.length - 1, model.simID); + + int sizeX = modelMesh.getSizeX(), + sizeY = modelMesh.getSizeY(), + sizeZ = modelMesh.getSizeZ(); + + if(!model.equals(TestModels.fiveDModelPostProcess)){ + sizeX = MeshToImage.newNumElements(sizeX); + sizeY = MeshToImage.newNumElements(sizeY); + sizeZ = MeshToImage.newNumElements(sizeZ); + } + + //X, Y, T, Z, Channels - long[] controlDimensions = {modelMesh.getSizeX(), modelMesh.getSizeY(), variables.size() + 1, modelMesh.getSizeZ(), times.length}; + long[] controlDimensions = {sizeX, sizeY, variables.size() + 1, sizeZ, times.length}; // tests the metadata, and the metadata may be accurate but the actual raw array of data may be wrong - DatasetAttributes datasetAttributes = n5Reader.getDatasetAttributes(model); + DatasetAttributes datasetAttributes = n5Reader.getDatasetAttributes(model.simID); long[] exportDimensions = datasetAttributes.getDimensions(); assertArrayEquals(controlDimensions, exportDimensions, "Testing dimension results for model " + model); - ((N5FSReader) n5Reader).getAttributes(model); + ((N5FSReader) n5Reader).getAttributes(model.simID); - LinkedTreeMap dummyMaskInfo = (LinkedTreeMap)((N5FSReader) n5Reader).getAttribute(model, N5Specs.maskingMetaDataName, LinkedTreeMap.class); + LinkedTreeMap dummyMaskInfo = (LinkedTreeMap)((N5FSReader) n5Reader).getAttribute(model.simID, N5Specs.maskingMetaDataName, LinkedTreeMap.class); assertSame(DataType.FLOAT64, datasetAttributes.getDataType(),"Data Type of model " + model); assert("Dummy".equals(dummyMaskInfo.get("0"))); assert("Test".equals(dummyMaskInfo.get("1"))); - int[] expectedBlockSize = {modelMesh.getSizeX(), modelMesh.getSizeY(), 1, modelMesh.getSizeZ(), 1}; + int[] expectedBlockSize = {sizeX, sizeY, 1, 1, 1}; assertArrayEquals(expectedBlockSize, datasetAttributes.getBlockSize(),"Block Size of model " + model); } } - @Test - public void testRandomTimeSlices() throws Exception { - for (String model: testModels){ - setExportTestState(model); - for (int k=0; k<8; k++){ //try 8 randomly chosen time slice combinations - Random random = new Random(); - int startTimeIndex = random.nextInt(0, times.length); - int endTimeIndex = random.nextInt(startTimeIndex, times.length); - OutputContext outputContext = new OutputContext(new AnnotatedFunction[0]); - - makeN5FileWithSpecificSimulationResults(N5Specs.CompressionLevel.RAW, startTimeIndex, endTimeIndex, model); - DatasetAttributes datasetAttributes = n5Reader.getDatasetAttributes(model); - long attributesTimeSize = startTimeIndex + (datasetAttributes.getDimensions()[4] - 1); //minus 1 since we are already starting at startTimeIndex - - for (int i = 0; i < variables.size(); i++){ - for(int timeSlice = startTimeIndex; timeSlice <= attributesTimeSize; timeSlice++){ - DataBlock dataBlock = n5Reader.readBlock(model, datasetAttributes, new long[]{0, 0, i + 1, 0, timeSlice - startTimeIndex}); - - double[] exportedRawData = (double[]) dataBlock.getData(); - assertArrayEquals( - dataServer.getSimDataBlock(outputContext, testUser, this.vcDataID, variables.get(i).getName(), times[timeSlice]).getData(), - exportedRawData, - 0, - "Equal raw data of model " + model + " with species " + variables.get(i).getName() + - " with type " + variables.get(i).getVariableType() + " at time " + timeSlice); - } - } - - } - } - } - @Test public void testRawDataEquivelance() throws Exception { // Is the histogram over entire slice of an image result in the same for both parties @@ -288,26 +265,8 @@ public void testRawDataEquivelance() throws Exception { //each block is entire XYZ, broken in time and channels - for(String model: testModels){ - this.setExportTestState(model); - OutputContext outputContext = new OutputContext(new AnnotatedFunction[0]); - int endTimeIndex = times.length - 1; - makeN5FileWithSpecificSimulationResults(N5Specs.CompressionLevel.RAW, 0, endTimeIndex, model); - - for(int i = 0; i < variables.size(); i++){ - for(int timeSlice = 0; timeSlice < times.length; timeSlice++){ - DatasetAttributes datasetAttributes = n5Reader.getDatasetAttributes(model); - DataBlock dataBlock = n5Reader.readBlock(model, datasetAttributes, new long[]{0, 0, i + 1, 0, timeSlice}); - - double[] exportedRawData = (double[]) dataBlock.getData(); - assertArrayEquals( - dataServer.getSimDataBlock(outputContext, testUser, this.vcDataID, variables.get(i).getName(), times[timeSlice]).getData(), - exportedRawData, - 0, - "Equal raw data of model " + model + " with species " + variables.get(i).getName() + - " with type " + variables.get(i).getVariableType() + " at time " + timeSlice); - } - } + for(TestModels model: TestModels.values()){ + compareData(N5Specs.CompressionLevel.RAW, model, model.equals(TestModels.fiveDModelPostProcess)); } } @@ -319,32 +278,61 @@ public void testDataCompressionEquivelance() throws Exception { N5Specs.CompressionLevel.BZIP, N5Specs.CompressionLevel.GZIP )); - Random random = new Random(5); for (N5Specs.CompressionLevel compression: compressions){ - for(String model: testModels){ - setExportTestState(model); - int endTimeIndex = times.length - 1; - makeN5FileWithSpecificSimulationResults(compression, 0 , endTimeIndex, model); - OutputContext outputContext = new OutputContext(new AnnotatedFunction[0]); - DatasetAttributes datasetAttributes = n5Reader.getDatasetAttributes(model); - for(int j = 0; j< 8; j++){ - int timeSlice = random.nextInt(endTimeIndex); - int chosenVariable = random.nextInt(variables.size()); - DataBlock dataBlock = n5Reader.readBlock(model, datasetAttributes, new long[]{0, 0, chosenVariable + 1, 0, timeSlice}); - - double[] exportedData = (double[]) dataBlock.getData(); - Assertions.assertArrayEquals( - dataServer.getSimDataBlock(outputContext, testUser, this.vcDataID, variables.get(chosenVariable).getName(), times[timeSlice]).getData(), - exportedData, - 0, - "Equal data with " + compression + " compression"); - } + for(TestModels model: TestModels.values()){ + compareData(compression, model, model.equals(TestModels.fiveDModelPostProcess)); } } } + private void compareData(N5Specs.CompressionLevel compressionLevel, TestModels model, boolean postProcessVariable) throws Exception { + this.setExportTestState(model); + OutputContext outputContext = new OutputContext(new AnnotatedFunction[0]); + int endTimeIndex = times.length - 1; + makeN5FileWithSpecificSimulationResults(compressionLevel, 0, endTimeIndex, model.simID); + + int sizeZ = postProcessVariable ? modelMesh.getSizeZ() : MeshToImage.newNumElements(modelMesh.getSizeZ()); + int sizeX = postProcessVariable ? modelMesh.getSizeX() : MeshToImage.newNumElements(modelMesh.getSizeX()); + int sizeY = postProcessVariable ? modelMesh.getSizeY() : MeshToImage.newNumElements(modelMesh.getSizeY()); + + for(int i = 0; i < variables.size(); i++){ + for(int timeSlice = 0; timeSlice < times.length; timeSlice++){ + double[] constData = dataServer.getSimDataBlock(outputContext, testUser, this.vcDataID, variables.get(i).getName(), times[timeSlice]).getData(); + double[] meshToImage = MeshToImage.convertMeshIntoImage(constData, modelMesh).data(); + for (int z = 0; z < sizeZ; z++){ + DatasetAttributes datasetAttributes = n5Reader.getDatasetAttributes(model.simID); + DataBlock dataBlock = n5Reader.readBlock(model.simID, datasetAttributes, new long[]{0, 0, i, z, timeSlice}); + + double[] testConst; + double[] exportedRawData = (double[]) dataBlock.getData(); + if(!postProcessVariable){ + double[] testMeshToImage = MeshToImage.getXYFromXYZArray(meshToImage, sizeX, sizeY, z); + double[] imageToMesh = MeshToImage.convertImageIntoMesh(exportedRawData, sizeX, sizeY, sizeZ, false).data(); + testConst = MeshToImage.getXYFromXYZArray(constData, modelMesh, (int) Math.ceil(z / 2.0)); + + assertArrayEquals(testMeshToImage, exportedRawData, 0, + "Data of model " + model + " with species " + variables.get(i).getName() + + " with type " + variables.get(i).getVariableType() + " at time " + timeSlice + + ". The compression is " + compressionLevel + " and conversion of mesh to image."); + + assertArrayEquals(testConst, imageToMesh, 0, + "Data of model " + model + " with species " + variables.get(i).getName() + + " with type " + variables.get(i).getVariableType() + " at time " + timeSlice + + ". The compression is " + compressionLevel + " and conversion of image to mesh."); + + } else{ + testConst = MeshToImage.getXYFromXYZArray(constData, modelMesh, z); + assertArrayEquals(testConst, exportedRawData, 0, + "Data of model " + model + " with species " + variables.get(i).getName() + + " with type " + variables.get(i).getVariableType() + " at time " + timeSlice); + } + } + } + } + } + public DataIdentifier getRandomDI() throws IOException, DataAccessException { Random random = new Random(); DataIdentifier df = dataIdentifiers.remove(random.nextInt(dataIdentifiers.size())); diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.functions b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.functions deleted file mode 100644 index 42c8243129..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.functions +++ /dev/null @@ -1,12 +0,0 @@ -##--------------------------------------------- -## /home/zeke/.vcell/simdata/temp/SimID_1136922340_0_.functions -##--------------------------------------------- - -Cyt::Dex_init_uM; (10.0 * ((x < -5.0) || (x > 5.0) || (y < -5.0) || (y > 5.0))); ; Volume_VariableType; false -Cyt::Size_Cyt; vcRegionVolume('Cyt'); ; Volume_Region_VariableType; false -EC::Size_EC; vcRegionVolume('EC'); ; Volume_Region_VariableType; false -Cyt_EC_membrane::Size_PM; vcRegionArea('Cyt_EC_membrane'); ; Membrane_Region_VariableType; false -Cyt_EC_membrane::sobj_Cyt1_EC0_size; vcRegionArea('Cyt_EC_membrane'); ; Membrane_Region_VariableType; false -Cyt::vobj_Cyt1_size; vcRegionVolume('Cyt'); ; Volume_Region_VariableType; false -EC::vobj_EC0_size; vcRegionVolume('EC'); ; Volume_Region_VariableType; false - diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.fvinput b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.fvinput deleted file mode 100644 index 92300f2b1b..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.fvinput +++ /dev/null @@ -1,72 +0,0 @@ -# Simulation Parameters -SIMULATION_PARAM_BEGIN -SOLVER SUNDIALS_PDE_SOLVER 1.0E-7 1.0E-9 0.01 -BASE_FILE_NAME /home/zeke/.vcell/simdata/temp/SimID_1136922340_0_ -ENDING_TIME 0.1 -TIME_STEP 0.05 -KEEP_EVERY 1 -SIMULATION_PARAM_END - -# Model description: FEATURE name handle boundary_conditions -MODEL_BEGIN -FEATURE Cyt 1 flux flux flux flux -FEATURE EC 0 flux flux flux flux -MEMBRANE Cyt_EC_membrane Cyt EC flux flux flux flux -MODEL_END - -# Mesh file -MESH_BEGIN -VCG_FILE /home/zeke/.vcell/simdata/temp/SimID_1136922340_0_.vcg -MESH_END - -# Variables : type name domain time_dependent_flag advection_flag grad_flag solve_whole_mesh_flag solve_regions -VARIABLE_BEGIN -VOLUME_PDE Dex Cyt false false false false Cyt -VARIABLE_END - - # Post Processing Block -POST_PROCESSING_BLOCK_BEGIN -GAUSSIAN_CONVOLUTION_DATA_GENERATOR fluor null 0.3 1.5 GAUSSIAN_CONVOLUTION_VOL_FUNCTION (602.214179 * Dex); GAUSSIAN_CONVOLUTION_MEM_FUNCTION 0.0; -POST_PROCESSING_BLOCK_END - -COMPARTMENT_BEGIN Cyt - -EQUATION_BEGIN Dex -INITIAL (10.0 * ((x < -5.0) || (x > 5.0) || (y < -5.0) || (y > 5.0))); -RATE 0.0; -DIFFUSION 0.0; -VELOCITY_X 0.0; -VELOCITY_Y 0.0; -BOUNDARY_XM 0.0; -BOUNDARY_XP 0.0; -BOUNDARY_YM 0.0; -BOUNDARY_YP 0.0; -EQUATION_END - -COMPARTMENT_END - -COMPARTMENT_BEGIN EC - -EQUATION_BEGIN Dex -INITIAL 0.0; -RATE 0.0; -DIFFUSION 0.0; -VELOCITY_X 0.0; -VELOCITY_Y 0.0; -BOUNDARY_XM 0.0; -BOUNDARY_XP 0.0; -BOUNDARY_YM 0.0; -BOUNDARY_YP 0.0; -EQUATION_END - -COMPARTMENT_END - - -MEMBRANE_BEGIN Cyt_EC_membrane Cyt EC - -JUMP_CONDITION_BEGIN Dex -FLUX Cyt 0.0; -JUMP_CONDITION_END - -MEMBRANE_END - diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.hdf5 b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.hdf5 deleted file mode 100644 index 86ba045112..0000000000 Binary files a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.hdf5 and /dev/null differ diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.log b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.log deleted file mode 100644 index c9dea8e5ce..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.log +++ /dev/null @@ -1,3 +0,0 @@ - 0 SimID_1136922340_0_0000.sim SimID_1136922340_0_00.zip 0 - 1 SimID_1136922340_0_0001.sim SimID_1136922340_0_00.zip 0.05 - 2 SimID_1136922340_0_0002.sim SimID_1136922340_0_00.zip 0.1 diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.mesh b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.mesh deleted file mode 100644 index 3726816f51..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.mesh +++ /dev/null @@ -1,62 +0,0 @@ -Version 1.2 -CartesianMesh { - // X Y Z - Size 10 10 1 - Extent 22 22 1 - Origin -11 -11 0 - - VolumeRegionsMapSubvolume { - 2 - //VolRegID SubvolID Volume - 0 0 173.28395061728389 //EC - 1 1 310.71604938271599 //Cyt - } - - MembraneRegionsMapVolumeRegion { - 1 - //MemRegID VolReg1 VolReg2 Surface - 0 1 0 61.449163118365306 - } - - VolumeElementsMapVolumeRegion { - 100 Compressed - 789C6360C00518A110530421CA88062915C3660776B7A00300154C0035 - } - - MembraneElements { - 32 - //Indx Vol1 Vol2 Conn0 Conn1 Conn2 Conn3 MemRegID - 0 13 3 1 4 -1 -1 0 - 1 14 4 2 0 -1 -1 0 - 2 15 5 3 1 -1 -1 0 - 3 16 6 6 2 -1 -1 0 - 4 13 12 5 0 -1 -1 0 - 5 22 12 4 8 -1 -1 0 - 6 16 17 7 3 -1 -1 0 - 7 27 17 10 6 -1 -1 0 - 8 22 21 9 5 -1 -1 0 - 9 31 21 8 12 -1 -1 0 - 10 27 28 11 7 -1 -1 0 - 11 38 28 13 10 -1 -1 0 - 12 31 30 14 9 -1 -1 0 - 13 38 39 15 11 -1 -1 0 - 14 41 40 16 12 -1 -1 0 - 15 48 49 17 13 -1 -1 0 - 16 51 50 18 14 -1 -1 0 - 17 58 59 20 15 -1 -1 0 - 18 61 60 19 16 -1 -1 0 - 19 61 71 22 18 -1 -1 0 - 20 68 69 21 17 -1 -1 0 - 21 68 78 20 24 -1 -1 0 - 22 72 71 23 19 -1 -1 0 - 23 72 82 26 22 -1 -1 0 - 24 77 78 25 21 -1 -1 0 - 25 77 87 24 30 -1 -1 0 - 26 83 82 27 23 -1 -1 0 - 27 83 93 28 26 -1 -1 0 - 28 84 94 29 27 -1 -1 0 - 29 85 95 31 28 -1 -1 0 - 30 86 87 31 25 -1 -1 0 - 31 86 96 30 29 -1 -1 0 - } -} diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.meshmetrics b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.meshmetrics deleted file mode 100644 index 9c97e7b6d8..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.meshmetrics +++ /dev/null @@ -1,36 +0,0 @@ -MembraneElements { -32 -Index RegionIndex X Y Z Area Nx Ny Nz -0 0 -3.6666666666666661 -9.7777777777777786 0.5 2.008187176477477 0.38268343236508989 0.92387953251128674 0 -1 0 -1.2222222222222214 -9.7777777777777786 0.5 2.381704699453576 0.13273315102540861 0.99115181007697606 0 -2 0 1.2222222222222232 -9.7777777777777786 0.5 2.381704699453576 -0.13273315102540856 0.99115181007697606 0 -3 0 3.6666666666666679 -9.7777777777777786 0.5 2.008187176477477 -0.38268343236508978 0.92387953251128674 0 -4 0 -4.8888888888888884 -8.5555555555555554 0.5 1.5878796607629599 -0.44721359549995798 -0.89442719099991597 0 -5 0 -6.1111111111111107 -7.333333333333333 0.5 1.7033738531016489 0.62572739359138818 0.78004181228273151 0 -6 0 4.8888888888888911 -8.5555555555555554 0.5 1.5878796607629599 -0.44721359549995809 0.89442719099991574 0 -7 0 6.1111111111111143 -7.333333333333333 0.5 1.7033738531016489 -0.62572739359138829 0.78004181228273139 0 -8 0 -7.333333333333333 -6.1111111111111107 0.5 1.7033738531016489 -0.78004181228273151 -0.62572739359138818 0 -9 0 -8.5555555555555554 -4.8888888888888884 0.5 1.5878796607629599 0.89442719099991597 0.44721359549995798 0 -10 0 7.3333333333333357 -6.1111111111111107 0.5 1.7033738531016489 -0.78004181228273162 0.62572739359138807 0 -11 0 8.5555555555555571 -4.8888888888888884 0.5 1.5878796607629599 -0.89442719099991597 0.44721359549995782 0 -12 0 -9.7777777777777786 -3.6666666666666661 0.5 2.008187176477477 -0.92387953251128674 -0.38268343236508989 0 -13 0 9.7777777777777786 -3.6666666666666661 0.5 2.008187176477477 -0.92387953251128685 0.38268343236508962 0 -14 0 -9.7777777777777786 -1.2222222222222214 0.5 2.381704699453576 -0.99115181007697606 -0.13273315102540861 0 -15 0 9.7777777777777786 -1.2222222222222214 0.5 2.381704699453576 -0.99115181007697606 0.13273315102540856 0 -16 0 -9.7777777777777786 1.2222222222222232 0.5 2.381704699453576 -0.99115181007697606 0.13273315102540856 0 -17 0 9.7777777777777786 1.2222222222222232 0.5 2.381704699453576 -0.99115181007697606 -0.13273315102540847 0 -18 0 -9.7777777777777786 3.6666666666666679 0.5 2.008187176477477 -0.92387953251128674 0.38268343236508978 0 -19 0 -8.5555555555555554 4.8888888888888911 0.5 1.5878796607629599 -0.89442719099991574 0.44721359549995809 0 -20 0 9.7777777777777786 3.6666666666666679 0.5 2.008187176477477 -0.92387953251128685 -0.38268343236508956 0 -21 0 8.5555555555555571 4.8888888888888911 0.5 1.5878796607629599 0.89442719099991586 0.44721359549995798 0 -22 0 -7.333333333333333 6.1111111111111143 0.5 1.7033738531016489 -0.78004181228273139 0.62572739359138829 0 -23 0 -6.1111111111111107 7.3333333333333357 0.5 1.7033738531016489 -0.62572739359138807 0.78004181228273162 0 -24 0 7.3333333333333357 6.1111111111111143 0.5 1.7033738531016489 -0.78004181228273151 -0.62572739359138818 0 -25 0 6.1111111111111143 7.3333333333333357 0.5 1.7033738531016489 0.62572739359138818 0.78004181228273151 0 -26 0 -4.8888888888888884 8.5555555555555571 0.5 1.5878796607629599 -0.44721359549995782 0.89442719099991597 0 -27 0 -3.6666666666666661 9.7777777777777786 0.5 2.008187176477477 -0.38268343236508962 0.92387953251128685 0 -28 0 -1.2222222222222214 9.7777777777777786 0.5 2.381704699453576 -0.13273315102540856 0.99115181007697606 0 -29 0 1.2222222222222232 9.7777777777777786 0.5 2.381704699453576 0.13273315102540847 0.99115181007697606 0 -30 0 4.8888888888888911 8.5555555555555571 0.5 1.5878796607629599 -0.44721359549995798 -0.89442719099991586 0 -31 0 3.6666666666666679 9.7777777777777786 0.5 2.008187176477477 0.38268343236508956 0.92387953251128685 0 -} \ No newline at end of file diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.subdomains b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.subdomains deleted file mode 100644 index 13ff3d61a6..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.subdomains +++ /dev/null @@ -1,5 +0,0 @@ -# CompartmentSubDomain name, handle -# MembraneSubDomain name, inside compartment name, handle, outside compartment name, handle -CompartmentSubDomain, Cyt, 1 -CompartmentSubDomain, EC, 0 -MembraneSubDomain, Cyt_EC_membrane, Cyt, 1, EC, 0 diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.vcg b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.vcg deleted file mode 100644 index 986bffd08a..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_.vcg +++ /dev/null @@ -1,44 +0,0 @@ -name FRAP_geometry1970985432 -dimension 2 -size 22.0 22.0 -origin -11.0 -11.0 -volumeRegions 2 -EC0 173.28395061728395 0 -Cyt1 310.7160493827161 1 -membraneRegions 1 -membrane_EC0_Cyt1 59.9103589456927 1 0 -volumeSamples 10 10 -789C6360C00518A110530421CA88062915C3660776B7A00300154C0035 -cells 32 -0 3 13 1.9095139572219064 -2.9743924702885263 -9.062891283852991 5.0 0.3104580292504663 0.9505870881060381 0.0 -1 4 14 2.0760844240365985 -1.0334064070709097 -9.457297293239069 5.0 0.0944027499641442 0.9955340882155705 0.0 -2 5 15 2.0760844240365985 1.033406407070914 -9.457297293239069 5.0 -0.0944027499641442 0.9955340882155705 0.0 -3 6 16 1.9095139572219069 2.9743924702885307 -9.062891283852991 5.0 -0.3104580292504662 0.9505870881060381 0.0 -4 12 13 1.7717867603751813 -4.634240739043877 -8.29861286331693 5.0 0.5281295255240581 0.8491638265197907 0.0 -5 12 22 1.7314097265779016 -6.034024473474941 -7.256143004035455 5.0 0.663740534568661 0.7479629020015017 0.0 -6 17 16 1.7717867603751816 4.634240739043882 -8.29861286331693 5.0 -0.528129525524058 0.8491638265197907 0.0 -7 17 27 1.7314097265779007 6.034024473474945 -7.256143004035454 5.0 -0.6637405345686613 0.7479629020015015 0.0 -8 21 22 1.7314097265779016 -7.256143004035454 -6.03402447347494 5.0 0.7479629020015017 0.663740534568661 0.0 -9 21 31 1.7717867603751813 -8.29861286331693 -4.634240739043877 5.0 0.8491638265197907 0.5281295255240581 0.0 -10 28 27 1.7314097265779005 7.256143004035459 -6.03402447347494 5.0 -0.7479629020015022 0.6637405345686604 0.0 -11 28 38 1.771786760375181 8.298612863316931 -4.634240739043877 5.0 -0.8491638265197909 0.5281295255240577 0.0 -12 30 31 1.9095139572219064 -9.062891283852991 -2.9743924702885263 5.0 0.9505870881060381 0.3104580292504663 0.0 -13 39 38 1.9095139572219064 9.062891283852993 -2.9743924702885263 5.0 -0.9505870881060381 0.3104580292504663 0.0 -14 40 41 2.0760844240365985 -9.457297293239069 -1.0334064070709097 5.0 0.9955340882155704 0.0944027499641442 0.0 -15 49 48 2.0760844240365985 9.457297293239069 -1.0334064070709097 5.0 -0.9955340882155704 0.0944027499641442 0.0 -16 50 51 2.0760844240365985 -9.457297293239069 1.0334064070709135 5.0 0.9955340882155705 -0.0944027499641442 0.0 -17 59 58 2.0760844240365985 9.457297293239069 1.0334064070709135 5.0 -0.9955340882155705 -0.0944027499641442 0.0 -18 60 61 1.9095139572219069 -9.062891283852991 2.9743924702885303 5.0 0.9505870881060381 -0.3104580292504662 0.0 -19 71 61 1.7717867603751813 -8.29861286331693 4.634240739043881 5.0 0.8491638265197907 -0.5281295255240581 0.0 -20 69 68 1.9095139572219069 9.062891283852993 2.9743924702885303 5.0 -0.9505870881060381 -0.3104580292504662 0.0 -21 78 68 1.771786760375181 8.298612863316931 4.634240739043881 5.0 -0.8491638265197909 -0.5281295255240577 0.0 -22 71 72 1.7314097265779016 -7.256143004035455 6.034024473474945 5.0 0.7479629020015017 -0.663740534568661 0.0 -23 82 72 1.7314097265779016 -6.034024473474941 7.25614300403546 5.0 0.663740534568661 -0.7479629020015017 0.0 -24 78 77 1.7314097265779005 7.256143004035458 6.034024473474945 5.0 -0.7479629020015022 -0.6637405345686604 0.0 -25 87 77 1.7314097265779007 6.034024473474945 7.25614300403546 5.0 -0.6637405345686613 -0.7479629020015015 0.0 -26 82 83 1.771786760375181 -4.634240739043877 8.298612863316933 5.0 0.5281295255240577 -0.8491638265197909 0.0 -27 93 83 1.9095139572219064 -2.9743924702885263 9.062891283852995 5.0 0.3104580292504663 -0.9505870881060381 0.0 -28 94 84 2.0760844240365985 -1.0334064070709097 9.457297293239073 5.0 0.0944027499641442 -0.9955340882155705 0.0 -29 95 85 2.0760844240365985 1.033406407070914 9.457297293239073 5.0 -0.0944027499641442 -0.9955340882155705 0.0 -30 87 86 1.7717867603751813 4.634240739043882 8.298612863316933 5.0 -0.5281295255240576 -0.8491638265197909 0.0 -31 96 86 1.9095139572219069 2.9743924702885307 9.062891283852995 5.0 -0.3104580292504662 -0.9505870881060381 0.0 diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_00.zip b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_00.zip deleted file mode 100644 index 406c944e22..0000000000 Binary files a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0_00.zip and /dev/null differ diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0__0.simtask.xml b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0__0.simtask.xml deleted file mode 100644 index a18b6a7f71..0000000000 --- a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_1136922340_0__0.simtask.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - cloned from 'FRAP_130359' owned by user tutorial -cloned from 'FRAP_130359' owned by user ACowan -cloned from 'FRAP_130359' owned by user Education -cloned from 'FRAP_130359' owned by user tutorial -cloned from 'FRAP_130359' owned by user susan - 96485.3321 - 9.64853321E-5 - 1.0E-9 - 6.02214179E11 - 3.141592653589793 - 8314.46261815 - 300.0 - 1.0 - 20.0 - 1000.0 - 0.001660538783162726 - (1.0 * pow(KMOLE,-1.0)) - 0.0 - 1.0 - 1.0 - - (10.0 * ((x < - 5.0) || (x > 5.0) || (y < - 5.0) || (y > 5.0))) - (VolumePerUnitVolume_Cyt * vcRegionVolume('Cyt')) - (VolumePerUnitVolume_EC * vcRegionVolume('EC')) - (AreaPerUnitArea_PM * vcRegionArea('Cyt_EC_membrane')) - vcRegionArea('Cyt_EC_membrane') - vcRegionVolume('Cyt') - vcRegionVolume('EC') - - - - - - - - - 0.0 - Dex_diffusionRate - Dex_init_uM - - - - - - - - - - - - - - - - - - - 0.0 - 0.0 - - - - - - cloned from 'FRAP_130359' owned by user tutorial -cloned from 'FRAP_130359' owned by user ACowan -cloned from 'FRAP_130359' owned by user Education -cloned from 'FRAP_130359' owned by user tutorial -cloned from 'FRAP_130359' owned by user susan - - - - - 0.3 - 1.5 - - (0.0 + (Dex * UnitFactor_molecules_um_neg_3_uM_neg_1)) - 0.0 - - - - - cloned from 'FRAP' owned by user tutorial -cloned from 'FRAP' owned by user ACowan -cloned from 'FRAP 1' owned by user Education -cloned from 'FRAP 1' owned by user tutorial -FRAP Simulation for tutorial. - - - - - - - 2 - - 1 - - - 0.0 to 20.0, 4 values - - - - - - - - - - - cloned from 'FRAP_geometry171328045' owned by user tutorial -cloned from 'FRAP_geometry171328045' owned by user ACowan -cloned from 'FRAP_geometry' owned by user Education -cloned from 'FRAP_geometry' owned by user tutorial -cloned from 'FRAP_geometry' owned by user susan - - - - (((x * x) + (y * y)) < 100.0) - - - 1.0 - - - - - - - - - - - cloned from 'FRAP_geometry171328045' owned by user tutorial -cloned from 'FRAP_geometry171328045' owned by user ACowan -cloned from 'FRAP_geometry' owned by user Education -cloned from 'FRAP_geometry' owned by user tutorial -cloned from 'FRAP_geometry' owned by user susan - - - \ No newline at end of file diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.functions b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.functions new file mode 100644 index 0000000000..59a6a7c139 --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.functions @@ -0,0 +1,12 @@ +##--------------------------------------------- +## /Users/evalencia/.vcell/simdata/temp/SimID_868220316_0_.functions +##--------------------------------------------- + +subdomain0::J_r0; s0; ; Volume_VariableType; false +subdomain0::s0_init_uM; (x + (5.0 * y) + (25.0 * z)); ; Volume_VariableType; false +subdomain0::s1_init_uM; (x < y); ; Volume_VariableType; false +subdomain0::Size_c0; vcRegionVolume('subdomain0'); ; Volume_Region_VariableType; false +subdomain0_subdomain1_membrane::sobj_subdomain11_subdomain00_size; vcRegionArea('subdomain0_subdomain1_membrane'); ; Membrane_Region_VariableType; false +subdomain0::vobj_subdomain00_size; vcRegionVolume('subdomain0'); ; Volume_Region_VariableType; false +subdomain1::vobj_subdomain11_size; vcRegionVolume('subdomain1'); ; Volume_Region_VariableType; false + diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.fvinput b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.fvinput new file mode 100644 index 0000000000..45aaa65578 --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.fvinput @@ -0,0 +1,183 @@ +# Simulation Parameters +SIMULATION_PARAM_BEGIN +SOLVER SUNDIALS_PDE_SOLVER 1.0E-7 1.0E-9 0.1 +BASE_FILE_NAME /Users/evalencia/.vcell/simdata/temp/SimID_868220316_0_ +ENDING_TIME 0.5 +TIME_STEP 0.1 +KEEP_EVERY 1 +SIMULATION_PARAM_END + +# Model description: FEATURE name handle boundary_conditions +MODEL_BEGIN +FEATURE subdomain1 1 value value value value value value +FEATURE subdomain0 0 flux flux flux flux flux flux +MEMBRANE subdomain0_subdomain1_membrane subdomain0 subdomain1 flux flux flux flux flux flux +MODEL_END + +# Mesh file +MESH_BEGIN +VCG_FILE /Users/evalencia/.vcell/simdata/temp/SimID_868220316_0_.vcg +MESH_END + +# Variables : type name domain time_dependent_flag advection_flag grad_flag solve_whole_mesh_flag solve_regions +VARIABLE_BEGIN +VOLUME_PDE s0 subdomain0 false false false false subdomain0 +VOLUME_PDE s1 subdomain0 false false false false subdomain0 +VOLUME_PDE SpeciesValue0 subdomain0 false false false false subdomain0 +VOLUME_PDE SpeciesValue1 subdomain0 false false false false subdomain0 +VARIABLE_END + + # Post Processing Block +POST_PROCESSING_BLOCK_BEGIN +GAUSSIAN_CONVOLUTION_DATA_GENERATOR fluor null 0.3 1.5 GAUSSIAN_CONVOLUTION_VOL_FUNCTION (602.214179 * s0); GAUSSIAN_CONVOLUTION_MEM_FUNCTION 0.0; +POST_PROCESSING_BLOCK_END + +COMPARTMENT_BEGIN subdomain1 + +EQUATION_BEGIN s0 +INITIAL 0.0; +RATE 0.0; +DIFFUSION 0.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +EQUATION_BEGIN s1 +INITIAL 0.0; +RATE 0.0; +DIFFUSION 0.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +EQUATION_BEGIN SpeciesValue0 +INITIAL 0.0; +RATE 0.0; +DIFFUSION 0.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +EQUATION_BEGIN SpeciesValue1 +INITIAL 0.0; +RATE 0.0; +DIFFUSION 0.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +COMPARTMENT_END + +COMPARTMENT_BEGIN subdomain0 + +EQUATION_BEGIN s0 +INITIAL (x + (5.0 * y) + (25.0 * z)); +RATE - s0; +DIFFUSION 10.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +EQUATION_BEGIN s1 +INITIAL (x < y); +RATE s0; +DIFFUSION 10.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +EQUATION_BEGIN SpeciesValue1 +INITIAL 1.0; +RATE 0.0; +DIFFUSION 10.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +EQUATION_BEGIN SpeciesValue0 +INITIAL 0.0; +RATE 0.0; +DIFFUSION 10.0; +VELOCITY_X 0.0; +VELOCITY_Y 0.0; +VELOCITY_Z 0.0; +BOUNDARY_XM 0.0; +BOUNDARY_XP 0.0; +BOUNDARY_YM 0.0; +BOUNDARY_YP 0.0; +BOUNDARY_ZM 0.0; +BOUNDARY_ZP 0.0; +EQUATION_END + +COMPARTMENT_END + + +MEMBRANE_BEGIN subdomain0_subdomain1_membrane subdomain0 subdomain1 + +JUMP_CONDITION_BEGIN s0 +FLUX subdomain0 0.0; +JUMP_CONDITION_END + +JUMP_CONDITION_BEGIN s1 +FLUX subdomain0 0.0; +JUMP_CONDITION_END + +JUMP_CONDITION_BEGIN SpeciesValue1 +FLUX subdomain0 0.0; +JUMP_CONDITION_END + +JUMP_CONDITION_BEGIN SpeciesValue0 +FLUX subdomain0 0.0; +JUMP_CONDITION_END + +MEMBRANE_END + diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.hdf5 b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.hdf5 new file mode 100644 index 0000000000..d45015088d Binary files /dev/null and b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.hdf5 differ diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.log b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.log new file mode 100644 index 0000000000..e911c88575 --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.log @@ -0,0 +1,6 @@ + 0 SimID_868220316_0_0000.sim SimID_868220316_0_00.zip 0 + 1 SimID_868220316_0_0001.sim SimID_868220316_0_00.zip 0.1 + 2 SimID_868220316_0_0002.sim SimID_868220316_0_00.zip 0.2 + 3 SimID_868220316_0_0003.sim SimID_868220316_0_00.zip 0.3 + 4 SimID_868220316_0_0004.sim SimID_868220316_0_00.zip 0.4 + 5 SimID_868220316_0_0005.sim SimID_868220316_0_00.zip 0.5 diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.mesh b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.mesh new file mode 100644 index 0000000000..e1ad165e26 --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.mesh @@ -0,0 +1,84 @@ +Version 1.2 +CartesianMesh { + // X Y Z + Size 5 5 5 + Extent 4 4 4 + Origin 0 0 0 + + VolumeRegionsMapSubvolume { + 2 + //VolRegID SubvolID Volume + 0 0 45 //subdomain0 + 1 1 19 //subdomain1 + } + + MembraneRegionsMapVolumeRegion { + 1 + //MemRegID VolReg1 VolReg2 Surface + 0 1 0 30.477682248937921 + } + + VolumeElementsMapVolumeRegion { + 125 Compressed + 789C6360A00C30C2694624363EF53075D858D4B1833800000A540014 + } + + MembraneElements { + 54 + //Indx Vol1 Vol2 Conn0 Conn1 Conn2 Conn3 MemRegID + 0 32 7 2 6 5 9 0 + 1 36 11 13 12 7 2 0 + 2 37 12 4 1 0 3 0 + 3 38 13 15 2 10 14 0 + 4 42 17 19 16 2 18 0 + 5 32 27 9 0 6 22 0 + 6 32 31 7 0 5 8 0 + 7 36 31 6 1 12 8 0 + 8 56 31 7 24 21 6 0 + 9 32 33 10 0 5 11 0 + 10 38 33 14 3 9 11 0 + 11 58 33 10 9 23 26 0 + 12 36 35 13 1 7 28 0 + 13 36 41 16 1 12 17 0 + 14 38 39 15 3 10 29 0 + 15 38 43 14 3 18 20 0 + 16 42 41 19 4 13 17 0 + 17 66 41 31 30 13 16 0 + 18 42 43 19 4 15 20 0 + 19 42 47 18 4 16 33 0 + 20 68 43 35 18 15 34 0 + 21 56 51 22 8 24 25 0 + 22 57 52 23 5 21 37 0 + 23 58 53 26 11 22 27 0 + 24 56 55 28 8 21 25 0 + 25 56 81 39 24 21 38 0 + 26 58 59 29 11 23 27 0 + 27 58 83 42 40 23 26 0 + 28 61 60 30 12 24 43 0 + 29 63 64 34 14 26 47 0 + 30 66 65 31 17 28 32 0 + 31 66 71 33 17 30 32 0 + 32 66 91 31 30 44 50 0 + 33 67 72 35 19 31 52 0 + 34 68 69 35 20 29 36 0 + 35 68 73 34 20 33 36 0 + 36 68 93 35 51 48 34 0 + 37 82 77 40 22 38 41 0 + 38 82 81 39 25 37 41 0 + 39 86 81 38 25 43 45 0 + 40 82 83 42 27 37 41 0 + 41 82 107 46 38 37 40 0 + 42 88 83 47 27 40 49 0 + 43 86 85 44 28 39 45 0 + 44 86 91 50 32 43 45 0 + 45 86 111 44 43 39 46 0 + 46 87 112 53 45 41 49 0 + 47 88 89 48 29 42 49 0 + 48 88 93 47 36 51 49 0 + 49 88 113 48 46 42 47 0 + 50 92 91 52 32 44 53 0 + 51 92 93 52 36 48 53 0 + 52 92 97 51 33 50 53 0 + 53 92 117 52 50 46 51 0 + } +} diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.meshmetrics b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.meshmetrics new file mode 100644 index 0000000000..86f00389cf --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.meshmetrics @@ -0,0 +1,58 @@ +MembraneElements { +54 +Index RegionIndex X Y Z Area Nx Ny Nz +0 0 2 1 0.5 0.46967716659593794 0 0.6676496470015556 0.74447562005662626 +1 0 1 2 0.5 0.469677166595938 0.6676496470015556 0 0.74447562005662626 +2 0 2 2 0.5 0.90906890097111304 0 0 1 +3 0 3 2 0.5 0.46967716659593806 -0.6676496470015556 0 0.74447562005662626 +4 0 2 3 0.5 0.46967716659593794 0 -0.6676496470015556 0.74447562005662626 +5 0 2 0.5 1 0.46967716659593794 0 0.74447562005662626 0.6676496470015556 +6 0 1.5 1 1 0.57295903520036329 -0.25056280708573153 -0.68455031944529776 -0.68455031944529776 +7 0 1 1.5 1 0.57295903520036329 0.68455031944529776 0.25056280708573153 0.68455031944529776 +8 0 1 1 1.5 0.57295903520036318 0.68455031944529787 0.68455031944529787 0.25056280708573159 +9 0 2.5 1 1 0.57295903520036306 -0.25056280708573153 0.68455031944529776 0.68455031944529776 +10 0 3 1.5 1 0.57295903520036318 -0.68455031944529776 0.25056280708573153 0.68455031944529776 +11 0 3 1 1.5 0.57295903520036306 -0.68455031944529787 0.68455031944529787 0.25056280708573159 +12 0 0.5 2 1 0.46967716659593794 -0.74447562005662626 0 -0.6676496470015556 +13 0 1 2.5 1 0.57295903520036329 -0.68455031944529776 0.25056280708573153 -0.68455031944529776 +14 0 3.5 2 1 0.46967716659593794 -0.74447562005662626 0 0.6676496470015556 +15 0 3 2.5 1 0.57295903520036329 0.68455031944529776 0.25056280708573153 -0.68455031944529776 +16 0 1.5 3 1 0.57295903520036318 -0.25056280708573153 0.68455031944529776 -0.68455031944529776 +17 0 1 3 1.5 0.57295903520036318 0.68455031944529787 -0.68455031944529787 0.25056280708573159 +18 0 2.5 3 1 0.57295903520036329 -0.25056280708573153 -0.68455031944529776 0.68455031944529776 +19 0 2 3.5 1 0.469677166595938 0 0.74447562005662626 -0.6676496470015556 +20 0 3 3 1.5 0.57295903520036329 -0.68455031944529787 -0.68455031944529787 0.25056280708573159 +21 0 1 0.5 2 0.469677166595938 0.6676496470015556 0.74447562005662626 0 +22 0 2 0.5 2 0.90906890097111293 0 1 0 +23 0 3 0.5 2 0.46967716659593806 -0.6676496470015556 0.74447562005662626 0 +24 0 0.5 1 2 0.46967716659593794 -0.74447562005662626 -0.6676496470015556 0 +25 0 1 1 2.5 0.57295903520036329 -0.68455031944529787 -0.68455031944529787 0.25056280708573159 +26 0 3.5 1 2 0.46967716659593794 -0.74447562005662626 0.6676496470015556 0 +27 0 3 1 2.5 0.57295903520036329 0.68455031944529787 -0.68455031944529787 0.25056280708573159 +28 0 0.5 2 2 0.90906890097111293 -1 0 0 +29 0 3.5 2 2 0.90906890097111304 -1 0 0 +30 0 0.5 3 2 0.46967716659593806 -0.74447562005662626 0.6676496470015556 0 +31 0 1 3.5 2 0.46967716659593794 -0.6676496470015556 0.74447562005662626 0 +32 0 1 3 2.5 0.57295903520036318 -0.68455031944529787 0.68455031944529787 0.25056280708573159 +33 0 2 3.5 2 0.90906890097111281 0 1 0 +34 0 3.5 3 2 0.46967716659593789 -0.74447562005662626 -0.6676496470015556 0 +35 0 3 3.5 2 0.46967716659593794 0.6676496470015556 0.74447562005662626 0 +36 0 3 3 2.5 0.57295903520036318 0.68455031944529787 0.68455031944529787 0.25056280708573159 +37 0 2 0.5 3 0.46967716659593794 0 0.74447562005662626 -0.6676496470015556 +38 0 1.5 1 3 0.57295903520036318 -0.25056280708573153 -0.68455031944529776 0.68455031944529776 +39 0 1 1.5 3 0.57295903520036329 0.68455031944529776 0.25056280708573153 -0.68455031944529776 +40 0 2.5 1 3 0.57295903520036318 -0.25056280708573153 0.68455031944529776 -0.68455031944529776 +41 0 2 1 3.5 0.469677166595938 0 -0.6676496470015556 0.74447562005662626 +42 0 3 1.5 3 0.57295903520036329 -0.68455031944529776 0.25056280708573153 -0.68455031944529776 +43 0 0.5 2 3 0.46967716659593794 -0.74447562005662626 0 0.6676496470015556 +44 0 1 2.5 3 0.57295903520036329 -0.68455031944529776 0.25056280708573153 0.68455031944529776 +45 0 1 2 3.5 0.46967716659593794 -0.6676496470015556 0 0.74447562005662626 +46 0 2 2 3.5 0.90906890097111304 0 0 1 +47 0 3.5 2 3 0.46967716659593789 -0.74447562005662626 0 -0.6676496470015556 +48 0 3 2.5 3 0.57295903520036329 0.68455031944529776 0.25056280708573153 0.68455031944529776 +49 0 3 2 3.5 0.46967716659593806 0.6676496470015556 0 0.74447562005662626 +50 0 1.5 3 3 0.57295903520036318 -0.25056280708573153 0.68455031944529776 0.68455031944529776 +51 0 2.5 3 3 0.57295903520036329 -0.25056280708573153 -0.68455031944529776 -0.68455031944529776 +52 0 2 3.5 3 0.469677166595938 0 0.74447562005662626 0.6676496470015556 +53 0 2 3 3.5 0.469677166595938 0 0.6676496470015556 0.74447562005662626 +} \ No newline at end of file diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.subdomains b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.subdomains new file mode 100644 index 0000000000..bfab69623a --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.subdomains @@ -0,0 +1,5 @@ +# CompartmentSubDomain name, handle +# MembraneSubDomain name, inside compartment name, handle, outside compartment name, handle +CompartmentSubDomain, subdomain1, 1 +CompartmentSubDomain, subdomain0, 0 +MembraneSubDomain, subdomain0_subdomain1_membrane, subdomain0, 0, subdomain1, 1 diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.vcg b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.vcg new file mode 100644 index 0000000000..2304ae913f --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_.vcg @@ -0,0 +1,66 @@ +name Geometry3 +dimension 3 +size 4.0 4.0 4.0 +origin 0.0 0.0 0.0 +volumeRegions 2 +subdomain00 45.0 0 +subdomain11 19.0 1 +membraneRegions 1 +membrane_subdomain00_subdomain11 11.654112271137366 1 0 +volumeSamples 5 5 5 +789C6360A00C30C2694624363EF53075D858D4B1833800000A540014 +cells 54 +0 7 32 0.20797317025293063 2.0 1.474414083498647 1.2216019466367984 0.0 0.3009212238866858 0.953649000950842 +1 11 36 0.20797317025293074 1.4744140834986468 1.9999999999999998 1.2216019466367984 0.3009212238866856 -0.0 0.953649000950842 +2 12 37 0.4446577164770572 2.0 2.0 1.160962425522922 0.0 -0.0 1.0 +3 13 38 0.20797317025293077 2.525585916501353 2.0 1.2216019466367984 -0.3009212238866856 -0.0 0.9536490009508422 +4 17 42 0.20797317025293074 2.0 2.525585916501353 1.2216019466367984 0.0 -0.30092122388668563 0.9536490009508422 +5 27 32 0.20797317025293063 2.0 1.2216019466367984 1.474414083498647 0.0 0.953649000950842 0.30092122388668574 +6 31 32 0.16243354778908312 1.6452464742733102 1.3850547760190295 1.3850547760190295 0.46127765735050535 0.4264869830615373 0.7780307038339154 +7 31 36 0.17046727606130682 1.3850547760190293 1.6452464742733102 1.3850547760190295 0.4452901920148757 0.776809686983054 0.44529019201487585 +8 31 56 0.17046727606130682 1.3850547760190293 1.3850547760190295 1.6452464742733102 0.7036162747846044 0.7036162747846046 0.0992384790112785 +9 33 32 0.17046727606130685 2.35475352572669 1.3850547760190295 1.3850547760190295 -0.0992384790112781 0.7036162747846044 0.7036162747846044 +10 33 38 0.16243354778908314 2.6149452239809703 1.6452464742733102 1.3850547760190295 -0.4264869830615371 0.4612776573505054 0.7780307038339155 +11 33 58 0.16243354778908314 2.6149452239809703 1.3850547760190295 1.6452464742733102 -0.7780307038339156 0.426486983061537 0.46127765735050535 +12 35 36 0.2079731702529306 1.221601946636798 2.0 1.474414083498647 0.9536490009508423 -0.0 0.30092122388668524 +13 41 36 0.16243354778908325 1.3850547760190295 2.3547535257266894 1.3850547760190295 0.7780307038339155 -0.46127765735050547 0.42648698306153704 +14 39 38 0.2079731702529306 2.7783980533632016 1.9999999999999998 1.474414083498647 -0.9536490009508423 -0.0 0.3009212238866853 +15 43 38 0.1704672760613069 2.6149452239809703 2.35475352572669 1.3850547760190295 -0.7036162747846044 -0.09923847901127744 0.7036162747846044 +16 41 42 0.17046727606130682 1.6452464742733102 2.6149452239809703 1.3850547760190295 0.7768096869830541 -0.4452901920148756 0.4452901920148756 +17 41 66 0.16243354778908314 1.3850547760190295 2.6149452239809703 1.6452464742733102 0.426486983061537 -0.7780307038339156 0.46127765735050535 +18 43 42 0.1624335477890832 2.3547535257266894 2.6149452239809703 1.3850547760190295 -0.4612776573505052 -0.7780307038339158 0.42648698306153693 +19 47 42 0.2079731702529306 2.0 2.7783980533632016 1.474414083498647 0.0 -0.9536490009508423 0.3009212238866853 +20 43 68 0.17046727606130685 2.6149452239809703 2.6149452239809703 1.6452464742733102 -0.44529019201487535 -0.44529019201487535 0.7768096869830543 +21 51 56 0.20797317025293074 1.4744140834986468 1.2216019466367984 1.9999999999999998 0.30092122388668563 0.9536490009508422 0.0 +22 52 57 0.4446577164770572 2.0 1.160962425522922 1.9999999999999998 0.0 1.0 0.0 +23 53 58 0.20797317025293077 2.525585916501353 1.2216019466367984 2.0 -0.30092122388668563 0.953649000950842 0.0 +24 55 56 0.2079731702529306 1.2216019466367982 1.474414083498647 2.0 0.953649000950842 0.30092122388668563 -3.356508441077314E-16 +25 81 56 0.16243354778908325 1.3850547760190293 1.3850547760190295 2.35475352572669 0.7780307038339155 0.42648698306153704 -0.46127765735050547 +26 59 58 0.2079731702529306 2.7783980533632016 1.474414083498647 2.0 -0.9536490009508423 0.30092122388668524 0.0 +27 83 58 0.1704672760613069 2.6149452239809703 1.3850547760190295 2.35475352572669 -0.7036162747846044 0.7036162747846044 -0.09923847901127744 +28 60 61 0.4446577164770572 1.160962425522922 2.0 1.9999999999999998 1.0 -3.329870230481197E-16 0.0 +29 64 63 0.4446577164770572 2.8390375744770777 2.0 2.0 -1.0 0.0 0.0 +30 65 66 0.20797317025293074 1.2216019466367984 2.525585916501353 1.9999999999999998 0.9536490009508422 -0.30092122388668563 0.0 +31 71 66 0.2079731702529306 1.474414083498647 2.778398053363202 2.0 0.30092122388668524 -0.9536490009508423 0.0 +32 91 66 0.1704672760613069 1.3850547760190295 2.6149452239809703 2.35475352572669 0.4452901920148756 -0.4452901920148756 -0.7768096869830541 +33 72 67 0.4446577164770572 2.0 2.8390375744770777 2.0 -0.0 -1.0 0.0 +34 69 68 0.20797317025293072 2.778398053363202 2.525585916501353 2.0 -0.9536490009508423 -0.30092122388668513 0.0 +35 73 68 0.20797317025293072 2.525585916501353 2.7783980533632016 2.0 -0.3009212238866851 -0.9536490009508423 0.0 +36 93 68 0.1624335477890832 2.6149452239809703 2.6149452239809703 2.3547535257266894 -0.4264869830615367 -0.7780307038339159 -0.46127765735050513 +37 77 82 0.20797317025293074 2.0 1.2216019466367984 2.525585916501353 0.0 0.953649000950842 -0.3009212238866856 +38 81 82 0.17046727606130682 1.6452464742733102 1.3850547760190295 2.6149452239809703 0.09923847901127754 0.7036162747846045 -0.7036162747846045 +39 81 86 0.16243354778908314 1.3850547760190295 1.6452464742733102 2.6149452239809703 0.7780307038339155 0.4612776573505054 -0.4264869830615371 +40 83 82 0.1624335477890832 2.35475352572669 1.3850547760190295 2.6149452239809703 -0.46127765735050513 0.42648698306153693 -0.7780307038339157 +41 107 82 0.2079731702529306 2.0 1.474414083498647 2.7783980533632016 0.0 0.30092122388668524 -0.9536490009508423 +42 83 88 0.17046727606130685 2.6149452239809703 1.6452464742733102 2.6149452239809703 -0.7036162747846045 0.09923847901127689 -0.7036162747846045 +43 85 86 0.20797317025293074 1.2216019466367984 1.9999999999999998 2.525585916501353 0.953649000950842 -0.0 -0.3009212238866856 +44 91 86 0.1704672760613069 1.3850547760190295 2.35475352572669 2.6149452239809703 0.4452901920148756 -0.7768096869830541 -0.4452901920148756 +45 111 86 0.2079731702529306 1.474414083498647 2.0 2.778398053363202 0.30092122388668524 -0.0 -0.9536490009508423 +46 112 87 0.4446577164770572 1.9999999999999998 2.0 2.8390375744770777 0.0 -0.0 -1.0 +47 89 88 0.20797317025293072 2.778398053363202 2.0 2.525585916501353 -0.9536490009508423 0.0 -0.3009212238866851 +48 93 88 0.16243354778908323 2.6149452239809703 2.35475352572669 2.6149452239809703 -0.4264869830615367 -0.4612776573505051 -0.7780307038339158 +49 113 88 0.20797317025293072 2.525585916501353 1.9999999999999998 2.7783980533632016 -0.30092122388668513 0.0 -0.9536490009508423 +50 91 92 0.16243354778908314 1.6452464742733102 2.6149452239809703 2.6149452239809703 0.4612776573505053 -0.7780307038339157 -0.42648698306153676 +51 93 92 0.17046727606130693 2.35475352572669 2.6149452239809703 2.6149452239809703 -0.7768096869830543 -0.44529019201487535 -0.44529019201487535 +52 97 92 0.20797317025293072 2.0 2.778398053363202 2.525585916501353 -0.0 -0.9536490009508423 -0.3009212238866851 +53 117 92 0.20797317025293072 1.9999999999999998 2.525585916501353 2.778398053363202 0.0 -0.30092122388668513 -0.9536490009508423 diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_00.zip b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_00.zip new file mode 100644 index 0000000000..3e884a7134 Binary files /dev/null and b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0_00.zip differ diff --git a/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0__0.simtask.xml b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0__0.simtask.xml new file mode 100644 index 0000000000..6e917627b5 --- /dev/null +++ b/vcell-core/src/test/resources/simdata/n5/ezequiel23/SimID_868220316_0__0.simtask.xml @@ -0,0 +1,148 @@ + + + 96485.3321 + 9.64853321E-5 + 1.0E-9 + 6.02214179E11 + 3.141592653589793 + 8314.46261815 + 300.0 + 1000.0 + 1.0 + 0.001660538783162726 + 0.0 + 10.0 + 10.0 + 10.0 + 0.0 + 10.0 + 1.0 + (1.0 * pow(KMOLE,-1.0)) + 1.0 + + + + + ((Kf * s0) - (Kr * s1)) + ((x + (5.0 * y)) + (25.0 * z)) + (x < y) + (VolumePerUnitVolume_c0 * vcRegionVolume('subdomain0')) + vcRegionArea('subdomain0_subdomain1_membrane') + vcRegionVolume('subdomain0') + vcRegionVolume('subdomain1') + + + + + + + + + + + + + + + + + - J_r0 + s0_diffusionRate + s0_init_uM + + + J_r0 + s1_diffusionRate + s1_init_uM + + + 0.0 + SpeciesValue1_diffusionRate + SpeciesValue1_init_uM + + + 0.0 + SpeciesValue0_diffusionRate + SpeciesValue0_init_uM + + + + + + + + + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + 0.0 + 0.0 + + + + + + + + + + 0.3 + 1.5 + + (0.0 + (UnitFactor_molecules_um_neg_3_uM_neg_1 * s0)) + 0.0 + + + + + + + + + + + 2 + + 1 + + + + + + + + + + + + + + + ((((x - 2.0) ^ 2.0) + ((y - 2.0) ^ 2.0) + ((z - 2.0) ^ 2.0)) < (1.5 ^ 2.0)) + + + 1.0 + + + + + + + + + + + + + \ No newline at end of file diff --git a/vcell-server/src/main/java/cbit/vcell/message/server/bootstrap/LocalVCellConnectionFactory.java b/vcell-server/src/main/java/cbit/vcell/message/server/bootstrap/LocalVCellConnectionFactory.java index 136e05fe62..8f441136d8 100644 --- a/vcell-server/src/main/java/cbit/vcell/message/server/bootstrap/LocalVCellConnectionFactory.java +++ b/vcell-server/src/main/java/cbit/vcell/message/server/bootstrap/LocalVCellConnectionFactory.java @@ -14,6 +14,8 @@ import cbit.vcell.message.server.bootstrap.client.LocalVCellConnectionMessaging; import cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect; import cbit.vcell.modeldb.AdminDBTopLevel; +import cbit.vcell.modeldb.ApiAccessToken; +import cbit.vcell.modeldb.ApiClient; import cbit.vcell.modeldb.DatabaseServerImpl; import cbit.vcell.resource.NativeLib; import cbit.vcell.resource.PropertyLoader; @@ -47,13 +49,15 @@ import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.sql.SQLException; +import java.util.Date; +import java.util.List; /** * This type was created in VisualAge. */ public class LocalVCellConnectionFactory implements VCellConnectionFactory { public static final Logger lg = LogManager.getLogger(LocalVCellConnectionFactory.class); - + private ConnectionFactory connectionFactory = null; private final Auth0ConnectionUtils auth0ConnectionUtils; private final VCellApiClient vcellApiClient; @@ -74,13 +78,14 @@ public VCellConnection createVCellConnection(UserLoginInfo userLoginInfo) throws if (connectionFactory == null) { connectionFactory = DatabaseService.getInstance().createConnectionFactory(); } - AccesTokenRepresentationRecord accessTokenRep = this.vcellApiClient.getLegacyToken(); - userLoginInfo.setUser(new User(accessTokenRep.getUserId(), new KeyValue(accessTokenRep.getUserKey()))); KeyFactory keyFactory = connectionFactory.getKeyFactory(); LocalVCellConnection.setDatabaseResources(connectionFactory, keyFactory); AdminDBTopLevel adminDbTopLevel = new AdminDBTopLevel(connectionFactory); DatabaseServerImpl databaseServerImpl = new DatabaseServerImpl(connectionFactory,keyFactory); + + userLoginInfo.setUser(adminDbTopLevel.getUser(userLoginInfo.getUserName(), true)); + boolean bCache = false; Cachetable cacheTable = null; DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(cacheTable, @@ -90,7 +95,7 @@ public VCellConnection createVCellConnection(UserLoginInfo userLoginInfo) throws ExportServiceImpl exportServiceImpl = new ExportServiceImpl(); LocalVCellConnection vcConn = new LocalVCellConnection(userLoginInfo, simulationDatabase, dataSetControllerImpl, exportServiceImpl); return vcConn; - } catch (ApiException | SQLException | FileNotFoundException | DataAccessException apiException){ + } catch (SQLException | FileNotFoundException | DataAccessException apiException){ throw new RuntimeException(apiException); } }