Search in sources :

Example 81 with BioModel

use of cbit.vcell.biomodel.BioModel in project vcell by virtualcell.

the class ServerDocumentManager method getBioModelXML.

/**
 * Insert the method's description here.
 * Creation date: (3/29/2004 4:04:16 PM)
 * @return java.lang.String
 * @param vType cbit.sql.VersionableType
 * @param vKey cbit.sql.KeyValue
 */
public String getBioModelXML(QueryHashtable dbc, User user, KeyValue bioModelKey, boolean bRegenerateXML) throws DataAccessException {
    String bioModelXML = null;
    try {
        bioModelXML = dbServer.getDBTopLevel().getBioModelXML(user, bioModelKey, true);
        if (bioModelXML != null) {
            if (bRegenerateXML) {
                try {
                    BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(bioModelXML));
                    return cbit.vcell.xml.XmlHelper.bioModelToXML(bioModel);
                } catch (XmlParseException e) {
                    e.printStackTrace();
                    throw new DataAccessException(e.getMessage(), e);
                }
            } else {
                return bioModelXML;
            }
        }
    } catch (java.sql.SQLException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(e.getMessage());
    } catch (ObjectNotFoundException e) {
    // 
    // not stored as XML currently, retrieve traditional way.
    // 
    }
    try {
        bioModelXML = getBioModelUnresolved(dbc, user, bioModelKey);
        dbServer.insertVersionableXML(user, VersionableType.BioModelMetaData, bioModelKey, bioModelXML);
        return bioModelXML;
    } catch (java.sql.SQLException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(e.getMessage());
    } catch (cbit.vcell.xml.XmlParseException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : BioModel(cbit.vcell.biomodel.BioModel) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) XmlParseException(cbit.vcell.xml.XmlParseException) XMLSource(cbit.vcell.xml.XMLSource) DataAccessException(org.vcell.util.DataAccessException)

Example 82 with BioModel

use of cbit.vcell.biomodel.BioModel in project vcell by virtualcell.

the class VCDatabaseScanner method scanBioModels.

public void scanBioModels(BioModelVisitor databaseVisitor, Logger logger, User[] users, boolean bAbortOnDataAccessException) throws DataAccessException, XmlParseException {
    if (users == null) {
        users = getAllUsers();
    }
    // start visiting models and writing log
    logger.info("Start scanning bio-models......");
    for (int i = 0; i < users.length; i++) {
        User user = users[i];
        BioModelInfo[] bioModelInfos = dbServerImpl.getBioModelInfos(user, false);
        for (int j = 0; j < bioModelInfos.length; j++) {
            BioModelInfo bmi = bioModelInfos[j];
            if (!databaseVisitor.filterBioModel(bmi)) {
                continue;
            }
            try {
                BigString bioModelXML = dbServerImpl.getBioModelXML(user, bioModelInfos[j].getVersion().getVersionKey());
                BioModel bioModel = cbit.vcell.xml.XmlHelper.XMLToBioModel(new XMLSource(bioModelXML.toString()));
                bioModel.refreshDependencies();
                if (logger.isDebugEnabled()) {
                    // + bioModelInfos[j].getVersion().getName() + " -----> ");
                    logger.debug("---- " + (j + 1) + " ----> " + bioModel.getName());
                }
                databaseVisitor.visitBioModel(bioModel);
            } catch (Exception e2) {
                logger.warn("exception biomodel " + bmi.getModelKey(), e2);
                if (bAbortOnDataAccessException) {
                    throw e2;
                }
            }
        }
    }
}
Also used : User(org.vcell.util.document.User) BioModel(cbit.vcell.biomodel.BioModel) BioModelInfo(org.vcell.util.document.BioModelInfo) BigString(org.vcell.util.BigString) XMLSource(cbit.vcell.xml.XMLSource) SQLException(java.sql.SQLException) XmlParseException(cbit.vcell.xml.XmlParseException) DataAccessException(org.vcell.util.DataAccessException) RemoteException(java.rmi.RemoteException)

Example 83 with BioModel

use of cbit.vcell.biomodel.BioModel in project vcell by virtualcell.

the class SpeciesContextSpecPanel method setBioModel.

