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