Search in sources :

Example 36 with FRAPStudy

use of cbit.vcell.microscopy.FRAPStudy in project vcell by virtualcell.

the class FRAPStudyPanel method refreshROIs.

protected void refreshROIs() throws Exception {
    try {
        // check if all the data for generating spatial model are ready.
        FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
        if (fStudy == null) {
            throw new Exception("No FrapStudy is defined");
        }
        if (fStudy.getFrapData() == null) {
            throw new Exception("No FrapData is defined");
        }
        if (fStudy.getFrapData().getImageDataset() == null) {
            throw new Exception("No ImageDataSet is defined");
        }
        fStudy.refreshDependentROIs();
    } catch (Exception e) {
        throw e;
    }
}
Also used : FRAPStudy(cbit.vcell.microscopy.FRAPStudy) IOException(java.io.IOException) CannotUndoException(javax.swing.undo.CannotUndoException) ImageException(cbit.image.ImageException) FileNotFoundException(java.io.FileNotFoundException) UserCancelException(org.vcell.util.UserCancelException)

Example 37 with FRAPStudy

use of cbit.vcell.microscopy.FRAPStudy in project vcell by virtualcell.

the class FRAPStudyPanel method refreshPDEDisplay.

protected void refreshPDEDisplay(DisplayChoice choice) throws Exception {
    Simulation sim = null;
    FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
    if (fStudy == null || fStudy.getBioModel() == null || fStudy.getBioModel().getSimulations() == null || fStudy.getBioModel().getSimulations().length < 1) {
        return;
    }
    sim = fStudy.getBioModel().getSimulations()[0];
    FieldFunctionArguments[] fieldFunctionArgs = FieldUtilities.getFieldFunctionArguments(sim.getMathDescription());
    FieldDataIdentifierSpec[] fieldDataIdentifierSpecs = new FieldDataIdentifierSpec[fieldFunctionArgs.length];
    for (int i = 0; i < fieldDataIdentifierSpecs.length; i++) {
        fieldDataIdentifierSpecs[i] = new FieldDataIdentifierSpec(fieldFunctionArgs[i], fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier());
    }
    PDEDataViewer flourViewer = getFlourDataViewer();
    PDEDataManager dataManager = null;
    if (choice == DisplayChoice.EXTTIMEDATA) {
        flourViewer.setSimulation(null);
        flourViewer.setPdeDataContext(null);
        flourViewer.setDataIdentifierFilter(new DataIdentifierFilter() {

            private String ALL_DATAIDENTIFIERS = "All";

            private String EXP_NORM_FLUOR = "Exp. Norm. Fluor";

            private String SIM_NORM_FLUOR = "Sim. Norm. Fluor";

            private String DEFAULT_VIEW = "Default View (more...)";

            private String[] filterSetNames = new String[] { ALL_DATAIDENTIFIERS, EXP_NORM_FLUOR, SIM_NORM_FLUOR, DEFAULT_VIEW };

            public boolean accept(String filterSetName, List<AnnotatedFunction> myFunctionList, DataIdentifier dataidentifier) {
                if (filterSetName.equals(ALL_DATAIDENTIFIERS)) {
                    return true;
                } else if (filterSetName.equals(EXP_NORM_FLUOR)) {
                    return dataidentifier.getName().indexOf(NORM_FLUOR_VAR) != -1;
                } else if (filterSetName.equals(SIM_NORM_FLUOR)) {
                    boolean a = (dataidentifier.getName().indexOf(REACTION_RATE_PREFIX) == -1) && ((dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_COMBINED) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_IMMOBILE) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_MOBILE) != -1) || (dataidentifier.getName().indexOf(FRAPStudy.SPECIES_NAME_PREFIX_SLOW_MOBILE) != -1));
                    return a;
                } else if (filterSetName.equals(DEFAULT_VIEW)) {
                    boolean a = (dataidentifier.getName().indexOf(REACTION_RATE_PREFIX) == -1) && ((dataidentifier.getName().indexOf(NORM_FLUOR_VAR) != -1) || (dataidentifier.getName().indexOf(NORM_SIM_VAR) != -1));
                    return a;
                }
                throw new IllegalArgumentException("DataIdentifierFilter: Unknown filterSetName " + filterSetName);
            }

            public String getDefaultFilterName() {
                return DEFAULT_VIEW;
            }

            public String[] getFilterSetNames() {
                return filterSetNames;
            }

            public boolean isAcceptAll(String filterSetName) {
                return filterSetName.equals(ALL_DATAIDENTIFIERS);
            }

            @Override
            public void setPostProcessingMode(boolean bPostProcessingMode) {
            // TODO Auto-generated method stub
            }

            @Override
            public boolean isPostProcessingMode() {
                // TODO Auto-generated method stub
                return false;
            }

            @Override
            public ArrayList<DataIdentifier> accept(String filterSetName, List<AnnotatedFunction> myFunctionList, DataIdentifier[] dataidentifiers) {
                if (filterSetName.equals(DEFAULT_VIEW)) {
                    ArrayList<DataIdentifier> dataIds = new ArrayList<>();
                    if (dataidentifiers != null) {
                        for (int i = 0; i < dataidentifiers.length; i++) {
                            dataIds.add(dataidentifiers[i]);
                        }
                    }
                    return dataIds;
                }
                throw new RuntimeException("Not Implemented for FRAP");
            }
        });
        ExternalDataIdentifier timeSeriesExtDataID = fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier();
        ExternalDataIdentifier maskExtDataID = fStudy.getRoiExternalDataInfo().getExternalDataIdentifier();
        // add sim
        int jobIndex = 0;
        SimulationJob simJob = new SimulationJob(sim, jobIndex, fieldDataIdentifierSpecs);
        // add function to display normalized fluorence data
        Norm_Exp_Fluor = new Expression(Norm_Exp_Fluor_Str);
        SimulationSymbolTable simSymbolTable = simJob.getSimulationSymbolTable();
        if (// one diffusing component
        simSymbolTable.getVariable(FRAPStudy.SPECIES_NAME_PREFIX_SLOW_MOBILE) == null) {
            Norm_Sim = new Expression(Norm_Sim_One_Diff_Str);
        } else // two diffusing components
        {
            Norm_Sim = new Expression(Norm_Sim_Two_Diff_Str);
        }
        AnnotatedFunction[] func = { new AnnotatedFunction(NORM_FLUOR_VAR, Norm_Exp_Fluor, null, null, VariableType.VOLUME, FunctionCategory.OLDUSERDEFINED), new AnnotatedFunction(NORM_SIM_VAR, Norm_Sim, null, null, VariableType.VOLUME, FunctionCategory.OLDUSERDEFINED) };
        VCDataIdentifier[] dataIDs = new VCDataIdentifier[] { timeSeriesExtDataID, maskExtDataID, simJob.getVCDataIdentifier() };
        VCDataIdentifier vcDataId = new MergedDataInfo(LocalWorkspace.getDefaultOwner(), dataIDs, FRAPStudy.VFRAP_DS_PREFIX);
        outputContext = new OutputContext(func);
        dataManager = new PDEDataManager(outputContext, getLocalWorkspace().getVCDataManager(), vcDataId);
        ClientPDEDataContext pdeDataContext = new ClientPDEDataContext(dataManager);
        pdeDataContext.refreshIdentifiers();
        flourViewer.setSimulation(sim);
        flourViewer.setPdeDataContext(pdeDataContext);
        SimulationModelInfo simModelInfo = new SimulationWorkspaceModelInfo(fStudy.getBioModel().getSimulationContext(sim), sim.getName());
        flourViewer.setSimulationModelInfo(simModelInfo);
        getLocalWorkspace().getDataSetControllerImpl().addDataJobListener(flourViewer);
        ((VirtualFrapWindowManager) flourViewer.getDataViewerManager()).setLocalWorkSpace(getLocalWorkspace());
        // do now show post data processing for VFRAP
        flourViewer.setPostProcessingPanelVisible(false);
        flourViewer.repaint();
    }
}
Also used : ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ArrayList(java.util.ArrayList) MergedDataInfo(cbit.vcell.simdata.MergedDataInfo) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) SimulationWorkspaceModelInfo(cbit.vcell.client.data.SimulationWorkspaceModelInfo) SimulationJob(cbit.vcell.solver.SimulationJob) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) DataIdentifierFilter(cbit.vcell.client.data.DataIdentifierFilter) SimulationModelInfo(cbit.vcell.solver.SimulationModelInfo) FieldFunctionArguments(cbit.vcell.field.FieldFunctionArguments) SimulationSymbolTable(cbit.vcell.solver.SimulationSymbolTable) Point(java.awt.Point) OutputContext(cbit.vcell.simdata.OutputContext) Simulation(cbit.vcell.solver.Simulation) PDEDataManager(cbit.vcell.simdata.PDEDataManager) Expression(cbit.vcell.parser.Expression) FieldDataIdentifierSpec(cbit.vcell.field.FieldDataIdentifierSpec) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) PDEDataViewer(cbit.vcell.client.data.PDEDataViewer)

