Search in sources :

Example 1 with ImageTimeSeries

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

the class ExportRawTimeSeriesToVFrap method compute0.

@Override
protected void compute0(TaskContext context, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get inputs
    File outputFile = context.getData(vfrapFile);
    ImageTimeSeries imageTimeSeries = context.getData(rawTimeSeriesImages);
    // validate that imageTimeSeries is of type ImageTimeSeries<UShortImage>
    Image[] images = imageTimeSeries.getAllImages();
    UShortImage[] usImages = new UShortImage[images.length];
    for (int i = 0; i < usImages.length; i++) {
        if (!(images[i] instanceof UShortImage)) {
            throw new Exception("type mismatch, expecting only UShortImages in time series");
        }
        usImages[i] = (UShortImage) images[i];
    }
    ImageTimeSeries<UShortImage> ushortImageTimeSeries = new ImageTimeSeries<UShortImage>(UShortImage.class, usImages, imageTimeSeries.getImageTimeStamps(), imageTimeSeries.getSizeZ());
    ExportRawTimeSeriesToVFrapOp op = new ExportRawTimeSeriesToVFrapOp();
    op.exportToVFRAP(outputFile, ushortImageTimeSeries, clientTaskStatusSupport);
    // write output (just boolean "done" flag)
    context.setData(written, true);
}
Also used : UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) Image(cbit.vcell.VirtualMicroscopy.Image) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ExportRawTimeSeriesToVFrapOp(org.vcell.vmicro.op.ExportRawTimeSeriesToVFrapOp) File(java.io.File) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 2 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 3 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 4 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 5 with ImageTimeSeries

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

the class RunRefSimulationOp method runRefSimulation.

private static ImageTimeSeries<FloatImage> runRefSimulation(LocalWorkspace localWorkspace, ROI cellROI, double timeStepVal, TimeBounds timeBounds, FloatImage initRefConc, double baseDiffusionRate, ClientTaskStatusSupport progressListener) throws Exception {
    String INITCONC_EXTDATA_NAME = "initConc";
    String INITCONC_EXTDATA_VARNAME = "conc";
    String VAR_NAME = "species";
    User owner = LocalWorkspace.getDefaultOwner();
    KeyValue simKey = LocalWorkspace.createNewKeyValue();
    ExternalDataInfo initialConcentrationExtData = createNewExternalDataInfo(localWorkspace, INITCONC_EXTDATA_NAME);
    Extent extent = initRefConc.getExtent();
    Origin origin = initRefConc.getOrigin();
    ISize isize = new ISize(initRefConc.getNumX(), initRefConc.getNumY(), initRefConc.getNumZ());
    saveExternalData(initRefConc, INITCONC_EXTDATA_VARNAME, initialConcentrationExtData.getExternalDataIdentifier(), localWorkspace);
    FieldFunctionArguments initConditionFFA = new FieldFunctionArguments(INITCONC_EXTDATA_NAME, INITCONC_EXTDATA_VARNAME, new Expression(0.0), VariableType.VOLUME);
    BioModel bioModel = createRefSimBioModel(simKey, owner, origin, extent, cellROI, timeStepVal, timeBounds, VAR_NAME, new Expression(initConditionFFA.infix()), baseDiffusionRate);
    if (progressListener != null) {
        progressListener.setMessage("Running Reference Simulation...");
    }
    // run simulation
    runFVSolverStandalone(new File(localWorkspace.getDefaultSimDataDirectory()), bioModel.getSimulation(0), initialConcentrationExtData.getExternalDataIdentifier(), progressListener, true);
    VCDataIdentifier vcDataIdentifier = new VCSimulationDataIdentifier(new VCSimulationIdentifier(simKey, owner), 0);
    double[] dataTimes = localWorkspace.getDataSetControllerImpl().getDataSetTimes(vcDataIdentifier);
    FloatImage[] solutionImages = new FloatImage[dataTimes.length];
    for (int i = 0; i < dataTimes.length; i++) {
        SimDataBlock simDataBlock = localWorkspace.getDataSetControllerImpl().getSimDataBlock(null, vcDataIdentifier, VAR_NAME, dataTimes[i]);
        double[] doubleData = simDataBlock.getData();
        float[] floatPixels = new float[doubleData.length];
        for (int j = 0; j < doubleData.length; j++) {
            floatPixels[j] = (float) doubleData[j];
        }
        solutionImages[i] = new FloatImage(floatPixels, origin, extent, isize.getX(), isize.getY(), isize.getZ());
    }
    ImageTimeSeries<FloatImage> solution = new ImageTimeSeries<FloatImage>(FloatImage.class, solutionImages, dataTimes, 1);
    return solution;
}
Also used : Origin(org.vcell.util.Origin) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) User(org.vcell.util.document.User) KeyValue(org.vcell.util.document.KeyValue) FloatImage(cbit.vcell.VirtualMicroscopy.FloatImage) ExternalDataInfo(org.vcell.vmicro.workflow.data.ExternalDataInfo) Extent(org.vcell.util.Extent) FieldFunctionArguments(cbit.vcell.field.FieldFunctionArguments) ISize(org.vcell.util.ISize) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) SimDataBlock(cbit.vcell.simdata.SimDataBlock) Expression(cbit.vcell.parser.Expression) BioModel(cbit.vcell.biomodel.BioModel) File(java.io.File) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) 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