Search in sources :

Example 1 with ImportRawTimeSeriesFromVFrap

use of org.vcell.vmicro.workflow.task.ImportRawTimeSeriesFromVFrap in project vcell by virtualcell.

the class WorkflowTest method getVFrapSimpleExample.

public static Workflow getVFrapSimpleExample(File workingDirectory, File vfrapFile) {
    // 
    // construct the dataflow graph
    // 
    LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
    Workflow workflow = new Workflow("main");
    Repository repository = new MemoryRepository();
    TaskContext context = new TaskContext(workflow, repository, localWorkspace);
    // 
    // workflow parameters
    // 
    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> displayROITitle = workflow.addParameter(String.class, "displayROITitle");
    context.setParameterValue(displayROITitle, "rois");
    WorkflowParameter<String> displayProfileOneTitle = workflow.addParameter(String.class, "displayProfileOneTitle");
    context.setParameterValue(displayProfileOneTitle, "1 Diffusing");
    WorkflowParameter<String> displayProfileTwoWithoutPenaltyTitle = workflow.addParameter(String.class, "displayProfileTwoTitle");
    context.setParameterValue(displayProfileTwoWithoutPenaltyTitle, "2 Diffusing - no penalty");
    WorkflowParameter<String> displayProfileTwoWithPenaltyTitle = workflow.addParameter(String.class, "displayProfileTwoTitle");
    context.setParameterValue(displayProfileTwoWithPenaltyTitle, "2 Diffusing - with penalty");
    WorkflowParameter<String> displayRawImagesTitle = workflow.addParameter(String.class, "displayRawImagesTitle");
    context.setParameterValue(displayRawImagesTitle, "raw Images from " + ImportRawTimeSeriesFromVFrap.class.getName());
    ImportRawTimeSeriesFromVFrap importFromVFrap = new ImportRawTimeSeriesFromVFrap("importFromVFrap");
    workflow.connectParameter(vfrapFileParam, importFromVFrap.vfrapFile);
    workflow.addTask(importFromVFrap);
    DisplayTimeSeries displayRawImages = new DisplayTimeSeries("displayRawImages");
    workflow.connect2(importFromVFrap.rawTimeSeriesImages, displayRawImages.imageTimeSeries);
    workflow.connectParameter(displayRawImagesTitle, displayRawImages.title);
    workflow.addTask(displayRawImages);
    VFrapProcess vfrapProcess = new VFrapProcess("vfrapProcess");
    workflow.connectParameter(bleachThreshold, vfrapProcess.bleachThreshold);
    workflow.connectParameter(cellThreshold, vfrapProcess.cellThreshold);
    workflow.connect2(importFromVFrap.rawTimeSeriesImages, vfrapProcess.rawTimeSeriesImages);
    workflow.addTask(vfrapProcess);
    DisplayDependentROIs displayROIs = new DisplayDependentROIs("displayROis");
    workflow.connect2(vfrapProcess.cellROI_2D, displayROIs.cellROI);
    workflow.connect2(vfrapProcess.imageDataROIs, displayROIs.imageROIs);
    workflow.connectParameter(displayROITitle, displayROIs.title);
    workflow.addTask(displayROIs);
    DisplayProfileLikelihoodPlots displayProfilesOne = new DisplayProfileLikelihoodPlots("displayProfilesOne");
    workflow.connect2(vfrapProcess.profileDataOne, displayProfilesOne.profileData);
    workflow.connectParameter(displayProfileOneTitle, displayProfilesOne.title);
    workflow.addTask(displayProfilesOne);
    DisplayProfileLikelihoodPlots displayProfilesTwoWithPenalty = new DisplayProfileLikelihoodPlots("displayProfilesTwoWithPenalty");
    workflow.connect2(vfrapProcess.profileDataTwoWithPenalty, displayProfilesTwoWithPenalty.profileData);
    workflow.connectParameter(displayProfileTwoWithPenaltyTitle, displayProfilesTwoWithPenalty.title);
    workflow.addTask(displayProfilesTwoWithPenalty);
    return workflow;
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) TaskContext(org.vcell.workflow.TaskContext) DisplayTimeSeries(org.vcell.vmicro.workflow.task.DisplayTimeSeries) Workflow(org.vcell.workflow.Workflow) DisplayProfileLikelihoodPlots(org.vcell.vmicro.workflow.task.DisplayProfileLikelihoodPlots) MemoryRepository(org.vcell.workflow.MemoryRepository) Repository(org.vcell.workflow.Repository) DisplayDependentROIs(org.vcell.vmicro.workflow.task.DisplayDependentROIs) ImportRawTimeSeriesFromVFrap(org.vcell.vmicro.workflow.task.ImportRawTimeSeriesFromVFrap) MemoryRepository(org.vcell.workflow.MemoryRepository) VFrapProcess(org.vcell.vmicro.workflow.task.VFrapProcess) File(java.io.File)