Example 38 with FRAPStudy

use of cbit.vcell.microscopy.FRAPStudy in project vcell by virtualcell.

the class FRAPStudyPanel method showMovie.

private void showMovie() {
    AsynchClientTask createMovieTask = new AsynchClientTask("Buffering movie data...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
            if (fStudy == null) {
                return;
            }
            if (fStudy.getMovieURLString() != null && fStudy.getMovieFileString() != null) {
                hashTable.put("FrapStudy", fStudy);
                return;
            }
            // create export specs
            Simulation sim = null;
            if (fStudy.getBioModel() == null || fStudy.getBioModel().getSimulations() == null || fStudy.getBioModel().getSimulations().length < 1) {
                return;
            } else {
                sim = fStudy.getBioModel().getSimulations()[0];
            }
            FieldFunctionArguments[] fieldFunctionArgs = FieldUtilities.getFieldFunctionArguments(sim.getMathDescription());
            FieldDataIdentifierSpec[] fieldDataIdentifierSpecs = new FieldDataIdentifierSpec[fieldFunctionArgs.length];
            for (int i = 0; i < fieldDataIdentifierSpecs.length; i++) {
                fieldDataIdentifierSpecs[i] = new FieldDataIdentifierSpec(fieldFunctionArgs[i], fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier());
            }
            ExternalDataIdentifier timeSeriesExtDataID = fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier();
            ExternalDataIdentifier maskExtDataID = fStudy.getRoiExternalDataInfo().getExternalDataIdentifier();
            // add sim
            int jobIndex = 0;
            SimulationJob simJob = new SimulationJob(sim, jobIndex, fieldDataIdentifierSpecs);
            VCDataIdentifier[] dataIDs = new VCDataIdentifier[] { timeSeriesExtDataID, maskExtDataID, simJob.getVCDataIdentifier() };
            VCDataIdentifier vcDataId = new MergedDataInfo(LocalWorkspace.getDefaultOwner(), dataIDs, FRAPStudy.VFRAP_DS_PREFIX);
            PDEDataManager dataManager = new PDEDataManager(null, getLocalWorkspace().getVCDataManager(), vcDataId);
            PDEDataContext pdeDataContext = new ClientPDEDataContext(dataManager);
            ExportFormat format = ExportFormat.QUICKTIME;
            String[] variableNames = new String[] { NORM_FLUOR_VAR, NORM_SIM_VAR };
            VariableSpecs variableSpecs = new VariableSpecs(variableNames, ExportConstants.VARIABLE_MULTI);
            // int endTimeIndex = (int)Math.round(sim.getSolverTaskDescription().getTimeBounds().getEndingTime()/((UniformOutputTimeSpec)sim.getSolverTaskDescription().getOutputTimeSpec()).getOutputTimeStep());
            int endTimeIndex = getFRAPSimDataViewerPanel().getOriginalDataViewer().getPdeDataContext().getTimePoints().length - 1;
            TimeSpecs timeSpecs = new TimeSpecs(0, endTimeIndex, pdeDataContext.getTimePoints(), ExportConstants.TIME_RANGE);
            int geoMode = ExportConstants.GEOMETRY_SLICE;
            GeometrySpecs geometrySpecs = new GeometrySpecs(null, Coordinate.Z_AXIS, 0, geoMode);
            // 10s
            double duration = 10000;
            DisplayPreferences pref1 = new DisplayPreferences("BlueRed", new Range(0.01, 1.1), DisplayAdapterService.createBlueRedSpecialColors());
            DisplayPreferences pref2 = new DisplayPreferences("BlueRed", new Range(0.01, 1.1), DisplayAdapterService.createBlueRedSpecialColors());
            DisplayPreferences[] displayPref = new DisplayPreferences[] { pref1, pref2 };
            int imageScale = 1;
            int membraneScale = 1;
            int scaleMode = ImagePaneModel.MESH_MODE;
            // the default setting in MediaSettingsPanel.
            int volVarMemOutlineThickness = 1;
            MovieSpecs mSpec = new MovieSpecs(duration, true, displayPref, ExportFormat.QUICKTIME, ExportConstants.NO_MIRRORING, volVarMemOutlineThickness, imageScale, membraneScale, scaleMode, FormatSpecificSpecs.CODEC_JPEG, 1.0f, /*lossless*/
            false, FormatSpecificSpecs.PARTICLE_NONE);
            // mSpec.setViewZoom(1);
            ExportSpecs exSpecs = new ExportSpecs(vcDataId, format, variableSpecs, timeSpecs, geometrySpecs, mSpec, fStudy.getName(), null);
            // pass the request
            ExportEvent exportEvt = ((VirtualFrapWindowManager) getFlourDataViewer().getDataViewerManager()).startExportMovie(exSpecs, outputContext, this.getClientTaskStatusSupport());
            hashTable.put("ExportEvt", exportEvt);
            hashTable.put("FrapStudy", fStudy);
        }
    };
    AsynchClientTask showMovieTask = new AsynchClientTask("Showing movie ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            ExportEvent exportEvt = (ExportEvent) hashTable.get("ExportEvt");
            FRAPStudy fStudy = (FRAPStudy) hashTable.get("FrapStudy");
            // show movie if successfully exported
            if (exportEvt != null) {
                final String fileURLString = System.getProperty(PropertyLoader.exportBaseURLProperty) + exportEvt.getJobID() + ".mov";
                final String fileString = System.getProperty(PropertyLoader.exportBaseDirInternalProperty) + exportEvt.getJobID() + ".mov";
                fStudy.setMovieURLString(fileURLString);
                fStudy.setMovieFileString(fileString);
            }
            showMovieInDialog(fStudy.getMovieURLString(), fStudy.getMovieFileString());
        }
    };
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { createMovieTask, showMovieTask }, true, true, null, true);
}
Also used : ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) PDEDataContext(cbit.vcell.simdata.PDEDataContext) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) ExportSpecs(cbit.vcell.export.server.ExportSpecs) ExportEvent(cbit.rmi.event.ExportEvent) GeometrySpecs(cbit.vcell.export.server.GeometrySpecs) MergedDataInfo(cbit.vcell.simdata.MergedDataInfo) DisplayPreferences(cbit.image.DisplayPreferences) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) TimeSpecs(cbit.vcell.export.server.TimeSpecs) SimulationJob(cbit.vcell.solver.SimulationJob) FieldFunctionArguments(cbit.vcell.field.FieldFunctionArguments) Hashtable(java.util.Hashtable) ExportFormat(cbit.vcell.export.server.ExportFormat) Range(org.vcell.util.Range) Point(java.awt.Point) VariableSpecs(cbit.vcell.export.server.VariableSpecs) MovieSpecs(cbit.vcell.export.server.MovieSpecs) Simulation(cbit.vcell.solver.Simulation) PDEDataManager(cbit.vcell.simdata.PDEDataManager) FieldDataIdentifierSpec(cbit.vcell.field.FieldDataIdentifierSpec) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier)

