Search in sources :

Example 66 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI in project vcell by virtualcell.

the class WorkflowObjectsTableModel method getValue.

private String getValue(WorkflowObject workflowObject) {
    if (workflowObject instanceof Task) {
        return "";
    } else {
        Object data = null;
        Class dataType = null;
        if (workflowObject instanceof WorkflowDataSource) {
            WorkflowDataSource dataHolder = (WorkflowDataSource) workflowObject;
            WorkflowDataSource dataSource = taskContext.getWorkflow().getDataSource((DataObject) dataHolder);
            data = taskContext.getRepository().getData(dataSource);
            dataType = dataHolder.getType();
        } else if (workflowObject instanceof DataInput) {
            DataInput dataInput = (DataInput) workflowObject;
            data = taskContext.getData(dataInput);
            dataType = dataInput.getType();
        }
        if (data instanceof RowColumnResultSet) {
            RowColumnResultSet rc = (RowColumnResultSet) data;
            int N = rc.getColumnDescriptionsCount();
            StringBuffer buffer = new StringBuffer(rc.getRowCount() + " rows of " + N + " {");
            int MAX = 3;
            for (int i = 0; i < N; i++) {
                buffer.append("\"" + rc.getColumnDescriptions(i).getDisplayName() + "\"");
                if (i >= MAX - 1) {
                    buffer.append(", ...");
                    break;
                }
                if (i < N - 1) {
                    buffer.append(", ");
                }
            }
            buffer.append("}");
            return buffer.toString();
        } else if (data instanceof String) {
            return "\"" + (String) data + "\"";
        } else if (data instanceof ROI) {
            return "ROI \"" + ((ROI) data).getROIName() + "\"";
        } else if (data instanceof ROI[]) {
            ROI[] rois = (ROI[]) data;
            int N = rois.length;
            int MAX = 3;
            StringBuffer buffer = new StringBuffer("ROI[" + N + "] { ");
            for (int i = 0; i < N; i++) {
                buffer.append("\"" + rois[i].getROIName() + "\"");
                if (i >= MAX - 1) {
                    buffer.append(", ...");
                    break;
                }
                if (i < N - 1) {
                    buffer.append(", ");
                }
            }
            buffer.append("}");
            return buffer.toString();
        } else if (data instanceof Image) {
            Image image = (Image) data;
            return image.getClass().getSimpleName() + " " + image.getISize().toString();
        } else if (data instanceof ImageTimeSeries) {
            ImageTimeSeries ts = (ImageTimeSeries) data;
            int N = ts.getSizeT();
            double[] times = ts.getImageTimeStamps();
            return ts.getType().getSimpleName() + "[" + N + "] " + ts.getISize() + " times=[" + times[0] + "," + times[N - 1] + "]";
        } else if (data != null) {
            return data.toString();
        } else {
            return "null " + dataType.getSimpleName();
        }
    }
}
Also used : Task(org.vcell.workflow.Task) Image(cbit.vcell.VirtualMicroscopy.Image) ROI(cbit.vcell.VirtualMicroscopy.ROI) WorkflowDataSource(org.vcell.workflow.WorkflowDataSource) DataInput(org.vcell.workflow.DataInput) DataObject(org.vcell.workflow.DataObject) WorkflowObject(org.vcell.workflow.WorkflowObject) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 67 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI in project vcell by virtualcell.

the class ComputeMeasurementError method compute0.

@Override
protected void compute0(TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    ROI[] rois = context.getData(imageDataROIs);
    int indexPostbleach = context.getData(indexFirstPostbleach);
    ImageTimeSeries<UShortImage> rawImageDataset = context.getData(rawImageTimeSeries);
    FloatImage prebleachAvgImage = context.getData(prebleachAverage);
    ArrayList<NormalizedSampleFunction> roiSampleFunctions = new ArrayList<NormalizedSampleFunction>();
    for (int i = 0; i < rois.length; i++) {
        roiSampleFunctions.add(NormalizedSampleFunction.fromROI(rois[i]));
    }
    // do op
    ComputeMeasurementErrorOp op = new ComputeMeasurementErrorOp();
    NormalizedSampleFunction[] roiSampleFunctionArray = roiSampleFunctions.toArray(new NormalizedSampleFunction[0]);
    RowColumnResultSet rowColumnResultSet = op.computeNormalizedMeasurementError(roiSampleFunctionArray, indexPostbleach, rawImageDataset, prebleachAvgImage, clientTaskStatusSupport);
    // set output
    context.setData(normalizedMeasurementError, rowColumnResultSet);
}
Also used : FloatImage(cbit.vcell.VirtualMicroscopy.FloatImage) NormalizedSampleFunction(org.vcell.vmicro.workflow.data.NormalizedSampleFunction) ArrayList(java.util.ArrayList) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ROI(cbit.vcell.VirtualMicroscopy.ROI) ComputeMeasurementErrorOp(org.vcell.vmicro.op.ComputeMeasurementErrorOp) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet)