Example 2 with ImportRawTimeSeriesFromVFrap

use of org.vcell.vmicro.workflow.task.ImportRawTimeSeriesFromVFrap 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;
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) TaskContext(org.vcell.workflow.TaskContext) GenerateReducedData(org.vcell.vmicro.workflow.task.GenerateReducedData) RunRefSimulationFast(org.vcell.vmicro.workflow.task.RunRefSimulationFast) GenerateDependentImageROIs(org.vcell.vmicro.workflow.task.GenerateDependentImageROIs) GenerateCellROIsFromRawTimeSeries(org.vcell.vmicro.workflow.task.GenerateCellROIsFromRawTimeSeries) Workflow(org.vcell.workflow.Workflow) RunProfileLikelihoodGeneral(org.vcell.vmicro.workflow.task.RunProfileLikelihoodGeneral) DisplayDependentROIs(org.vcell.vmicro.workflow.task.DisplayDependentROIs) ImportRawTimeSeriesFromVFrap(org.vcell.vmicro.workflow.task.ImportRawTimeSeriesFromVFrap) GenerateNormalizedFrapData(org.vcell.vmicro.workflow.task.GenerateNormalizedFrapData) ComputeMeasurementError(org.vcell.vmicro.workflow.task.ComputeMeasurementError) GenerateTrivial2DPsf(org.vcell.vmicro.workflow.task.GenerateTrivial2DPsf) GenerateRefSimOptModel(org.vcell.vmicro.workflow.task.GenerateRefSimOptModel) GenerateBleachROI(org.vcell.vmicro.workflow.task.GenerateBleachROI) File(java.io.File) Generate2DOptContext(org.vcell.vmicro.workflow.task.Generate2DOptContext)

Aggregations

File (java.io.File)2 LocalWorkspace (org.vcell.vmicro.workflow.data.LocalWorkspace)2 DisplayDependentROIs (org.vcell.vmicro.workflow.task.DisplayDependentROIs)2 ImportRawTimeSeriesFromVFrap (org.vcell.vmicro.workflow.task.ImportRawTimeSeriesFromVFrap)2 TaskContext (org.vcell.workflow.TaskContext)2 Workflow (org.vcell.workflow.Workflow)2 ComputeMeasurementError (org.vcell.vmicro.workflow.task.ComputeMeasurementError)1 DisplayProfileLikelihoodPlots (org.vcell.vmicro.workflow.task.DisplayProfileLikelihoodPlots)1 DisplayTimeSeries (org.vcell.vmicro.workflow.task.DisplayTimeSeries)1 Generate2DOptContext (org.vcell.vmicro.workflow.task.Generate2DOptContext)1 GenerateBleachROI (org.vcell.vmicro.workflow.task.GenerateBleachROI)1 GenerateCellROIsFromRawTimeSeries (org.vcell.vmicro.workflow.task.GenerateCellROIsFromRawTimeSeries)1 GenerateDependentImageROIs (org.vcell.vmicro.workflow.task.GenerateDependentImageROIs)1 GenerateNormalizedFrapData (org.vcell.vmicro.workflow.task.GenerateNormalizedFrapData)1 GenerateReducedData (org.vcell.vmicro.workflow.task.GenerateReducedData)1 GenerateRefSimOptModel (org.vcell.vmicro.workflow.task.GenerateRefSimOptModel)1 GenerateTrivial2DPsf (org.vcell.vmicro.workflow.task.GenerateTrivial2DPsf)1 RunProfileLikelihoodGeneral (org.vcell.vmicro.workflow.task.RunProfileLikelihoodGeneral)1 RunRefSimulationFast (org.vcell.vmicro.workflow.task.RunRefSimulationFast)1 VFrapProcess (org.vcell.vmicro.workflow.task.VFrapProcess)1