public void setBioModel(BioModel newValue) {
    if (bioModel == newValue) {
        return;
    }
    bioModel = newValue;
    if (bioModel == null) {
        return;
    }
    Model model = bioModel.getModel();
    if (model != null & model.getRbmModelContainer().getMolecularTypeList().size() > 0) {
        splitPaneHorizontal.setDividerLocation(165);
    } else {
        // since we have no molecular types we initialize a much smaller shape panel
        // because we can only show a trivial shape (circle)
        splitPaneHorizontal.setDividerLocation(195);
    }
}
Also used : BioModel(cbit.vcell.biomodel.BioModel) Model(cbit.vcell.model.Model)

Example 84 with BioModel

use of cbit.vcell.biomodel.BioModel in project vcell by virtualcell.

the class EstParams_ReacBindingPanel method simulateWithCurrentParameters.

private // used by reaction binding panel only. not used by VFRAP 1.1 though
void simulateWithCurrentParameters() {
    fStudy = getFrapWorkspace().getWorkingFrapStudy();
    // save external files if needed
    AsynchClientTask saveTask = new AsynchClientTask("Preparing to run simulation ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // check external data before running simulation
            if (!FRAPWorkspace.areExternalDataOK(getLocalWorkspace(), fStudy.getFrapDataExternalDataInfo(), fStudy.getRoiExternalDataInfo())) {
                // if external files are missing/currupt or ROIs are changed, create keys and save them
                fStudy.setFrapDataExternalDataInfo(FRAPStudy.createNewExternalDataInfo(getLocalWorkspace(), FRAPStudy.IMAGE_EXTDATA_NAME));
                fStudy.setRoiExternalDataInfo(FRAPStudy.createNewExternalDataInfo(getLocalWorkspace(), FRAPStudy.ROI_EXTDATA_NAME));
                try {
                    fStudy.saveROIsAsExternalData(getLocalWorkspace(), fStudy.getRoiExternalDataInfo().getExternalDataIdentifier(), fStudy.getStartingIndexForRecovery());
                    fStudy.saveImageDatasetAsExternalData(getLocalWorkspace(), fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier(), fStudy.getStartingIndexForRecovery());
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    };
    // run simulation task
    AsynchClientTask runSimTask = new AsynchClientTask("Running simulation ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            BioModel bioModel = null;
            KeyValue simKey = null;
            // }
            try {
                bioModel = FRAPStudy.createNewSimBioModel(fStudy, getCurrentParameters(), null, LocalWorkspace.createNewKeyValue(), LocalWorkspace.getDefaultOwner(), fStudy.getStartingIndexForRecovery());
                // we don't have to set the bioModel to frap study, we just need the results.
                // change time bound and time step
                // Simulation sim = bioModel.getSimulations()[0];
                // sim.getSolverTaskDescription().setTimeBounds(getRefTimeBounds());
                // sim.getSolverTaskDescription().setTimeStep(getRefTimeStep());
                // sim.getSolverTaskDescription().setOutputTimeSpec(getRefTimeSpec());
                // System.out.println("run FRAP Reference Simulation...");
                // final double RUN_REFSIM_PROGRESS_FRACTION = 1.0;
                // DataSetControllerImpl.ProgressListener runRefSimProgressListener =
                // new DataSetControllerImpl.ProgressListener(){
                // public void updateProgress(double progress) {
                // if(progressListener != null){
                // //To run to the steady state the time length is unpredictable. Progress increase 10 times
                // //because we manually set ending time to 1000 and usually it will reach steady state in less than 100 seconds.
                // //max allowed progress is 80%. this is heuristic.
                // progressListener.updateProgress(Math.min(0.8, (progress*10)*RUN_REFSIM_PROGRESS_FRACTION));
                // }
                // }
                // public void updateMessage(String message){
                // if(progressListener != null){
                // progressListener.updateMessage(message);
                // }
                // }
                // };
                // run simulation
                FRAPStudy.runFVSolverStandalone(new File(getLocalWorkspace().getDefaultSimDataDirectory()), bioModel.getSimulation(0), fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier(), fStudy.getRoiExternalDataInfo().getExternalDataIdentifier(), this.getClientTaskStatusSupport(), false);
                /*//prepare to run native FV solver
					Simulation simulation = bioModel.getSimulations()[0];
					// clone and resample geometry
					Geometry resampledGeometry = null;
					try {
						resampledGeometry = (Geometry) BeanUtils.cloneSerializable(simulation.getMathDescription().getGeometry());
						GeometrySurfaceDescription geoSurfaceDesc = resampledGeometry.getGeometrySurfaceDescription();
						ISize newSize = simulation.getMeshSpecification().getSamplingSize();
						geoSurfaceDesc.setVolumeSampleSize(newSize);
						geoSurfaceDesc.updateAll();		
					} catch (Exception e) {
						e.printStackTrace();
						throw new SolverException(e.getMessage());
					}	
					
					SimulationJob simJob = new SimulationJob(simulation, 0, null); //fielddata ID?
					
					StringWriter simulationInputStringWriter = new StringWriter();
					FiniteVolumeFileWriter fvFileWriter = new FiniteVolumeFileWriter(new PrintWriter(simulationInputStringWriter,true), simJob, resampledGeometry, new File(getLocalWorkspace().getDefaultSimDataDirectory())); //need dir?		
					fvFileWriter.write(null); //what are parameter names?
					simulationInputStringWriter.close();
					String fvInputStr = simulationInputStringWriter.getBuffer().toString();
					
					//run simulation with native FV solver
					double[][][] rawSimResults = new NativeFVSolver().solve(fvInputStr);*/
                simKey = bioModel.getSimulations()[0].getVersion().getVersionKey();
            } catch (Exception e) {
                if (bioModel != null && bioModel.getSimulations() != null) {
                    FRAPStudy.removeExternalDataAndSimulationFiles(bioModel.getSimulations()[0].getVersion().getVersionKey(), null, null, getLocalWorkspace());
                }
                throw e;
            }
            // push sim key into hash table
            // for all loaded file
            hashTable.put(FRAPStudyPanel.SIMULATION_KEY, simKey);
        }
    };
    // generate dimension reduced sim data
    AsynchClientTask readDataTask = new AsynchClientTask("Reading simulation data ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            KeyValue simulationKey = (KeyValue) hashTable.get(FRAPStudyPanel.SIMULATION_KEY);
            if (simulationKey != null) {
                VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simulationKey, LocalWorkspace.getDefaultOwner());
                VCSimulationDataIdentifier vcSimDataID = new VCSimulationDataIdentifier(vcSimID, FieldDataFileOperationSpec.JOBINDEX_DEFAULT);
                double[] rawSimTimePoints = getLocalWorkspace().getVCDataManager().getDataSetTimes(vcSimDataID);
                // to store time points in frap model (simulation time points may be slightly different with exp time points)
                setCurrentRawSimTimePoints(rawSimTimePoints);
                // refDataTimePoints = timeShiftForBaseDiffRate(rawRefDataTimePoints);
                // System.out.println("simulation done...");
                // DataSetControllerImpl.ProgressListener reducedRefDataProgressListener =
                // new DataSetControllerImpl.ProgressListener(){
                // public void updateProgress(double progress) {
                // if(progressListener != null){
                // progressListener.setProgress((int)((.5+progress*(1-RUNSIM_PROGRESS_FRACTION))*100));
                // }
                // }
                // public void updateMessage(String message){
                // if(progressListener != null){
                // progressListener.setMessage(message);
                // }
                // }
                // };
                double[][] results = FRAPOptimizationUtils.dataReduction(getLocalWorkspace().getVCDataManager(), vcSimDataID, rawSimTimePoints, fStudy.getFrapData().getRois(), this.getClientTaskStatusSupport(), false);
                // to store data in frap model.
                setCurrentSimResults(results);
                System.out.println("generating dimension reduced ref data, done ....");
                // remove reference simulation files
                FRAPStudy.removeSimulationFiles(simulationKey, getLocalWorkspace());
            }
        }
    };
    // plot task
    AsynchClientTask plotTask = new AsynchClientTask("Generating plots ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
            try {
                setData(fStudy.getFrapData(), getCurrentParameters(), fStudy.getFrapData().getImageDataset().getImageTimeStamps(), fStudy.getStartingIndexForRecovery(), fStudy.getSelectedROIsForErrorCalculation());
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace(System.out);
            }
        }
    };
    // dispatch
    ClientTaskDispatcher.dispatch(EstParams_ReacBindingPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { saveTask, runSimTask, readDataTask, plotTask }, false);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) KeyValue(org.vcell.util.document.KeyValue) Hashtable(java.util.Hashtable) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) BioModel(cbit.vcell.biomodel.BioModel) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) File(java.io.File)

