Search in sources :

Example 6 with ImageTimeSeries

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

the class WorkflowObjectsPanel method displayData.

private void displayData(TaskContext taskContext, WorkflowObject workflowObject) {
    if (workflowObject instanceof DataInput || workflowObject instanceof DataOutput) {
        String title = parametersFunctionsTableModel.getName(workflowObject);
        WindowListener listener = new WindowAdapter() {
        };
        Object data = null;
        if (workflowObject instanceof WorkflowDataSource) {
            WorkflowDataSource dataHolder = (WorkflowDataSource) workflowObject;
            data = taskContext.getRepository().getData(dataHolder);
        } else if (workflowObject instanceof DataInput) {
            DataInput dataInput = (DataInput) workflowObject;
            data = taskContext.getData(dataInput);
        }
        if (data instanceof RowColumnResultSet) {
            RowColumnResultSet rc = (RowColumnResultSet) data;
            try {
                new DisplayPlotOp().displayPlot(rc, title, listener);
            } catch (ExpressionException e) {
                e.printStackTrace();
            }
        } else if (data instanceof ROI) {
            ROI roi = (ROI) data;
            Image image = roi.getRoiImages()[0];
            new DisplayImageOp().displayImage(image, title, listener);
        } else if (data instanceof ProfileData[]) {
            ProfileData[] profileData = (ProfileData[]) data;
            new DisplayProfileLikelihoodPlotsOp().displayProfileLikelihoodPlots(profileData, title, listener);
        } else if (data instanceof Image) {
            Image image = (Image) data;
            new DisplayImageOp().displayImage(image, title, listener);
        } else if (data instanceof ImageTimeSeries) {
            ImageTimeSeries imageTimeSeries = (ImageTimeSeries) data;
            try {
                DisplayTimeSeries.displayImageTimeSeries(imageTimeSeries, title, listener);
            } catch (ImageException | IOException e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : DataOutput(org.vcell.workflow.DataOutput) DisplayProfileLikelihoodPlotsOp(org.vcell.vmicro.op.display.DisplayProfileLikelihoodPlotsOp) WindowListener(java.awt.event.WindowListener) ImageException(cbit.image.ImageException) WindowAdapter(java.awt.event.WindowAdapter) ProfileData(org.vcell.optimization.ProfileData) IOException(java.io.IOException) Image(cbit.vcell.VirtualMicroscopy.Image) ROI(cbit.vcell.VirtualMicroscopy.ROI) WorkflowDataSource(org.vcell.workflow.WorkflowDataSource) ExpressionException(cbit.vcell.parser.ExpressionException) DataInput(org.vcell.workflow.DataInput) DisplayPlotOp(org.vcell.vmicro.op.display.DisplayPlotOp) DisplayImageOp(org.vcell.vmicro.op.display.DisplayImageOp) WorkflowObject(org.vcell.workflow.WorkflowObject) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 7 with ImageTimeSeries

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

the class WorkflowObjectsPanel method hasDisplayData.

private boolean hasDisplayData(TaskContext taskContext, WorkflowObject workflowObject) {
    if (workflowObject instanceof DataInput || workflowObject instanceof DataOutput) {
        String title = parametersFunctionsTableModel.getName(workflowObject);
        WindowListener listener = new WindowAdapter() {
        };
        Object data = null;
        if (workflowObject instanceof WorkflowDataSource) {
            WorkflowDataSource dataHolder = (WorkflowDataSource) workflowObject;
            data = taskContext.getRepository().getData(dataHolder);
        } else if (workflowObject instanceof DataInput) {
            DataInput dataInput = (DataInput) workflowObject;
            data = taskContext.getData(dataInput);
        }
        if (data instanceof RowColumnResultSet || data instanceof ROI || data instanceof ProfileData[] || data instanceof Image || data instanceof ImageTimeSeries) {
            return true;
        }
    }
    return false;
}
Also used : DataOutput(org.vcell.workflow.DataOutput) WindowListener(java.awt.event.WindowListener) WindowAdapter(java.awt.event.WindowAdapter) ProfileData(org.vcell.optimization.ProfileData) Image(cbit.vcell.VirtualMicroscopy.Image) ROI(cbit.vcell.VirtualMicroscopy.ROI) WorkflowDataSource(org.vcell.workflow.WorkflowDataSource) DataInput(org.vcell.workflow.DataInput) WorkflowObject(org.vcell.workflow.WorkflowObject) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 8 with ImageTimeSeries

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

the class GenerateReducedData method compute0.

@Override
protected void compute0(TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get input
    ROI[] rois = context.getData(imageDataROIs);
    ImageTimeSeries<? extends Image> simData = (ImageTimeSeries<? extends Image>) context.getData(imageTimeSeries);
    // do op
    GenerateReducedDataOp op = new GenerateReducedDataOp();
    RowColumnResultSet reducedData = op.generateReducedData(simData, rois);
    // set output
    context.setData(reducedROIData, reducedData);
}
Also used : Image(cbit.vcell.VirtualMicroscopy.Image) GenerateReducedDataOp(org.vcell.vmicro.op.GenerateReducedDataOp) ROI(cbit.vcell.VirtualMicroscopy.ROI) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet)

Example 9 with ImageTimeSeries

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

the class ImportRawTimeSeriesFromExperimentImageOp method importRawTimeSeries.

public ImageTimeSeries<UShortImage> importRawTimeSeries(File expTimeSeriesFile) throws Exception {
    ClientTaskStatusSupport clientTaskStatusSupport = null;
    ImageDataset rawTimeData = ImageDatasetReaderService.getInstance().getImageDatasetReader().readImageDataset(expTimeSeriesFile.getAbsolutePath(), clientTaskStatusSupport);
    ImageTimeSeries<UShortImage> imageTimeSeries = new ImageTimeSeries<UShortImage>(UShortImage.class, rawTimeData.getAllImages(), rawTimeData.getImageTimeStamps(), 1);
    return imageTimeSeries;
}
Also used : ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset) ClientTaskStatusSupport(org.vcell.util.ClientTaskStatusSupport) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 10 with ImageTimeSeries

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

the class FluorescenceNoiseTest method generateTestData.

private ImageTimeSeries<UShortImage> generateTestData(Origin origin, Extent extent, int numX, int numY, int numParticles, double diffusionRate, double psfVar, double bleachRadius, boolean bNoise, boolean bConvolve) throws ImageException {
    double detectorGainAndQuantumYeild = 100;
    double totalSampleTime = 0.5;
    int numSampleSteps = 1;
    int numPrebleach = 2;
    ArrayList<UShortImage> images = new ArrayList<UShortImage>();
    ArrayList<Double> times = new ArrayList<Double>();
    final BrownianDynamics2DSolver solver = new BrownianDynamics2DSolver(origin, extent, numParticles);
    boolean initiallyFluorescent = true;
    solver.initializeUniform(initiallyFluorescent);
    // simulate and write prebleach images
    for (int i = 0; i < numPrebleach; i++) {
        images.add(solver.sampleImage(numX, numY, origin, extent, diffusionRate, totalSampleTime, numSampleSteps, psfVar, detectorGainAndQuantumYeild, bConvolve, bNoise));
        times.add(solver.currentTime());
    }
    // bleach
    double totalBleachTime = 0.1;
    int numBleachSteps = 5;
    double bleachCenterX = origin.getX() + 0.5 * extent.getX();
    double bleachCenterY = origin.getY() + 0.5 * extent.getY();
    double bleachPsfVariance = bleachRadius;
    double bleachFactor_K = 10;
    solver.bleachGuassian(diffusionRate, totalBleachTime, numBleachSteps, bleachCenterX, bleachCenterY, bleachPsfVariance, bleachFactor_K);
    // wait
    double postbleachDelay = 0.1;
    solver.step(diffusionRate, postbleachDelay);
    while (solver.currentTime() < 5) {
        double samplePsfVariance = psfVar;
        images.add(solver.sampleImage(numX, numY, origin, extent, diffusionRate, totalSampleTime, numSampleSteps, psfVar, detectorGainAndQuantumYeild, bConvolve, bNoise));
        times.add(solver.currentTime());
    // solver.step(diffusionRate, 1-totalSampleTime);
    }
    double[] timeArray = new double[times.size()];
    for (int i = 0; i < timeArray.length; i++) {
        timeArray[i] = times.get(i);
    }
    UShortImage[] imageArray = images.toArray(new UShortImage[images.size()]);
    return new ImageTimeSeries<UShortImage>(UShortImage.class, imageArray, timeArray, 1);
}
Also used : ArrayList(java.util.ArrayList) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) BrownianDynamics2DSolver(org.vcell.vmicro.op.BrownianDynamics2DSolver) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Aggregations

ImageTimeSeries (org.vcell.vmicro.workflow.data.ImageTimeSeries)18 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)12 Image (cbit.vcell.VirtualMicroscopy.Image)5 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)5 Extent (org.vcell.util.Extent)5 ISize (org.vcell.util.ISize)5 FloatImage (cbit.vcell.VirtualMicroscopy.FloatImage)4 ROI (cbit.vcell.VirtualMicroscopy.ROI)4 RowColumnResultSet (cbit.vcell.math.RowColumnResultSet)4 File (java.io.File)4 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)3 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)3 ArrayList (java.util.ArrayList)3 ClientTaskStatusSupport (org.vcell.util.ClientTaskStatusSupport)3 Origin (org.vcell.util.Origin)3 KeyValue (org.vcell.util.document.KeyValue)3 User (org.vcell.util.document.User)3 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)3 DataInput (org.vcell.workflow.DataInput)3 WorkflowDataSource (org.vcell.workflow.WorkflowDataSource)3