Search in sources :

Example 6 with LocalWorkspace

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

the class WorkflowTest 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(repository, 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);
        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);
    }
}
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) MemoryRepository(org.vcell.workflow.MemoryRepository) Repository(org.vcell.workflow.Repository) MemoryRepository(org.vcell.workflow.MemoryRepository) IssueContext(org.vcell.util.IssueContext) File(java.io.File)

Example 7 with LocalWorkspace

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

the class KenworthyWorkflowTest 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");
        // File vfrapFile = new File(baseDir, "tryit.vfrap");
        ImageTimeSeries<UShortImage> fluorTimeSeriesImages = new ImportRawTimeSeriesFromVFrapOp().importRawTimeSeriesFromVFrap(vfrapFile);
        analyzeKeyworthy(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)

Example 8 with LocalWorkspace

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

the class KenworthyParticleTest 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);
        // 
        // analyze raw data (from file?) using Keyworthy method.
        // 
        // File vfrapFile = new File(baseDir, "vfrapPaper/rawData/sim3/workflow.txt.save");
        File vfrapFile = new File(baseDir, "tryit.vfrap");
        ImageTimeSeries<UShortImage> fluorTimeSeriesImages = new ImportRawTimeSeriesFromVFrapOp().importRawTimeSeriesFromVFrap(vfrapFile);
        RowColumnResultSet reducedData = new CSV().importFrom(new FileReader(new File(baseDir, "tryit.csv")));
        analyzeKeyworthy(fluorTimeSeriesImages, reducedData, localWorkspace);
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) CSV(cbit.vcell.math.CSV) ImportRawTimeSeriesFromVFrapOp(org.vcell.vmicro.op.ImportRawTimeSeriesFromVFrapOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) FileReader(java.io.FileReader) File(java.io.File) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet)

Example 9 with LocalWorkspace

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

the class WorkflowModelPanel method main.

/**
 * main entrypoint - starts the part when it is run as an application
 * @param args java.lang.String[]
 */
public static void main(java.lang.String[] args) {
    try {
        JFrame frame = new javax.swing.JFrame();
        WorkflowModelPanel aWorkflowModelPanel;
        aWorkflowModelPanel = new WorkflowModelPanel();
        frame.setContentPane(aWorkflowModelPanel);
        frame.setSize(aWorkflowModelPanel.getSize());
        frame.addWindowListener(new java.awt.event.WindowAdapter() {

            @Override
            public void windowClosing(java.awt.event.WindowEvent e) {
                System.exit(0);
            }
        });
        LocalWorkspace localWorkspace = new LocalWorkspace(new File("C:\\temp"));
        Workflow workflow = new Workflow("temp");
        class Task1 extends Task {

            final DataInput<Double> in = new DataInput<Double>(Double.class, "in", this);

            final DataOutput<Double> out = new DataOutput<Double>(Double.class, "out", this);

            public Task1() {
                super("t1");
                addInput(in);
                addOutput(out);
            }

            @Override
            protected void compute0(TaskContext context, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
                System.out.println("executing task " + getName());
            }
        }
        ;
        class Task2 extends Task {

            final DataInput<Double> in = new DataInput<Double>(Double.class, "in", this);

            final DataOutput<Double> out = new DataOutput<Double>(Double.class, "out", this);

            public Task2() {
                super("t2");
                addInput(in);
                addOutput(out);
            }

            @Override
            protected void compute0(TaskContext context, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
                System.out.println("executing task " + getName());
            }
        }
        ;
        Task1 task1 = new Task1();
        workflow.addTask(task1);
        Task2 task2 = new Task2();
        workflow.addTask(task2);
        workflow.connect2(task1.out, task2.in);
        aWorkflowModelPanel.setWorkflow(workflow);
        frame.setVisible(true);
        java.awt.Insets insets = frame.getInsets();
        frame.setSize(frame.getWidth() + insets.left + insets.right, frame.getHeight() + insets.top + insets.bottom);
        frame.setVisible(true);
    } catch (Throwable exception) {
        System.err.println("Exception occurred in main() of javax.swing.JPanel");
        exception.printStackTrace(System.out);
    }
}
Also used : DataOutput(org.vcell.workflow.DataOutput) LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) Task(org.vcell.workflow.Task) TaskContext(org.vcell.workflow.TaskContext) Workflow(org.vcell.workflow.Workflow) DataInput(org.vcell.workflow.DataInput) JFrame(javax.swing.JFrame) ClientTaskStatusSupport(org.vcell.util.ClientTaskStatusSupport) File(java.io.File)

Example 10 with LocalWorkspace

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

the class RunSimulation2D method compute0.

@Override
protected void compute0(TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get input
    LocalWorkspace localWorkspace = context.getLocalWorkspace();
    Simulation sim = context.getData(simulation_2D);
    String dataVar = context.getData(dataVarName);
    // do op
    RunSimulation2DOp op = new RunSimulation2DOp();
    ImageTimeSeries<FloatImage> solution = op.runRefSimulation(localWorkspace, sim, dataVar, clientTaskStatusSupport);
    // set output
    context.setData(simTimeSeries, solution);
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) FloatImage(cbit.vcell.VirtualMicroscopy.FloatImage) Simulation(cbit.vcell.solver.Simulation) RunSimulation2DOp(org.vcell.vmicro.op.RunSimulation2DOp)

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