Example 85 with BioModel

use of cbit.vcell.biomodel.BioModel in project vcell by virtualcell.

the class DataSymbolsPanel method addVFrapDerivedImages.

private void addVFrapDerivedImages() {
    // add special (computed) images from vFrap
    AsynchClientTask[] taskArray = new AsynchClientTask[5];
    // select the desired vfrap file
    taskArray[0] = ChooseVFrapFile();
    // load the images from the vfrap file, compute derived images, store them all in memory
    taskArray[1] = new AsynchClientTask("Import images", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            File vFrapFile = (File) hashTable.get("vFrapFile");
            Component requesterComponent = DataSymbolsPanel.this;
            DocumentWindow documentWindow = (DocumentWindow) BeanUtils.findTypeParentOfComponent(requesterComponent, DocumentWindow.class);
            DocumentManager documentManager = documentWindow.getTopLevelWindowManager().getRequestManager().getDocumentManager();
            if (documentManager == null) {
                throw new RuntimeException("Not connected to server.");
            }
            // ex  ccc8.vfrap
            String vFrapFileNameExtended = vFrapFile.getName();
            {
                // we want to make sure to reload these strings from the hash later on
                String initialFieldDataName = vFrapFileNameExtended.substring(0, vFrapFileNameExtended.indexOf(".vfrap"));
                // we'll save here the "special" vFrap images (prebleach_avg, ...)
                String mixedFieldDataName = initialFieldDataName + "Mx";
                hashTable.put("initialFieldDataName", initialFieldDataName);
                hashTable.put("mixedFieldDataName", mixedFieldDataName);
            }
            if (vFrapFileNameExtended.indexOf(".vfrap") <= -1) {
                throw new RuntimeException("File extension must be .vfrap");
            }
            // for derived images and ROIs
            checkNameAvailability(hashTable, true, documentManager, requesterComponent);
            // ----- read needed info from Virtual FRAP xml file
            System.out.println("Loading " + vFrapFileNameExtended + " ...");
            String xmlString = XmlUtil.getXMLString(vFrapFile.getAbsolutePath());
            MicroscopyXmlReader xmlReader = new MicroscopyXmlReader(true);
            Element vFrapRoot = XmlUtil.stringToXML(xmlString, null).getRootElement();
            // loading frap images and a ROIs subset for display purposes only (see next task)
            AnnotatedImageDataset annotatedImages = xmlReader.getAnnotatedImageDataset(vFrapRoot, null);
            hashTable.put("annotatedImages", annotatedImages);
            ROI[] rois = xmlReader.getPrimaryROIs(XmlUtil.stringToXML(xmlString, null).getRootElement(), null);
            LoadVFrapDisplayRoi(hashTable, annotatedImages, rois);
            // ------ locate the special images within the vFrap files and load them in memory
            if (!LoadVFrapSpecialImages(hashTable, vFrapRoot)) {
                throw new RuntimeException("Unable to recover derived images from vFrap.");
            }
        // int startingIndexRecovery = xmlReader.getStartindIndexForRecovery(XmlUtil.stringToXML(xmlString, null).getRootElement());
        // vFrapXmlHelper.LoadVFrapSpecialImages(annotatedImages, startingIndexRecovery);	// prebleach average and first postbleach
        // vFrapXmlHelper.LoadVFrapRoiCompositeImages(annotatedImages, rois);
        }
    };
    // show the images from the vfrap file in an OverlayEditorPanelJAI dialog
    taskArray[2] = new AsynchClientTask("Display images", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            String mixedFieldDataName = (String) hashTable.get("mixedFieldDataName");
            if (mixedFieldDataName.equals("")) {
                JOptionPane.showMessageDialog(DataSymbolsPanel.this, "Field Data name " + mixedFieldDataName + " already in use.");
                // prevents the rest of tasks below from running
                throw UserCancelException.CANCEL_GENERIC;
            }
            AnnotatedImageDataset annotatedImages = (AnnotatedImageDataset) hashTable.get("annotatedImages");
            BufferedImage[] displayROI = (BufferedImage[]) hashTable.get("displayROI");
            if (annotatedImages == null || displayROI == null) {
                return;
            }
            // display the images
            OverlayEditorPanelJAI overlayPanel = new OverlayEditorPanelJAI();
            overlayPanel.setAllowAddROI(false);
            ImageDataset imageDataset = annotatedImages.getImageDataset();
            overlayPanel.setImages(imageDataset, 1, 0, new OverlayEditorPanelJAI.AllPixelValuesRange(1, 200));
            overlayPanel.setAllROICompositeImage(displayROI, OverlayEditorPanelJAI.FRAP_DATA_INIT_PROPERTY);
            int choice = DialogUtils.showComponentOKCancelDialog(DataSymbolsPanel.this, overlayPanel, "vFrap Field Data");
            if (choice != JOptionPane.OK_OPTION) {
                throw UserCancelException.CANCEL_GENERIC;
            }
        }
    };
    // save the ROIs, prebleach average and the first postbleach frame from memory to the database as field data
    taskArray[3] = new AsynchClientTask("Saving roi masks, pre-bleach average and first post-bleach", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            Component requesterComponent = DataSymbolsPanel.this;
            DocumentWindow documentWindow = (DocumentWindow) BeanUtils.findTypeParentOfComponent(requesterComponent, DocumentWindow.class);
            DocumentManager documentManager = documentWindow.getTopLevelWindowManager().getRequestManager().getDocumentManager();
            if (documentManager == null) {
                throw new RuntimeException("Not connected to server.");
            }
            ExternalDataIdentifier derivedEDI = SaveVFrapSpecialImagesAsFieldData(hashTable, documentManager);
            hashTable.put("derivedEDI", derivedEDI);
        }
    };
    // create the data symbols for the images saved above and display them in the tree/table
    taskArray[4] = new AsynchClientTask("Display Data Symbols", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            ExternalDataIdentifier derivedEDI = (ExternalDataIdentifier) hashTable.get("derivedEDI");
            BioModel bioModel = simulationContext.getBioModel();
            CreateSaveVFrapDataSymbols(hashTable, bioModel, derivedEDI);
        }
    };
    // save the ROIs, prebleach average and the first postbleach frame from memory to the database as field data
    // taskArray[4] = new AsynchClientTask("Saving roi masks, pre-bleach average and first post-bleach", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
    // public void run(Hashtable<String, Object> hashTable) throws Exception {
    // File vFrapFile = (File)hashTable.get("vFrapFile");
    // if(vFrapFile == null) {
    // return;
    // }
    // AnnotatedImageDataset annotatedImages = (AnnotatedImageDataset)hashTable.get("annotatedImages");
    // String initialFieldDataName = (String)hashTable.get("initialFieldDataName");
    // 
    // DocumentWindow documentWindow = (DocumentWindow)BeanUtils.findTypeParentOfComponent(DataSymbolsPanel.this, DocumentWindow.class);
    // DocumentManager dm = documentWindow.getTopLevelWindowManager().getRequestManager().getDocumentManager();
    // if(dm == null){
    // throw new RuntimeException("not connected to server");
    // }
    // 
    // // mesh
    // ImageDataset imageDataset = annotatedImages.getImageDataset();
    // Extent extent = imageDataset.getExtent();
    // ISize isize = imageDataset.getISize();
    // Origin origin = new Origin(0,0,0);
    // CartesianMesh cartesianMesh = CartesianMesh.createSimpleCartesianMesh(origin, extent,isize,
    // new RegionImage( new VCImageUncompressed(null, new byte[isize.getXYZ()], extent,
    // isize.getX(),isize.getY(),isize.getZ()),0,null,null,RegionImage.NO_SMOOTHING));
    // double[] firstPostBleach = (double[])hashTable.get("firstPostBleach");
    // double[] prebleachAvg = (double[])hashTable.get("prebleachAverage");
    // ROI[] rois = (ROI[])hashTable.get("rois");
    // 
    // int NumTimePoints = 1;
    // int NumChannels = 2+rois.length;  // prebleach, postbleach, roi1, roi2 ... roiN
    // String[] channelNames = new String[NumChannels];
    // VariableType[] channelTypes = new VariableType[NumChannels];
    // DataSymbolType[] channelVFrapImageType = new DataSymbolType[NumChannels];
    // double[][][] pixData = new double[NumTimePoints][NumChannels][];
    // pixData[0][0] = firstPostBleach;
    // channelNames[0] = "firstPostBleach";
    // channelTypes[0] = VariableType.VOLUME;
    // channelVFrapImageType[0] = DataSymbolType.VFRAP_FIRST_POSTBLEACH;
    // pixData[0][1] = prebleachAvg;
    // channelNames[1] = "prebleachAverage";
    // channelTypes[1] = VariableType.VOLUME;
    // channelVFrapImageType[1] = DataSymbolType.VFRAP_PREBLEACH_AVG;
    // int index = 0;
    // for (ROI roi : rois){
    // short[] ushortPixels = roi.getPixelsXYZ();
    // double[] doublePixels = new double[ushortPixels.length];
    // for (int i = 0; i < ushortPixels.length; i++) {
    // doublePixels[i] = ((int)ushortPixels[i])&0xffff;
    // }
    // pixData[0][index+2] = doublePixels;
    // channelNames[index+2] = "roi_"+index;
    // channelTypes[index+2] = VariableType.VOLUME;
    // channelVFrapImageType[index+2] = DataSymbolType.VFRAP_ROI;
    // index++;
    // }
    // double[] times = new double[] { 0.0 };
    // 
    // FieldDataFileOperationSpec vfrapMiscFieldDataOpSpec = new FieldDataFileOperationSpec();
    // vfrapMiscFieldDataOpSpec.opType = FieldDataFileOperationSpec.FDOS_ADD;
    // vfrapMiscFieldDataOpSpec.cartesianMesh = cartesianMesh;
    // vfrapMiscFieldDataOpSpec.doubleSpecData =  pixData;
    // vfrapMiscFieldDataOpSpec.specEDI = null;
    // vfrapMiscFieldDataOpSpec.varNames = channelNames;
    // vfrapMiscFieldDataOpSpec.owner = dm.getUser();
    // vfrapMiscFieldDataOpSpec.times = times;
    // vfrapMiscFieldDataOpSpec.variableTypes = channelTypes;
    // vfrapMiscFieldDataOpSpec.origin = origin;
    // vfrapMiscFieldDataOpSpec.extent = extent;
    // vfrapMiscFieldDataOpSpec.isize = isize;
    // //  localWorkspace.getDataSetControllerImpl().fieldDataFileOperation(fdos);
    // 
    // //			String formattedDate = (String)hashTable.get("formattedDate");
    // //			String fieldDataName = initialFieldDataName + "_vfrapMisc_" + formattedDate;
    // String mixedFieldDataName = (String)hashTable.get("mixedFieldDataName");
    // ExternalDataIdentifier vfrapMisc = dm.saveFieldData(vfrapMiscFieldDataOpSpec, mixedFieldDataName);
    // 
    // hashTable.put("channelNames", channelNames);
    // hashTable.put("channelVFrapImageType", channelVFrapImageType);
    // hashTable.put("vfrapMisc", vfrapMisc);
    // }
    // };
    // create the data symbols for the images saved above and display them in the tree/table
    // taskArray[5] = new AsynchClientTask("Display Data Symbols", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
    // public void run(Hashtable<String, Object> hashTable) throws Exception {
    // 
    // // --- create the data symbols associated with the time series
    // String initialFieldDataName = (String)hashTable.get("initialFieldDataName");
    // String mixedFieldDataName = (String)hashTable.get("mixedFieldDataName");
    // String formattedDate = (String)hashTable.get("formattedDate");
    // ImageDataset imageDataset = (ImageDataset)hashTable.get("imageDataset");
    // ExternalDataIdentifier timeSeriesEDI = (ExternalDataIdentifier)hashTable.get("timeSeriesEDI");
    // 
    // for (double time : imageDataset.getImageTimeStamps()){
    // //	   			String fluorName = TokenMangler.fixTokenStrict("fluor_"+time+"_");
    // //				while (simulationContext.getDataContext().getDataSymbol(fluorName)!=null){
    // //					fluorName = TokenMangler.getNextEnumeratedToken(fluorName);
    // //	   			}
    // DecimalFormat df = new  DecimalFormat("0.##");
    // //	   			String fluorName = "fluor_" + df.format(time) + "_" + formattedDate;
    // String fluorName = "fluor_" + df.format(time) + "_" + initialFieldDataName;
    // //				FieldFunctionArguments fluorFFArgs = new FieldFunctionArguments(timeSeriesEDI.getName(), fluorName, new Expression(time), VariableType.VOLUME);
    // DataSymbol fluorDataSymbol = new FieldDataSymbol( fluorName, DataSymbolType.VFRAP_TIMEPOINT,
    // simulationContext.getDataContext(), VCUnitDefinition.UNIT_TBD,
    // timeSeriesEDI, fluorName, VariableType.VOLUME.getTypeName(), time);
    // simulationContext.getDataContext().addDataSymbol(fluorDataSymbol);
    // }
    // // --- create the vFrap-specific symbols (ROIs, first postbleach, prebleach average)
    // String[] channelNames = (String[])hashTable.get("channelNames");
    // DataSymbolType[] channelVFrapImageType = (DataSymbolType[])hashTable.get("channelVFrapImageType");
    // ExternalDataIdentifier vfrapMisc = (ExternalDataIdentifier)hashTable.get("vfrapMisc");
    // 
    // for (int i=0; i<channelNames.length; i++) {
    // String dataSymbolID = channelNames[i] + "_" + mixedFieldDataName;
    // //				while (simulationContext.getDataContext().getDataSymbol(dataSymbolID)!=null){
    // //					dataSymbolID = TokenMangler.getNextEnumeratedToken(dataSymbolID);
    // //				}
    // //				FieldFunctionArguments prebleachFFArgs = new FieldFunctionArguments(vfrapMisc.getName(), channelNames[i], new Expression(0.0), VariableType.VOLUME);
    // //				DataSymbol dataSymbol = new FieldDataSymbol(channelNames[i], channelVFrapImageType[i],
    // //				DataSymbol dataSymbol = new FieldDataSymbol(dataSymbolID + "_" + formattedDate, channelVFrapImageType[i],
    // DataSymbol dataSymbol = new FieldDataSymbol(dataSymbolID, channelVFrapImageType[i],
    // simulationContext.getDataContext(), VCUnitDefinition.UNIT_TBD,
    // vfrapMisc, channelNames[i], VariableType.VOLUME.getTypeName(), 0D);
    // simulationContext.getDataContext().addDataSymbol(dataSymbol);
    // }
    // }
    // };
    Hashtable<String, Object> hash = new Hashtable<String, Object>();
    ClientTaskDispatcher.dispatch(this, hash, taskArray, false, true, null);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) AnnotatedImageDataset(cbit.vcell.VirtualMicroscopy.importer.AnnotatedImageDataset) ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset) Hashtable(java.util.Hashtable) Element(org.jdom.Element) DocumentManager(cbit.vcell.clientdb.DocumentManager) UserCancelException(org.vcell.util.UserCancelException) BufferedImage(java.awt.image.BufferedImage) DocumentWindow(cbit.vcell.client.desktop.DocumentWindow) MicroscopyXmlReader(cbit.vcell.VirtualMicroscopy.importer.MicroscopyXmlReader) BioModel(cbit.vcell.biomodel.BioModel) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) Component(java.awt.Component) File(java.io.File) OverlayEditorPanelJAI(cbit.vcell.geometry.gui.OverlayEditorPanelJAI) AnnotatedImageDataset(cbit.vcell.VirtualMicroscopy.importer.AnnotatedImageDataset)

Aggregations

BioModel (cbit.vcell.biomodel.BioModel)158 SimulationContext (cbit.vcell.mapping.SimulationContext)72 Simulation (cbit.vcell.solver.Simulation)53 XMLSource (cbit.vcell.xml.XMLSource)37 KeyValue (org.vcell.util.document.KeyValue)36 MathModel (cbit.vcell.mathmodel.MathModel)33 DataAccessException (org.vcell.util.DataAccessException)29 XmlParseException (cbit.vcell.xml.XmlParseException)28 File (java.io.File)28 Model (cbit.vcell.model.Model)27 BioModelInfo (org.vcell.util.document.BioModelInfo)25 MathDescription (cbit.vcell.math.MathDescription)24 IOException (java.io.IOException)24 BigString (org.vcell.util.BigString)22 Geometry (cbit.vcell.geometry.Geometry)21 UserCancelException (org.vcell.util.UserCancelException)20 User (org.vcell.util.document.User)20 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)19 SpeciesContext (cbit.vcell.model.SpeciesContext)17 VCDocument (org.vcell.util.document.VCDocument)16