Search in sources :

Example 1 with GeneratedModelResults

use of org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults in project vcell by virtualcell.

the class Generate2DExpModel_UniformBleach method compute0.

@Override
protected void compute0(final TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get input
    double deltaX = context.getData(this.deltaX);
    double bleachRadius = context.getData(this.bleachRadius);
    double cellRadius = context.getData(this.cellRadius);
    double bleachDuration = context.getData(this.bleachDuration);
    double bleachRate = context.getData(this.bleachRate);
    double postbleachDelay = context.getData(this.postbleachDelay);
    double postbleachDuration = context.getData(this.postbleachDuration);
    double psfSigma = context.getData(this.psfSigma);
    double outputTimeStep = context.getData(this.outputTimeStep);
    double primaryDiffusionRate = context.getData(this.primaryDiffusionRate);
    double primaryFraction = context.getData(this.primaryFraction);
    double bleachMonitorRate = context.getData(this.bleachMonitorRate);
    double secondaryDiffusionRate = context.getData(this.secondaryDiffusionRate);
    double secondaryFraction = context.getData(this.secondaryFraction);
    String extracellularName = context.getData(this.extracellularName);
    String cytosolName = context.getData(this.cytosolName);
    // isolate from Workflow
    Context modelGenerationContext = new Context() {

        @Override
        public User getDefaultOwner() {
            return context.getDefaultOwner();
        }

        @Override
        public KeyValue createNewKeyValue() {
            return context.createNewKeyValue();
        }
    };
    // do op
    Generate2DExpModel_UniformBleachOp op = new Generate2DExpModel_UniformBleachOp();
    GeneratedModelResults results = op.generateModel(deltaX, bleachRadius, cellRadius, bleachDuration, bleachRate, postbleachDelay, postbleachDuration, psfSigma, outputTimeStep, primaryDiffusionRate, primaryFraction, bleachMonitorRate, secondaryDiffusionRate, secondaryFraction, extracellularName, cytosolName, modelGenerationContext);
    // set output
    context.setData(this.bioModel_2D, results.bioModel_2D);
    context.setData(this.simulation_2D, results.simulation_2D);
    context.setData(this.bleachBlackoutBeginTime, results.bleachBlackoutBeginTime);
    context.setData(this.bleachBlackoutEndTime, results.bleachBlackoutEndTime);
}
Also used : Context(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.Context) TaskContext(org.vcell.workflow.TaskContext) GeneratedModelResults(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults) Generate2DExpModel_UniformBleachOp(org.vcell.vmicro.op.Generate2DExpModel_UniformBleachOp)

Example 2 with GeneratedModelResults

use of org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults in project vcell by virtualcell.

the class Generate2DExpModel_GaussianBleach method compute0.

@Override
protected void compute0(final TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get input
    double deltaX = context.getData(this.deltaX);
    double bleachRadius = context.getData(this.bleachRadius);
    double cellRadius = context.getData(this.cellRadius);
    double bleachDuration = context.getData(this.bleachDuration);
    double bleachRate = context.getData(this.bleachRate);
    double postbleachDelay = context.getData(this.postbleachDelay);
    double postbleachDuration = context.getData(this.postbleachDuration);
    double psfSigma = context.getData(this.psfSigma);
    double outputTimeStep = context.getData(this.outputTimeStep);
    double primaryDiffusionRate = context.getData(this.primaryDiffusionRate);
    double primaryFraction = context.getData(this.primaryFraction);
    double bleachMonitorRate = context.getData(this.bleachMonitorRate);
    double secondaryDiffusionRate = context.getData(this.secondaryDiffusionRate);
    double secondaryFraction = context.getData(this.secondaryFraction);
    String extracellularName = context.getData(this.extracellularName);
    String cytosolName = context.getData(this.cytosolName);
    // isolate from Workflow
    Context modelGenerationContext = new Context() {

        @Override
        public User getDefaultOwner() {
            return context.getDefaultOwner();
        }

        @Override
        public KeyValue createNewKeyValue() {
            return context.createNewKeyValue();
        }
    };
    // do op
    Generate2DExpModel_GaussianBleachOp op = new Generate2DExpModel_GaussianBleachOp();
    GeneratedModelResults results = op.generateModel(deltaX, bleachRadius, cellRadius, bleachDuration, bleachRate, postbleachDelay, postbleachDuration, psfSigma, outputTimeStep, primaryDiffusionRate, primaryFraction, bleachMonitorRate, secondaryDiffusionRate, secondaryFraction, extracellularName, cytosolName, modelGenerationContext);
    // set output
    context.setData(this.bioModel_2D, results.bioModel_2D);
    context.setData(this.simulation_2D, results.simulation_2D);
    context.setData(this.bleachBlackoutBeginTime, results.bleachBlackoutBeginTime);
    context.setData(this.bleachBlackoutEndTime, results.bleachBlackoutEndTime);
}
Also used : Context(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.Context) TaskContext(org.vcell.workflow.TaskContext) GeneratedModelResults(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults) Generate2DExpModel_GaussianBleachOp(org.vcell.vmicro.op.Generate2DExpModel_GaussianBleachOp)

