use of org.vcell.vmicro.workflow.data.LocalWorkspace in project vcell by virtualcell.
the class KenworthyTest method main.
public static void main(String[] args) {
if (args.length != 2) {
System.out.println("expecting 2 arguments");
System.out.println("usage: java " + Workflow.class.getSimpleName() + " workingdir workflowInputFile");
System.out.println("workingdir example: " + "D:\\developer\\eclipse\\workspace\\VCell_5.4_vmicro\\datadir");
System.out.println("workflowInputFile example: " + "D:\\developer\\eclipse\\workspace\\VCell_5.4_vmicro\\workflow1.txt");
System.exit(1);
}
try {
// PropertyLoader.loadProperties();
// workflowInputFile "C:\\developer\\eclipse\\workspace\\VCell_5.3_vmicro\\workflow1.txt"
File workingDirectory = new File(args[0]);
LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
Repository repository = new MemoryRepository();
// String workflowLanguageText = BeanUtils.readBytesFromFile(new File(args[1]), null);
// Workflow workflow = Workflow.parse(localWorkspace, workflowLanguageText);
System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> using hard-coded example instead <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
File vfrapFile = new File("D:\\Developer\\eclipse\\workspace_refactor\\VCell_5.4_vmicro\\3D_FRAP_2_ZProjection_Simulation1.vfrap");
// Workflow workflow = getVFrapSimpleExample(workingDirectory, vfrapFile);
// Workflow workflow = getFakeDataExample(workingDirectory);
Workflow workflow = getInteractiveModelWorkflow(repository, workingDirectory);
TaskContext taskContext = new TaskContext(workflow, repository, localWorkspace);
ArrayList<Issue> issues = new ArrayList<Issue>();
IssueContext issueContext = new IssueContext();
workflow.gatherIssues(issueContext, issues);
// WorkflowJGraphProxy workflowJGraphProxy = new WorkflowJGraphProxy(workflow);
// displayWorkflowGraphJGraphX(workflowJGraphProxy);
WorkflowUtilities.displayWorkflowGraph(workflow);
WorkflowUtilities.displayWorkflowTable(taskContext);
workflow.reportIssues(issues, Issue.SEVERITY_INFO, true);
//
// execute the workflow
//
workflow.compute(taskContext, new WorkflowUtilities.Progress());
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
use of org.vcell.vmicro.workflow.data.LocalWorkspace in project vcell by virtualcell.
the class KenworthyTest method getInteractiveModelWorkflow.
public static Workflow getInteractiveModelWorkflow(Repository repository, File workingDirectory) {
//
// construct the dataflow graph
//
LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
Workflow workflow = new Workflow("main");
//
// workflow parameters
//
WorkflowParameter<Double> bleachThreshold = workflow.addParameter(Double.class, "bleachThreshold", repository, 0.80);
WorkflowParameter<Double> cellThreshold = workflow.addParameter(Double.class, "cellThreshold", repository, 0.5);
WorkflowParameter<Double> cellRadius = workflow.addParameter(Double.class, "cellRadius", repository, 10.0);
WorkflowParameter<String> cytosolName = workflow.addParameter(String.class, "cytosolName", repository, "cytosol");
WorkflowParameter<String> extracellularName = workflow.addParameter(String.class, "extracellularName", repository, "ec");
WorkflowParameter<Double> deltaX = workflow.addParameter(Double.class, "deltaX", repository, 0.3);
WorkflowParameter<Double> outputTimeStep = workflow.addParameter(Double.class, "outputTimeStep", repository, 0.3);
// 0.3
WorkflowParameter<Double> psfSigma = workflow.addParameter(Double.class, "psfSigma", repository, 0.01);
// circular disk (no K
WorkflowParameter<Double> bleachRadius = workflow.addParameter(Double.class, "bleachRadius", repository, 4.0);
// 5.0
WorkflowParameter<Double> bleachRate = workflow.addParameter(Double.class, "bleachRate", repository, 500.0);
// 0.3
WorkflowParameter<Double> bleachDuration = workflow.addParameter(Double.class, "bleachDuraction", repository, 0.003);
// 1.0
WorkflowParameter<Double> postbleachDelay = workflow.addParameter(Double.class, "postbleachDelay", repository, 0.001);
WorkflowParameter<Double> postbleachDuration = workflow.addParameter(Double.class, "postbleachDuraction", repository, 25.0);
// no bleach while monitoring
WorkflowParameter<Double> bleachMonitorRate = workflow.addParameter(Double.class, "bleachMonitorRate", repository, 0.0000005);
WorkflowParameter<Double> primaryDiffusionRate = workflow.addParameter(Double.class, "primaryDiffusionRate", repository, 2.0);
// primary fraction 100%
WorkflowParameter<Double> primaryFraction = workflow.addParameter(Double.class, "primaryFraction", repository, 1.0);
// 20.0
WorkflowParameter<Double> secondaryDiffusionRate = workflow.addParameter(Double.class, "secondaryDiffusionRate", repository, 0.0);
// 0.2
WorkflowParameter<Double> secondaryFraction = workflow.addParameter(Double.class, "secondaryFraction", repository, 0.0);
// no noise to start
WorkflowParameter<Boolean> bNoise = workflow.addParameter(Boolean.class, "bNoise", repository, true);
WorkflowParameter<Double> maxIntensity = workflow.addParameter(Double.class, "maxIntensity", repository, 60000.0);
Generate2DExpModel_UniformBleach generateExpModel = new Generate2DExpModel_UniformBleach("generateExpModel");
workflow.connectParameter(bleachDuration, generateExpModel.bleachDuration);
workflow.connectParameter(bleachMonitorRate, generateExpModel.bleachMonitorRate);
workflow.connectParameter(bleachRadius, generateExpModel.bleachRadius);
workflow.connectParameter(bleachRate, generateExpModel.bleachRate);
workflow.connectParameter(cellRadius, generateExpModel.cellRadius);
workflow.connectParameter(cytosolName, generateExpModel.cytosolName);
workflow.connectParameter(deltaX, generateExpModel.deltaX);
workflow.connectParameter(extracellularName, generateExpModel.extracellularName);
workflow.connectParameter(outputTimeStep, generateExpModel.outputTimeStep);
workflow.connectParameter(postbleachDelay, generateExpModel.postbleachDelay);
workflow.connectParameter(postbleachDuration, generateExpModel.postbleachDuration);
workflow.connectParameter(primaryDiffusionRate, generateExpModel.primaryDiffusionRate);
workflow.connectParameter(primaryFraction, generateExpModel.primaryFraction);
workflow.connectParameter(psfSigma, generateExpModel.psfSigma);
workflow.connectParameter(secondaryDiffusionRate, generateExpModel.secondaryDiffusionRate);
workflow.connectParameter(secondaryFraction, generateExpModel.secondaryFraction);
workflow.addTask(generateExpModel);
// DisplayBioModel displayBioModel = new DisplayBioModel("displayBioModel");
// displayBioModel.bioModel.setSource(generateExpModel.bioModel_2D);
// workflow.addTask(displayBioModel);
RunFakeSim runFakeSim = new RunFakeSim("runFakeSim");
workflow.connectParameter(bNoise, runFakeSim.bNoise);
workflow.connectParameter(maxIntensity, runFakeSim.maxIntensity);
workflow.connect2(generateExpModel.simulation_2D, runFakeSim.simulation_2D);
workflow.connect2(generateExpModel.bleachBlackoutBeginTime, runFakeSim.bleachBlackoutBeginTime);
workflow.connect2(generateExpModel.bleachBlackoutEndTime, runFakeSim.bleachBlackoutEndTime);
workflow.addTask(runFakeSim);
// DisplayTimeSeries displayRawImages = new DisplayTimeSeries("displayRawImages");
// displayRawImages.imageTimeSeries.setSource(runFakeSim.simTimeSeries);
// displayRawImages.title.setSource(workflow.addParameter(String.class, "displayRawImagesTitle", "raw Images from "+runFakeSim.getClass().getSimpleName()));
// workflow.addTask(displayRawImages);
KenworthyProcess kenworthyProcess = new KenworthyProcess("kenworthyProcess");
workflow.connectParameter(bleachThreshold, kenworthyProcess.bleachThreshold);
workflow.connectParameter(cellThreshold, kenworthyProcess.cellThreshold);
workflow.connect2(runFakeSim.simTimeSeries, kenworthyProcess.rawTimeSeriesImages);
workflow.addTask(kenworthyProcess);
return workflow;
}
use of org.vcell.vmicro.workflow.data.LocalWorkspace in project vcell by virtualcell.
the class WorkflowTest method getVFrapExample.
public static Workflow getVFrapExample(Repository repository, File workingDirectory, File vfrapFile) {
//
// construct the dataflow graph
//
LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
Workflow workflow = new Workflow("main");
TaskContext context = new TaskContext(workflow, repository, localWorkspace);
//
// workflow parameters
//
WorkflowParameter<Double> maxIntensity = workflow.addParameter(Double.class, "maxIntensity");
context.setParameterValue(maxIntensity, 10000.0);
WorkflowParameter<Boolean> bNoise = workflow.addParameter(Boolean.class, "bNoise");
context.setParameterValue(bNoise, true);
WorkflowParameter<File> vfrapFileParam = workflow.addParameter(File.class, "vfrapFile");
context.setParameterValue(vfrapFileParam, vfrapFile);
WorkflowParameter<Double> bleachThreshold = workflow.addParameter(Double.class, "bleachThreshold");
context.setParameterValue(bleachThreshold, 0.80);
WorkflowParameter<Double> cellThreshold = workflow.addParameter(Double.class, "cellThreshold");
context.setParameterValue(cellThreshold, 0.5);
WorkflowParameter<String> modelTypeOne = workflow.addParameter(String.class, "modelType");
context.setParameterValue(modelTypeOne, GenerateRefSimOptModel.ModelType.DiffOne.toString());
WorkflowParameter<String> modelTypeTwo = workflow.addParameter(String.class, "modelType2");
context.setParameterValue(modelTypeTwo, GenerateRefSimOptModel.ModelType.DiffTwoWithPenalty.toString());
WorkflowParameter<String> displayROITitle = workflow.addParameter(String.class, "displayROITitle");
context.setParameterValue(displayROITitle, "rois");
// input data from VFrap file
ImportRawTimeSeriesFromVFrap timeSeriesFromVCell = new ImportRawTimeSeriesFromVFrap("frapImport");
workflow.connectParameter(vfrapFileParam, timeSeriesFromVCell.vfrapFile);
workflow.addTask(timeSeriesFromVCell);
// // input data from HDF5 postprocessing (includes PSF)
// ImportRawTimeSeriesFromHdf5Fluor timeSeriesFromVCell = new ImportRawTimeSeriesFromHdf5Fluor("t1");
// timeSeriesFromVCell.bNoise.setSource(bNoise);
// timeSeriesFromVCell.maxIntensity.setSource(maxIntensity);
// timeSeriesFromVCell.fluorDataName.setSource(hdf5FluorName);
// timeSeriesFromVCell.vcellHdf5File.setSource(hdf5File);
// timeSeriesFromVCell.zSliceIndex.setSource(hdf5ZSliceIndex);
// workflow.addTask(timeSeriesFromVCell);
GenerateCellROIsFromRawTimeSeries generateCellROIs = new GenerateCellROIsFromRawTimeSeries("generateCellROIs");
workflow.connectParameter(cellThreshold, generateCellROIs.cellThreshold);
workflow.connect2(timeSeriesFromVCell.rawTimeSeriesImages, generateCellROIs.rawTimeSeriesImages);
workflow.addTask(generateCellROIs);
GenerateNormalizedFrapData generateNormalizedFrapData = new GenerateNormalizedFrapData("generateNormalizedFrapData");
workflow.connect2(generateCellROIs.backgroundROI_2D, generateNormalizedFrapData.backgroundROI_2D);
workflow.connect2(generateCellROIs.indexOfFirstPostbleach, generateNormalizedFrapData.indexOfFirstPostbleach);
workflow.connect2(timeSeriesFromVCell.rawTimeSeriesImages, generateNormalizedFrapData.rawImageTimeSeries);
workflow.addTask(generateNormalizedFrapData);
GenerateBleachROI generateROIs = new GenerateBleachROI("generateROIs");
workflow.connectParameter(bleachThreshold, generateROIs.bleachThreshold);
workflow.connect2(generateCellROIs.cellROI_2D, generateROIs.cellROI_2D);
workflow.connect2(generateNormalizedFrapData.normalizedFrapData, generateROIs.normalizedTimeSeries);
workflow.addTask(generateROIs);
GenerateDependentImageROIs generateDependentROIs = new GenerateDependentImageROIs("generateDependentROIs");
workflow.connect2(generateCellROIs.cellROI_2D, generateDependentROIs.cellROI_2D);
workflow.connect2(generateROIs.bleachedROI_2D, generateDependentROIs.bleachedROI_2D);
workflow.addTask(generateDependentROIs);
DisplayDependentROIs displayDependentROIs = new DisplayDependentROIs("displayDependentROIs");
workflow.connect2(generateDependentROIs.imageDataROIs, displayDependentROIs.imageROIs);
workflow.connect2(generateCellROIs.cellROI_2D, displayDependentROIs.cellROI);
workflow.connectParameter(displayROITitle, displayDependentROIs.title);
workflow.addTask(displayDependentROIs);
GenerateReducedData generateReducedNormalizedData = new GenerateReducedData("generateReducedNormalizedData");
workflow.connect2(generateNormalizedFrapData.normalizedFrapData, generateReducedNormalizedData.imageTimeSeries);
workflow.connect2(generateDependentROIs.imageDataROIs, generateReducedNormalizedData.imageDataROIs);
workflow.addTask(generateReducedNormalizedData);
ComputeMeasurementError computeMeasurementError = new ComputeMeasurementError("computeMeasurementError");
workflow.connect2(generateDependentROIs.imageDataROIs, computeMeasurementError.imageDataROIs);
workflow.connect2(generateCellROIs.indexOfFirstPostbleach, computeMeasurementError.indexFirstPostbleach);
workflow.connect2(generateNormalizedFrapData.prebleachAverage, computeMeasurementError.prebleachAverage);
workflow.connect2(timeSeriesFromVCell.rawTimeSeriesImages, computeMeasurementError.rawImageTimeSeries);
workflow.addTask(computeMeasurementError);
//
// SLOW WAY
//
// RunRefSimulation runRefSimulationFull = new RunRefSimulation("runRefSimulationFull");
// runRefSimulationFull.cellROI_2D.setSource(generateCellROIs.cellROI_2D);
// runRefSimulationFull.normalizedTimeSeries.setSource(generateNormalizedFrapData.normalizedFrapData);
// workflow.addTask(runRefSimulationFull);
// GenerateReducedRefData generateReducedRefSimData = new GenerateReducedRefData("generateReducedRefSimData");
// generateReducedRefSimData.imageTimeSeries.setSource(runRefSimulationFull.refSimTimeSeries);
// generateReducedRefSimData.imageDataROIs.setSource(generateDependentROIs.imageDataROIs);
// workflow.addTask(generateReducedRefSimData);
// Generate2DOptContext generate2DOptContextFull = new Generate2DOptContext("generate2DOptContextFull");
// generate2DOptContextFull.normalizedMeasurementErrors.setSource(computeMeasurementError.normalizedMeasurementError);
// generate2DOptContextFull.modelType.setSource(modelType);
// generate2DOptContextFull.normExpData.setSource(generateReducedNormalizedData.reducedROIData);
// generate2DOptContextFull.refSimData.setSource(generateReducedRefSimData.reducedROIData);
// generate2DOptContextFull.refSimDiffusionRate.setSource(runRefSimulationFull.refSimDiffusionRate);
// workflow.addTask(generate2DOptContextFull);
//
// FAST WAY
//
GenerateTrivial2DPsf psf_2D = new GenerateTrivial2DPsf("psf_2D");
workflow.addTask(psf_2D);
RunRefSimulationFast runRefSimulationFast = new RunRefSimulationFast("runRefSimulationFast");
workflow.connect2(generateCellROIs.cellROI_2D, runRefSimulationFast.cellROI_2D);
workflow.connect2(generateNormalizedFrapData.normalizedFrapData, runRefSimulationFast.normalizedTimeSeries);
workflow.connect2(generateDependentROIs.imageDataROIs, runRefSimulationFast.imageDataROIs);
workflow.connect2(psf_2D.psf_2D, runRefSimulationFast.psf);
workflow.addTask(runRefSimulationFast);
//
// model with One mobile fraction
//
{
GenerateRefSimOptModel generateRefSimOptModelOne = new GenerateRefSimOptModel("generateRefSimOptModel");
workflow.connectParameter(modelTypeOne, generateRefSimOptModelOne.modelType);
workflow.connect2(runRefSimulationFast.reducedROIData, generateRefSimOptModelOne.refSimData);
workflow.connect2(runRefSimulationFast.refSimDiffusionRate, generateRefSimOptModelOne.refSimDiffusionRate);
workflow.addTask(generateRefSimOptModelOne);
Generate2DOptContext generate2DOptContextOne = new Generate2DOptContext("generate2DOptContextOne");
workflow.connect2(computeMeasurementError.normalizedMeasurementError, generate2DOptContextOne.normalizedMeasurementErrors);
workflow.connect2(generateReducedNormalizedData.reducedROIData, generate2DOptContextOne.normExpData);
workflow.connect2(generateRefSimOptModelOne.optModel, generate2DOptContextOne.optModel);
workflow.addTask(generate2DOptContextOne);
RunProfileLikelihoodGeneral runProfileLikelihoodOne = new RunProfileLikelihoodGeneral("runProfileLikelihoodOne");
workflow.connect2(generate2DOptContextOne.optContext, runProfileLikelihoodOne.optContext);
workflow.addTask(runProfileLikelihoodOne);
}
//
// model with One mobile fraction
//
GenerateRefSimOptModel generateRefSimOptModelTwo = new GenerateRefSimOptModel("generateRefSimOptModelTwo");
workflow.connectParameter(modelTypeTwo, generateRefSimOptModelTwo.modelType);
workflow.connect2(runRefSimulationFast.reducedROIData, generateRefSimOptModelTwo.refSimData);
workflow.connect2(runRefSimulationFast.refSimDiffusionRate, generateRefSimOptModelTwo.refSimDiffusionRate);
workflow.addTask(generateRefSimOptModelTwo);
Generate2DOptContext generate2DOptContextTwo = new Generate2DOptContext("generate2DOptContextTwo");
workflow.connect2(computeMeasurementError.normalizedMeasurementError, generate2DOptContextTwo.normalizedMeasurementErrors);
workflow.connect2(generateRefSimOptModelTwo.optModel, generate2DOptContextTwo.optModel);
workflow.connect2(generateReducedNormalizedData.reducedROIData, generate2DOptContextTwo.normExpData);
workflow.addTask(generate2DOptContextTwo);
RunProfileLikelihoodGeneral runProfileLikelihoodTwo = new RunProfileLikelihoodGeneral("runProfileLikelihoodTwo");
workflow.connect2(generate2DOptContextTwo.optContext, runProfileLikelihoodTwo.optContext);
workflow.addTask(runProfileLikelihoodTwo);
return workflow;
}
Aggregations