Example 68 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI in project vcell by virtualcell.

the class GenerateBleachROI method compute0.

@Override
protected void compute0(TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get input
    Image firstPostbleachImage = context.getData(normalizedTimeSeries).getAllImages()[0];
    ROI cellROI = context.getData(cellROI_2D);
    double bleachThresholdValue = context.getData(bleachThreshold);
    // do op
    GenerateBleachRoiOp op = new GenerateBleachRoiOp();
    ROI bleachedROI = op.generateBleachRoi(firstPostbleachImage, cellROI, bleachThresholdValue);
    // set output
    context.setData(bleachedROI_2D, bleachedROI);
    context.setData(bleachedROI_2D_array, new ROI[] { bleachedROI });
}
Also used : GenerateBleachRoiOp(org.vcell.vmicro.op.GenerateBleachRoiOp) Image(cbit.vcell.VirtualMicroscopy.Image) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 69 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI in project vcell by virtualcell.

the class GenerateDependentImageROIs method compute0.

@Override
protected void compute0(TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get input
    ROI cellROI_2D = context.getData(this.cellROI_2D);
    ROI bleachedROI_2D = context.getData(this.bleachedROI_2D);
    // do op
    GenerateDependentImageROIsOp op = new GenerateDependentImageROIsOp();
    ROI[] rois = op.generate(cellROI_2D, bleachedROI_2D);
    // set output
    context.setData(imageDataROIs, rois);
}
Also used : GenerateDependentImageROIsOp(org.vcell.vmicro.op.GenerateDependentImageROIsOp) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 70 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI in project vcell by virtualcell.

the class RunRefSimulationFast method compute0.

@Override
protected void compute0(TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    ImageTimeSeries<FloatImage> normTimeSeries = context.getData(normalizedTimeSeries);
    ROI cellROI = context.getData(cellROI_2D);
    ROI[] imageDataRois = context.getData(imageDataROIs);
    UShortImage psf = context.getData(this.psf);
    // do op
    RunRefSimulationFastOp op = new RunRefSimulationFastOp();
    RowColumnResultSet reducedData = op.runRefSimFast(cellROI, normTimeSeries, imageDataRois, psf, context.getLocalWorkspace(), clientTaskStatusSupport);
    // set output
    context.setData(reducedROIData, reducedData);
    // always D = 1,
    context.setData(refSimDiffusionRate, op.getReferenceDiffusionCoef());
}
Also used : FloatImage(cbit.vcell.VirtualMicroscopy.FloatImage) RunRefSimulationFastOp(org.vcell.vmicro.op.RunRefSimulationFastOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ROI(cbit.vcell.VirtualMicroscopy.ROI) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet)

Aggregations

ROI (cbit.vcell.VirtualMicroscopy.ROI)72 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)26 RowColumnResultSet (cbit.vcell.math.RowColumnResultSet)10 ArrayList (java.util.ArrayList)10 UserCancelException (org.vcell.util.UserCancelException)10 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)9 ImageException (cbit.image.ImageException)8 Image (cbit.vcell.VirtualMicroscopy.Image)7 FRAPData (cbit.vcell.microscopy.FRAPData)7 BioModel (cbit.vcell.biomodel.BioModel)6 FloatImage (cbit.vcell.VirtualMicroscopy.FloatImage)5 FieldFunctionArguments (cbit.vcell.field.FieldFunctionArguments)5 RegionInfo (cbit.vcell.geometry.RegionImage.RegionInfo)5 File (java.io.File)5 Hashtable (java.util.Hashtable)5 Element (org.jdom.Element)5 Extent (org.vcell.util.Extent)5 VCImage (cbit.image.VCImage)4 VCImageUncompressed (cbit.image.VCImageUncompressed)4 Expression (cbit.vcell.parser.Expression)4