Example 39 with FRAPStudy

use of cbit.vcell.microscopy.FRAPStudy in project vcell by virtualcell.

the class BatchRunXmlReader method getBatchRunWorkspace.

/**
 * This method returns a Biomodel object from a XML Element.
 * Creation date: (3/13/2001 12:35:00 PM)
 * @param param org.jdom.Element
 * @return cbit.vcell.biomodel.BioModel
 * @throws XmlParseException
 */
public FRAPBatchRunWorkspace getBatchRunWorkspace(Element param) throws XmlParseException {
    FRAPBatchRunWorkspace tempBatchRunWorkspace = new FRAPBatchRunWorkspace();
    // Element param = root.getChild(MicroscopyXMLTags.FrapBatchRunTag);
    // selected model index
    Element selectedModexIndexElement = param.getChild(MicroscopyXMLTags.BatchRunSelectedModelTypeTag);
    String selectedModexIndexStr = selectedModexIndexElement.getText();
    int selectedModelIndex = (new Integer(selectedModexIndexStr).intValue());
    if (selectedModexIndexStr != null && selectedModexIndexStr.length() > 0) {
        tempBatchRunWorkspace.setSelectedModel(selectedModelIndex);
    }
    // get average model parameters when there is selected model
    Element averageParametersElement = param.getChild(MicroscopyXMLTags.ModelParametersTag);
    Parameter[] params = null;
    if (averageParametersElement != null && averageParametersElement.getAttributes().size() > 0) {
        if (selectedModelIndex == FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT) {
            params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF];
            double primaryDiffRate = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.PrimaryRateAttrTag));
            params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_DIFF_RATE], FRAPModel.REF_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getScale(), primaryDiffRate);
            double primaryFraction = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.PrimaryFractionAttTag));
            params[FRAPModel.INDEX_PRIMARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_FRACTION], FRAPModel.REF_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getScale(), primaryFraction);
            double bwmRate = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.BleachWhileMonitoringTauAttrTag));
            params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BLEACH_MONITOR_RATE], FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getLowerBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getUpperBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getScale(), bwmRate);
        } else if (selectedModelIndex == FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS) {
            params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF];
            double primaryDiffRate = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.PrimaryRateAttrTag));
            params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_DIFF_RATE], FRAPModel.REF_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_DIFFUSION_RATE_PARAM.getScale(), primaryDiffRate);
            double primaryFraction = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.PrimaryFractionAttTag));
            params[FRAPModel.INDEX_PRIMARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_PRIMARY_FRACTION], FRAPModel.REF_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_MOBILE_FRACTION_PARAM.getScale(), primaryFraction);
            double bwmRate = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.BleachWhileMonitoringTauAttrTag));
            params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BLEACH_MONITOR_RATE], FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getLowerBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getUpperBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getScale(), bwmRate);
            double secDiffRate = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.SecondRateAttrTag));
            params[FRAPModel.INDEX_SECONDARY_DIFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_SECONDARY_DIFF_RATE], FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getLowerBound(), FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getUpperBound(), FRAPModel.REF_SECOND_DIFFUSION_RATE_PARAM.getScale(), secDiffRate);
            double secFraction = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.SecondFractionAttTag));
            params[FRAPModel.INDEX_SECONDARY_FRACTION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_SECONDARY_FRACTION], FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getLowerBound(), FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getUpperBound(), FRAPModel.REF_SECOND_MOBILE_FRACTION_PARAM.getScale(), secFraction);
        } else if (selectedModelIndex == FRAPModel.IDX_MODEL_REACTION_OFF_RATE) {
            params = new Parameter[FRAPModel.NUM_MODEL_PARAMETERS_REACTION_OFF_RATE];
            double bwmRate = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.BleachWhileMonitoringTauAttrTag));
            params[FRAPModel.INDEX_BLEACH_MONITOR_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BLEACH_MONITOR_RATE], FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getLowerBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getUpperBound(), FRAPModel.REF_BLEACH_WHILE_MONITOR_PARAM.getScale(), bwmRate);
            double fittingParam = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.BindingSiteConcentrationAttTag));
            params[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_BINDING_SITE_CONCENTRATION], FRAPModel.REF_BS_CONCENTRATION_OR_A.getLowerBound(), FRAPModel.REF_BS_CONCENTRATION_OR_A.getUpperBound(), FRAPModel.REF_BS_CONCENTRATION_OR_A.getScale(), fittingParam);
            double offRate = Double.parseDouble(averageParametersElement.getAttributeValue(MicroscopyXMLTags.ReactionOffRateAttTag));
            params[FRAPModel.INDEX_OFF_RATE] = new Parameter(FRAPModel.MODEL_PARAMETER_NAMES[FRAPModel.INDEX_OFF_RATE], FRAPModel.REF_REACTION_OFF_RATE.getLowerBound(), FRAPModel.REF_REACTION_OFF_RATE.getUpperBound(), FRAPModel.REF_REACTION_OFF_RATE.getScale(), offRate);
            params[FRAPModel.INDEX_PRIMARY_DIFF_RATE] = null;
            params[FRAPModel.INDEX_PRIMARY_FRACTION] = null;
            params[FRAPModel.INDEX_SECONDARY_DIFF_RATE] = null;
            params[FRAPModel.INDEX_SECONDARY_FRACTION] = null;
            params[FRAPModel.INDEX_ON_RATE] = null;
        }
        tempBatchRunWorkspace.setAverageParameters(params);
    }
    // get FrapStudy file list
    Element frapStudyListElement = param.getChild(MicroscopyXMLTags.FrapStudyListTag);
    String numFrapStudiesStr = frapStudyListElement.getAttributeValue(MicroscopyXMLTags.NumFrapStudyListAttrTag);
    Integer.parseInt(numFrapStudiesStr);
    // get each individual FRAPStudy
    @SuppressWarnings("unchecked") List<Element> fileNameList = frapStudyListElement.getChildren(MicroscopyXMLTags.FrapFileNameTag);
    for (int i = 0; i < fileNameList.size(); i++) {
        String fileName = fileNameList.get(i).getText();
        // create empty frap study to put in temporay batchrunworkspace
        FRAPStudy fStudy = new FRAPStudy();
        fStudy.setXmlFilename(fileName);
        tempBatchRunWorkspace.addFrapStudy(fStudy);
    }
    return tempBatchRunWorkspace;
}
Also used : Element(org.jdom.Element) Parameter(cbit.vcell.opt.Parameter) FRAPStudy(cbit.vcell.microscopy.FRAPStudy)

