Search in sources :

Example 1 with LocalWorkspace

use of org.vcell.vmicro.workflow.data.LocalWorkspace in project vcell by virtualcell.

the class VFrapProcess method main.

public static void main(String[] args) {
    try {
        File baseDir = new File(".");
        // File baseDir = new File("/Users/schaff/Documents/workspace/VCell_5.4");
        // initialize computing environment
        // 
        File workingDirectory = new File(baseDir, "workingDir");
        LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
        // 
        // import raw image time series data from VFRAP file format (can have noise, background, etc ... can be actual microscopy data)
        // 
        ClientTaskStatusSupport progressListener = new ClientTaskStatusSupport() {

            String message = "";

            int progress = 0;

            @Override
            public void setProgress(int progress) {
                this.progress = progress;
            }

            @Override
            public void setMessage(String message) {
                this.message = message;
            }

            @Override
            public boolean isInterrupted() {
                return false;
            }

            @Override
            public int getProgress() {
                return progress;
            }

            @Override
            public void addProgressDialogListener(ProgressDialogListener progressDialogListener) {
            }
        };
        // 
        // generate fake data (and save?)
        // 
        // ImageTimeSeries<UShortImage> simulatedFluorescence = generateFakeData(localWorkspace, progressListener);
        // new ExportRawTimeSeriesToVFrapOp().exportToVFRAP(vfrapFile, simulatedFluorescence, null);
        // 
        // analyze raw data (from file?) using Keyworthy method.
        // 
        File vfrapFile = new File(baseDir, "vfrapPaper/rawData/sim3/workflow.txt.save");
        ImageTimeSeries<UShortImage> fluorTimeSeriesImages = new ImportRawTimeSeriesFromVFrapOp().importRawTimeSeriesFromVFrap(vfrapFile);
        VFrapProcessResults results = compute(fluorTimeSeriesImages, 0.85, 0.4, localWorkspace, progressListener);
        new DisplayTimeSeriesOp().displayImageTimeSeries(fluorTimeSeriesImages, "raw data", null);
        new DisplayImageOp().displayImage(results.cellROI_2D.getRoiImages()[0], "cell ROI", null);
        new DisplayImageOp().displayImage(results.bleachROI_2D.getRoiImages()[0], "bleach ROI", null);
        new DisplayDependentROIsOp().displayDependentROIs(results.imageDataROIs, results.cellROI_2D, "data rois", null);
        new DisplayTimeSeriesOp().displayImageTimeSeries(results.normalizedTimeSeries, "normalized data", null);
        new DisplayProfileLikelihoodPlotsOp().displayProfileLikelihoodPlots(results.profileDataOne, "one fluorescent pool", null);
        new DisplayProfileLikelihoodPlotsOp().displayProfileLikelihoodPlots(results.profileDataTwoWithPenalty, "too pools", null);
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : DisplayProfileLikelihoodPlotsOp(org.vcell.vmicro.op.display.DisplayProfileLikelihoodPlotsOp) LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) DisplayImageOp(org.vcell.vmicro.op.display.DisplayImageOp) ProgressDialogListener(org.vcell.util.ProgressDialogListener) DisplayTimeSeriesOp(org.vcell.vmicro.op.display.DisplayTimeSeriesOp) ClientTaskStatusSupport(org.vcell.util.ClientTaskStatusSupport) ImportRawTimeSeriesFromVFrapOp(org.vcell.vmicro.op.ImportRawTimeSeriesFromVFrapOp) DisplayDependentROIsOp(org.vcell.vmicro.op.display.DisplayDependentROIsOp) File(java.io.File)

Example 2 with LocalWorkspace

use of org.vcell.vmicro.workflow.data.LocalWorkspace in project vcell by virtualcell.

the class PhotoactivationExperimentTest method main.

public static void main(String[] args) {
    try {
        File baseDir = new File(".");
        // File baseDir = new File("/Users/schaff/Documents/workspace/VCell_5.4");
        // initialize computing environment
        // 
        File workingDirectory = new File(baseDir, "workingDir");
        LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
        // 
        // import raw image time series data from VFRAP file format (can have noise, background, etc ... can be actual microscopy data)
        // 
        ClientTaskStatusSupport progressListener = new ClientTaskStatusSupport() {

            String message = "";

            int progress = 0;

            @Override
            public void setProgress(int progress) {
                this.progress = progress;
            }

            @Override
            public void setMessage(String message) {
                this.message = message;
            }

            @Override
            public boolean isInterrupted() {
                return false;
            }

            @Override
            public int getProgress() {
                return progress;
            }

            @Override
            public void addProgressDialogListener(ProgressDialogListener progressDialogListener) {
            }
        };
        // 
        // generate fake data (and save?)
        // 
        // ImageTimeSeries<UShortImage> simulatedFluorescence = generateFakeData(localWorkspace, progressListener);
        // new ExportRawTimeSeriesToVFrapOp().exportToVFRAP(vfrapFile, simulatedFluorescence, null);
        // 
        // analyze raw data (from file?) using Keyworthy method.
        // 
        // File vfrapFile = new File(baseDir, "vfrapPaper/photoactivation/Actin.vfrap");
        File vfrapFile = new File(baseDir, "vfrapPaper/photoactivation/Actin_binding_protein.vfrap");
        ImageTimeSeries<UShortImage> fluorTimeSeriesImages = new ImportRawTimeSeriesFromVFrapOp().importRawTimeSeriesFromVFrap(vfrapFile);
        analyzePhotoactivation(fluorTimeSeriesImages, localWorkspace);
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) ProgressDialogListener(org.vcell.util.ProgressDialogListener) ClientTaskStatusSupport(org.vcell.util.ClientTaskStatusSupport) ImportRawTimeSeriesFromVFrapOp(org.vcell.vmicro.op.ImportRawTimeSeriesFromVFrapOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) File(java.io.File) ImageException(cbit.image.ImageException)

Example 3 with LocalWorkspace

use of org.vcell.vmicro.workflow.data.LocalWorkspace in project vcell by virtualcell.

the class WorkflowObjectsPanel method runButtonPressed.

private void runButtonPressed() throws Exception {
    if (taskContext != null) {
        LocalWorkspace localWorkspace = new LocalWorkspace(new File("C:\\temp\\"));
        Repository repository = new MemoryRepository();
        taskContext.getWorkflow().compute(taskContext, new ClientTaskStatusSupport() {

            @Override
            public void setMessage(String message) {
                System.out.println("message = " + message);
            }

            @Override
            public void setProgress(int progress) {
                System.out.println("progress = " + progress);
            }

            @Override
            public int getProgress() {
                return 0;
            }

            @Override
            public boolean isInterrupted() {
                return false;
            }

            @Override
            public void addProgressDialogListener(ProgressDialogListener progressDialogListener) {
            }
        });
    }
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) MemoryRepository(org.vcell.workflow.MemoryRepository) Repository(org.vcell.workflow.Repository) ProgressDialogListener(org.vcell.util.ProgressDialogListener) MemoryRepository(org.vcell.workflow.MemoryRepository) ClientTaskStatusSupport(org.vcell.util.ClientTaskStatusSupport) File(java.io.File)

Example 4 with LocalWorkspace

use of org.vcell.vmicro.workflow.data.LocalWorkspace in project vcell by virtualcell.

the class WorkflowFileTest 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 {
        File workingDirectory = new File(args[0]);
        LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
        String workflowLanguageText = BeanUtils.readBytesFromFile(new File(args[1]), null);
        Repository repository = new MemoryRepository();
        Workflow workflow = Workflow.parse(repository, localWorkspace, workflowLanguageText);
        TaskContext taskContext = new TaskContext(workflow, repository, localWorkspace);
        WorkflowUtilities.displayWorkflowGraph(taskContext.getWorkflow());
        WorkflowUtilities.displayWorkflowTable(taskContext);
        WorkflowUtilities.displayWorkflowGraphJGraphX(new WorkflowJGraphProxy(taskContext));
        ArrayList<Issue> issues = new ArrayList<Issue>();
        taskContext.getWorkflow().reportIssues(issues, Issue.SEVERITY_INFO, true);
        // 
        // execute the workflow
        // 
        taskContext.getWorkflow().compute(taskContext, new WorkflowUtilities.Progress());
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) TaskContext(org.vcell.workflow.TaskContext) Issue(org.vcell.util.Issue) ArrayList(java.util.ArrayList) Workflow(org.vcell.workflow.Workflow) WorkflowJGraphProxy(org.vcell.vmicro.workflow.jgraphx.WorkflowJGraphProxy) Repository(org.vcell.workflow.Repository) MemoryRepository(org.vcell.workflow.MemoryRepository) MemoryRepository(org.vcell.workflow.MemoryRepository) File(java.io.File)

Example 5 with LocalWorkspace

use of org.vcell.vmicro.workflow.data.LocalWorkspace 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)

Aggregations

LocalWorkspace (org.vcell.vmicro.workflow.data.LocalWorkspace)13 File (java.io.File)11 Workflow (org.vcell.workflow.Workflow)7 TaskContext (org.vcell.workflow.TaskContext)6 ClientTaskStatusSupport (org.vcell.util.ClientTaskStatusSupport)5 MemoryRepository (org.vcell.workflow.MemoryRepository)5 Repository (org.vcell.workflow.Repository)5 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)4 ProgressDialogListener (org.vcell.util.ProgressDialogListener)4 ImportRawTimeSeriesFromVFrapOp (org.vcell.vmicro.op.ImportRawTimeSeriesFromVFrapOp)4 ArrayList (java.util.ArrayList)3 Issue (org.vcell.util.Issue)3 IssueContext (org.vcell.util.IssueContext)2 DisplayDependentROIs (org.vcell.vmicro.workflow.task.DisplayDependentROIs)2 ImportRawTimeSeriesFromVFrap (org.vcell.vmicro.workflow.task.ImportRawTimeSeriesFromVFrap)2 ImageException (cbit.image.ImageException)1 FloatImage (cbit.vcell.VirtualMicroscopy.FloatImage)1 CSV (cbit.vcell.math.CSV)1 RowColumnResultSet (cbit.vcell.math.RowColumnResultSet)1 Simulation (cbit.vcell.solver.Simulation)1