Search in sources :

Example 26 with UShortImage

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

the class PhotoactivationExperimentTest method main.

public static void main(String[] args) {
    try {
        File baseDir = new File(".");
        // File baseDir = new File("/Users/schaff/Documents/workspace/VCell_5.4");
        // initialize computing environment
        // 
        File workingDirectory = new File(baseDir, "workingDir");
        LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
        // 
        // import raw image time series data from VFRAP file format (can have noise, background, etc ... can be actual microscopy data)
        // 
        ClientTaskStatusSupport progressListener = new ClientTaskStatusSupport() {

            String message = "";

            int progress = 0;

            @Override
            public void setProgress(int progress) {
                this.progress = progress;
            }

            @Override
            public void setMessage(String message) {
                this.message = message;
            }

            @Override
            public boolean isInterrupted() {
                return false;
            }

            @Override
            public int getProgress() {
                return progress;
            }

            @Override
            public void addProgressDialogListener(ProgressDialogListener progressDialogListener) {
            }
        };
        // 
        // generate fake data (and save?)
        // 
        // ImageTimeSeries<UShortImage> simulatedFluorescence = generateFakeData(localWorkspace, progressListener);
        // new ExportRawTimeSeriesToVFrapOp().exportToVFRAP(vfrapFile, simulatedFluorescence, null);
        // 
        // analyze raw data (from file?) using Keyworthy method.
        // 
        // File vfrapFile = new File(baseDir, "vfrapPaper/photoactivation/Actin.vfrap");
        File vfrapFile = new File(baseDir, "vfrapPaper/photoactivation/Actin_binding_protein.vfrap");
        ImageTimeSeries<UShortImage> fluorTimeSeriesImages = new ImportRawTimeSeriesFromVFrapOp().importRawTimeSeriesFromVFrap(vfrapFile);
        analyzePhotoactivation(fluorTimeSeriesImages, localWorkspace);
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : LocalWorkspace(org.vcell.vmicro.workflow.data.LocalWorkspace) ProgressDialogListener(org.vcell.util.ProgressDialogListener) ClientTaskStatusSupport(org.vcell.util.ClientTaskStatusSupport) ImportRawTimeSeriesFromVFrapOp(org.vcell.vmicro.op.ImportRawTimeSeriesFromVFrapOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) File(java.io.File) ImageException(cbit.image.ImageException)

Example 27 with UShortImage

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

the class PhotoactivationExperimentTest method blurTimeSeries.

private static ImageTimeSeries<UShortImage> blurTimeSeries(ImageTimeSeries<UShortImage> rawTimeSeriesImages) throws ImageException {
    UShortImage[] blurredImages = new UShortImage[rawTimeSeriesImages.getAllImages().length];
    for (int i = 0; i < blurredImages.length; i++) {
        blurredImages[i] = new UShortImage(rawTimeSeriesImages.getAllImages()[i]);
        blurredImages[i].blur();
        blurredImages[i].blur();
    }
    ImageTimeSeries<UShortImage> blurredRaw = new ImageTimeSeries<UShortImage>(UShortImage.class, blurredImages, rawTimeSeriesImages.getImageTimeStamps(), rawTimeSeriesImages.getSizeZ());
    return blurredRaw;
}
Also used : UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 28 with UShortImage

use of cbit.vcell.VirtualMicroscopy.UShortImage 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 29 with UShortImage

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

the class GenerateNormalizedFrapData method compute0.

@Override
protected void compute0(TaskContext context, final ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // get input
    ImageTimeSeries<UShortImage> rawTimeSeries = context.getData(rawImageTimeSeries);
    ROI backgroundROI = context.getData(backgroundROI_2D);
    Integer indexPostbleach = context.getData(indexOfFirstPostbleach);
    // do op
    GenerateNormalizedFrapDataOp op = new GenerateNormalizedFrapDataOp();
    NormalizedFrapDataResults results = op.generate(rawTimeSeries, backgroundROI, indexPostbleach);
    // set output
    context.setData(normalizedFrapData, results.normalizedFrapData);
    context.setData(this.prebleachAverage, results.prebleachAverage);
}
Also used : NormalizedFrapDataResults(org.vcell.vmicro.op.GenerateNormalizedFrapDataOp.NormalizedFrapDataResults) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) GenerateNormalizedFrapDataOp(org.vcell.vmicro.op.GenerateNormalizedFrapDataOp) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 30 with UShortImage

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

the class ImportRawTimeSeriesFrom2DVCellConcentrations method compute0.

@Override
protected void compute0(TaskContext context, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    // set inputs
    File vcellSimLog = context.getData(vcellSimLogFile);
    String fluorFuncName = context.getData(fluorFunctionName);
    Double maximumIntensity = context.getData(maxIntensity);
    Boolean enableNoise = context.getData(bNoise);
    // do op
    ImportRawTimeSeriesFrom2DVCellConcentrationsOp op = new ImportRawTimeSeriesFrom2DVCellConcentrationsOp();
    ImageTimeSeries<UShortImage> imageTimeSeries = op.importRawTimeSeries(vcellSimLog, fluorFuncName, maximumIntensity, enableNoise);
    // set output
    context.setData(rawTimeSeriesImages, imageTimeSeries);
}
Also used : ImportRawTimeSeriesFrom2DVCellConcentrationsOp(org.vcell.vmicro.op.ImportRawTimeSeriesFrom2DVCellConcentrationsOp) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) File(java.io.File)

Aggregations

UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)98 ROI (cbit.vcell.VirtualMicroscopy.ROI)26 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)20 Point (java.awt.Point)16 File (java.io.File)14 Extent (org.vcell.util.Extent)13 ImageTimeSeries (org.vcell.vmicro.workflow.data.ImageTimeSeries)12 Origin (org.vcell.util.Origin)10 ImageException (cbit.image.ImageException)9 Element (org.jdom.Element)9 DataBufferByte (java.awt.image.DataBufferByte)8 RowColumnResultSet (cbit.vcell.math.RowColumnResultSet)7 ArrayList (java.util.ArrayList)7 ISize (org.vcell.util.ISize)7 FloatImage (cbit.vcell.VirtualMicroscopy.FloatImage)6 ClientTaskStatusSupport (org.vcell.util.ClientTaskStatusSupport)6 UserCancelException (org.vcell.util.UserCancelException)6 ProfileDataElement (org.vcell.optimization.ProfileDataElement)5 ImportRawTimeSeriesFromVFrapOp (org.vcell.vmicro.op.ImportRawTimeSeriesFromVFrapOp)5 OptContext (org.vcell.vmicro.workflow.data.OptContext)5