Example 40 with FRAPStudy

use of cbit.vcell.microscopy.FRAPStudy in project vcell by virtualcell.

the class FRAPBatchRunWorkspace method refreshMSESummaryData.

public void refreshMSESummaryData() {
    int studySize = getFrapStudies().size();
    analysisMSESummaryData = new double[studySize][FRAPData.VFRAP_ROI_ENUM.values().length - 2 + 1];
    for (int i = 0; i < studySize; i++) {
        FRAPStudy fStudy = getFrapStudies().get(i);
        fStudy.createAnalysisMSESummaryData();
        analysisMSESummaryData[i] = fStudy.getAnalysisMSESummaryData()[getSelectedModel()];
    }
}
Also used : FRAPStudy(cbit.vcell.microscopy.FRAPStudy)

Aggregations

FRAPStudy (cbit.vcell.microscopy.FRAPStudy)51 Hashtable (java.util.Hashtable)19 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)18 File (java.io.File)17 ArrayList (java.util.ArrayList)13 Parameter (cbit.vcell.opt.Parameter)11 Point (java.awt.Point)8 FRAPModel (cbit.vcell.microscopy.FRAPModel)7 UserCancelException (org.vcell.util.UserCancelException)7 ImageException (cbit.image.ImageException)6 MicroscopyXmlReader (cbit.vcell.microscopy.MicroscopyXmlReader)5 FRAPData (cbit.vcell.microscopy.FRAPData)4 FRAPOptData (cbit.vcell.microscopy.FRAPOptData)4 FRAPOptFunctions (cbit.vcell.microscopy.FRAPOptFunctions)4 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 CannotUndoException (javax.swing.undo.CannotUndoException)4 PDEDataManager (cbit.vcell.simdata.PDEDataManager)3 Simulation (cbit.vcell.solver.Simulation)3 Wizard (org.vcell.wizard.Wizard)3