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();
}
}
}
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);
}
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 });
}
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);
}
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());
}
Aggregations