Example 3 with GeneratedModelResults

use of org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults in project vcell by virtualcell.

the class KenworthyParticleTest method generateFakeData.

private static ImageTimeSeries<UShortImage> generateFakeData(LocalWorkspace localWorkspace, ClientTaskStatusSupport progressListener) throws Exception {
    // 
    // technical simulation parameters
    // 
    double deltaX = 0.3;
    double outputTimeStep = 0.3;
    // 
    // circular 2D cell geometry
    // 
    double cellRadius = 50.0;
    String extracellularName = "ec";
    String cytosolName = "cytosol";
    // 
    // bleaching experimental protocol
    // 
    double bleachRadius = 1.5;
    double bleachDuration = 0.003;
    double bleachRate = 500.0;
    double postbleachDelay = 0.001;
    double postbleachDuration = 25.0;
    double psfSigma = 0.01;
    // 
    // underlying physiological model
    // 
    double primaryDiffusionRate = 2.0;
    double primaryFraction = 1.0;
    double bleachMonitorRate = 0.0000005;
    double secondaryDiffusionRate = 0.0;
    double secondaryFraction = 0.0;
    // 
    // generate corresponding BioModel with Application and Simulation ready for simulation.
    // 
    Context context = new Context() {

        @Override
        public User getDefaultOwner() {
            return LocalWorkspace.getDefaultOwner();
        }

        @Override
        public KeyValue createNewKeyValue() {
            return LocalWorkspace.createNewKeyValue();
        }
    };
    GeneratedModelResults results = new Generate2DExpModel_GaussianBleachOp().generateModel(deltaX, bleachRadius, cellRadius, bleachDuration, bleachRate, postbleachDelay, postbleachDuration, psfSigma, outputTimeStep, primaryDiffusionRate, primaryFraction, bleachMonitorRate, secondaryDiffusionRate, secondaryFraction, extracellularName, cytosolName, context);
    Simulation simulation = results.simulation_2D;
    double bleachBlackoutStartTime = results.bleachBlackoutBeginTime;
    double bleachBlackoutStopTime = results.bleachBlackoutEndTime;
    // 
    // run simulation to get simulated fluorescence (with noise)
    // 
    boolean hasNoise = true;
    double maxIntensity = 60000.0;
    ImageTimeSeries<UShortImage> simulatedFluorescence = new RunFakeSimOp().runRefSimulation(localWorkspace, simulation, maxIntensity, bleachBlackoutStartTime, bleachBlackoutStopTime, hasNoise, progressListener);
    return simulatedFluorescence;
}
Also used : OptContext(org.vcell.vmicro.workflow.data.OptContext) Context(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.Context) RunFakeSimOp(org.vcell.vmicro.op.RunFakeSimOp) Simulation(cbit.vcell.solver.Simulation) GeneratedModelResults(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults) Generate2DExpModel_GaussianBleachOp(org.vcell.vmicro.op.Generate2DExpModel_GaussianBleachOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage)

Example 4 with GeneratedModelResults

use of org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults in project vcell by virtualcell.

the class KenworthyWorkflowTest method generateFakeData.

private static ImageTimeSeries<UShortImage> generateFakeData(LocalWorkspace localWorkspace, ClientTaskStatusSupport progressListener) throws Exception {
    // 
    // technical simulation parameters
    // 
    double deltaX = 0.3;
    double outputTimeStep = 0.3;
    // 
    // circular 2D cell geometry
    // 
    double cellRadius = 50.0;
    String extracellularName = "ec";
    String cytosolName = "cytosol";
    // 
    // bleaching experimental protocol
    // 
    double bleachRadius = 1.5;
    double bleachDuration = 0.003;
    double bleachRate = 500.0;
    double postbleachDelay = 0.001;
    double postbleachDuration = 25.0;
    double psfSigma = 0.01;
    // 
    // underlying physiological model
    // 
    double primaryDiffusionRate = 2.0;
    double primaryFraction = 1.0;
    double bleachMonitorRate = 0.0000005;
    double secondaryDiffusionRate = 0.0;
    double secondaryFraction = 0.0;
    // 
    // generate corresponding BioModel with Application and Simulation ready for simulation.
    // 
    Context context = new Context() {

        @Override
        public User getDefaultOwner() {
            return LocalWorkspace.getDefaultOwner();
        }

        @Override
        public KeyValue createNewKeyValue() {
            return LocalWorkspace.createNewKeyValue();
        }
    };
    GeneratedModelResults results = new Generate2DExpModel_GaussianBleachOp().generateModel(deltaX, bleachRadius, cellRadius, bleachDuration, bleachRate, postbleachDelay, postbleachDuration, psfSigma, outputTimeStep, primaryDiffusionRate, primaryFraction, bleachMonitorRate, secondaryDiffusionRate, secondaryFraction, extracellularName, cytosolName, context);
    Simulation simulation = results.simulation_2D;
    double bleachBlackoutStartTime = results.bleachBlackoutBeginTime;
    double bleachBlackoutStopTime = results.bleachBlackoutEndTime;
    // 
    // run simulation to get simulated fluorescence (with noise)
    // 
    boolean hasNoise = true;
    double maxIntensity = 60000.0;
    ImageTimeSeries<UShortImage> simulatedFluorescence = new RunFakeSimOp().runRefSimulation(localWorkspace, simulation, maxIntensity, bleachBlackoutStartTime, bleachBlackoutStopTime, hasNoise, progressListener);
    return simulatedFluorescence;
}
Also used : OptContext(org.vcell.vmicro.workflow.data.OptContext) Context(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.Context) RunFakeSimOp(org.vcell.vmicro.op.RunFakeSimOp) Simulation(cbit.vcell.solver.Simulation) GeneratedModelResults(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults) Generate2DExpModel_GaussianBleachOp(org.vcell.vmicro.op.Generate2DExpModel_GaussianBleachOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage)

Example 5 with GeneratedModelResults

use of org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults in project vcell by virtualcell.

the class PhotoactivationExperimentTest method generateFakeData.

private static ImageTimeSeries<UShortImage> generateFakeData(LocalWorkspace localWorkspace, ClientTaskStatusSupport progressListener) throws Exception {
    // 
    // technical simulation parameters
    // 
    double deltaX = 0.3;
    double outputTimeStep = 0.3;
    // 
    // circular 2D cell geometry
    // 
    double cellRadius = 50.0;
    String extracellularName = "ec";
    String cytosolName = "cytosol";
    // 
    // bleaching experimental protocol
    // 
    double bleachRadius = 1.5;
    double bleachDuration = 0.003;
    double bleachRate = 500.0;
    double postbleachDelay = 0.001;
    double postbleachDuration = 25.0;
    double psfSigma = 0.01;
    // 
    // underlying physiological model
    // 
    double primaryDiffusionRate = 2.0;
    double primaryFraction = 1.0;
    double bleachMonitorRate = 0.0000005;
    double secondaryDiffusionRate = 0.0;
    double secondaryFraction = 0.0;
    // 
    // generate corresponding BioModel with Application and Simulation ready for simulation.
    // 
    Context context = new Context() {

        @Override
        public User getDefaultOwner() {
            return LocalWorkspace.getDefaultOwner();
        }

        @Override
        public KeyValue createNewKeyValue() {
            return LocalWorkspace.createNewKeyValue();
        }
    };
    GeneratedModelResults results = new Generate2DExpModel_GaussianBleachOp().generateModel(deltaX, bleachRadius, cellRadius, bleachDuration, bleachRate, postbleachDelay, postbleachDuration, psfSigma, outputTimeStep, primaryDiffusionRate, primaryFraction, bleachMonitorRate, secondaryDiffusionRate, secondaryFraction, extracellularName, cytosolName, context);
    Simulation simulation = results.simulation_2D;
    double bleachBlackoutStartTime = results.bleachBlackoutBeginTime;
    double bleachBlackoutStopTime = results.bleachBlackoutEndTime;
    // 
    // run simulation to get simulated fluorescence (with noise)
    // 
    boolean hasNoise = true;
    double maxIntensity = 60000.0;
    ImageTimeSeries<UShortImage> simulatedFluorescence = new RunFakeSimOp().runRefSimulation(localWorkspace, simulation, maxIntensity, bleachBlackoutStartTime, bleachBlackoutStopTime, hasNoise, progressListener);
    return simulatedFluorescence;
}
Also used : OptContext(org.vcell.vmicro.workflow.data.OptContext) Context(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.Context) RunFakeSimOp(org.vcell.vmicro.op.RunFakeSimOp) Simulation(cbit.vcell.solver.Simulation) GeneratedModelResults(org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults) Generate2DExpModel_GaussianBleachOp(org.vcell.vmicro.op.Generate2DExpModel_GaussianBleachOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage)

Aggregations

Context (org.vcell.vmicro.op.Generate2DExpModelOpAbstract.Context)5 GeneratedModelResults (org.vcell.vmicro.op.Generate2DExpModelOpAbstract.GeneratedModelResults)5 Generate2DExpModel_GaussianBleachOp (org.vcell.vmicro.op.Generate2DExpModel_GaussianBleachOp)4 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)3 Simulation (cbit.vcell.solver.Simulation)3 RunFakeSimOp (org.vcell.vmicro.op.RunFakeSimOp)3 OptContext (org.vcell.vmicro.workflow.data.OptContext)3 TaskContext (org.vcell.workflow.TaskContext)2 Generate2DExpModel_UniformBleachOp (org.vcell.vmicro.op.Generate2DExpModel_UniformBleachOp)1