Search in sources :

Example 6 with ImageDataset

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

the class DefineROI_SummaryPanel method setLoadInfo.

public void setLoadInfo(final FRAPStudy frapStudy) {
    if (frapStudy != null && frapStudy.getFrapData() != null) {
        // enable components to change values
        BeanUtils.enableComponents(getInfoPanel(), true);
        BeanUtils.enableComponents(getIndexPanel(), true);
        // set info panel
        ImageDataset imgDataset = frapStudy.getFrapData().getImageDataset();
        imgXTextField.setText(NumberUtils.formatNumber(imgDataset.getExtent().getX(), 15));
        imgYTextField.setText(NumberUtils.formatNumber(imgDataset.getExtent().getY(), 15));
        FRAPData fData = frapStudy.getFrapData();
        ROI cellROI = fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name());
        ROI bleachedROI = fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name());
        ROI backgroundROI = fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BACKGROUND.name());
        if (cellROI.getNonzeroPixelsCount() < 1) {
            cellROIUndefined.setSelected(true);
            cellROIDefined.setSelected(false);
        } else {
            cellROIUndefined.setSelected(false);
            cellROIDefined.setSelected(true);
        }
        if (bleachedROI.getNonzeroPixelsCount() < 1) {
            bleachROIUndefined.setSelected(true);
            bleachROIDefined.setSelected(false);
        } else {
            bleachROIUndefined.setSelected(false);
            bleachROIDefined.setSelected(true);
        }
        if (backgroundROI.getNonzeroPixelsCount() < 1) {
            bgROIUndefined.setSelected(true);
            bgROIDefined.setSelected(false);
        } else {
            bgROIUndefined.setSelected(false);
            bgROIDefined.setSelected(true);
        }
        // they are not editable
        imgXTextField.setEditable(false);
        imgYTextField.setEditable(false);
        cellROIDefined.setEnabled(false);
        cellROIUndefined.setEnabled(false);
        bleachROIDefined.setEnabled(false);
        bleachROIUndefined.setEnabled(false);
        bgROIDefined.setEnabled(false);
        bgROIUndefined.setEnabled(false);
        // set index panel
        startIndexCombo.removeAllItems();
        double[] timeSteps = frapStudy.getFrapData().getImageDataset().getImageTimeStamps();
        for (int i = 0; i < timeSteps.length; i++) {
            startIndexCombo.addItem(timeSteps[i] + "");
        }
        if (bleachROIDefined.isSelected()) {
            int index = (frapStudy.getStartingIndexForRecovery() == null ? FRAPDataAnalysis.calculateRecoveryIndex(frapStudy.getFrapData()) : frapStudy.getStartingIndexForRecovery());
            startIndexCombo.setSelectedIndex(index);
            startIndexAvaliableLabel.setText(START_IDX_AVAILABLE_STR);
        } else {
            startIndexCombo.setSelectedIndex(0);
            startIndexAvaliableLabel.setText(START_IDX_UNAVAILABLE_STR);
        }
    } else {
        imgXTextField.setText("");
        imgYTextField.setText("");
        cellROIDefined.setSelected(false);
        cellROIUndefined.setSelected(false);
        bleachROIDefined.setSelected(false);
        bleachROIUndefined.setSelected(false);
        bgROIDefined.setSelected(false);
        bgROIUndefined.setSelected(false);
        startIndexCombo.removeAllItems();
        startIndexCombo.addItem("     N/A     ");
        BeanUtils.enableComponents(getInfoPanel(), false);
        BeanUtils.enableComponents(getIndexPanel(), false);
    }
}
Also used : ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset) FRAPData(cbit.vcell.microscopy.FRAPData) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 7 with ImageDataset

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

the class LoadFRAPData_SummaryPanel method setLoadInfo.

public void setLoadInfo(final FRAPStudy frapStudy) {
    if (frapStudy != null && frapStudy.getFrapData() != null) {
        BeanUtils.enableComponents(getTimePanel(), true);
        BeanUtils.enableComponents(getTimePanel(), true);
        // title
        loadInfo.setText(loadSuccessInfo);
        // time
        sTimeCombo.removeAllItems();
        eTimeCombo.removeAllItems();
        double[] timeSteps = frapStudy.getFrapData().getImageDataset().getImageTimeStamps();
        for (int i = 0; i < timeSteps.length; i++) {
            sTimeCombo.addItem(timeSteps[i] + "");
            eTimeCombo.addItem(timeSteps[i] + "");
        }
        sTimeCombo.setSelectedIndex(0);
        eTimeCombo.setSelectedIndex(timeSteps.length - 1);
        totTimeLabel.setText((timeSteps[timeSteps.length - 1] - timeSteps[0]) + "");
        ImageDataset imgDataset = frapStudy.getFrapData().getImageDataset();
        int numXPixels = imgDataset.getAllImages()[0].getNumX();
        int numYPixels = imgDataset.getAllImages()[0].getNumY();
        numXPixelsValLabel.setText(numXPixels + "");
        numYPixelsValLabel.setText(numYPixels + "");
        double pixelSizeX = imgDataset.getExtent().getX() / numXPixels;
        double pixelSizeY = imgDataset.getExtent().getY() / numYPixels;
        imgPixelSizeX.setText(NumberUtils.formatNumber(pixelSizeX, 10));
        imgPixelSizeY.setText(NumberUtils.formatNumber(pixelSizeY, 10));
    } else {
        // title
        loadInfo.setText(loadFailedInfo);
        // time
        sTimeCombo.removeAllItems();
        sTimeCombo.addItem("     N/A     ");
        eTimeCombo.removeAllItems();
        eTimeCombo.addItem("     N/A     ");
        totTimeLabel.setText("");
        numXPixelsValLabel.setText("");
        numYPixelsValLabel.setText("");
        imgPixelSizeX.setText("");
        imgPixelSizeY.setText("");
        BeanUtils.enableComponents(getSizePanel(), false);
        BeanUtils.enableComponents(getTimePanel(), false);
    }
}
Also used : ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset)

Example 8 with ImageDataset

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

the class ROIMultiPaintManager method initImageDataSet.

private void initImageDataSet(short[][] dataToSegmentChannels, ISize uncroppedISize) throws Exception {
    initImageDataSetChannels = new ImageDataset[(dataToSegmentChannels != null ? dataToSegmentChannels.length : 1)];
    for (int c = 0; c < initImageDataSetChannels.length; c++) {
        UShortImage[] zImageSet = new UShortImage[uncroppedISize.getZ()];
        for (int i = 0; i < zImageSet.length; i++) {
            short[] shortData = new short[uncroppedISize.getX() * uncroppedISize.getY()];
            if (dataToSegmentChannels != null) {
                System.arraycopy(dataToSegmentChannels[c], shortData.length * i, shortData, 0, shortData.length);
            }
            zImageSet[i] = new UShortImage(shortData, DEFAULT_ORIGIN, DEFAULT_EXTENT, uncroppedISize.getX(), uncroppedISize.getY(), 1);
        }
        initImageDataSetChannels[c] = new ImageDataset(zImageSet, new double[] { 0.0 }, uncroppedISize.getZ());
    }
}
Also used : ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) Point(java.awt.Point)

Example 9 with ImageDataset

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

the class ExportRawTimeSeriesToVFrapOp method exportToVFRAP.

public void exportToVFRAP(File vfrapFile, ImageTimeSeries<UShortImage> imageTimeSeries, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
    Xmlproducer vcellXMLProducer = new Xmlproducer(false);
    boolean bSaveCompressed = true;
    ImageDataset imageData = new ImageDataset(imageTimeSeries.getAllImages(), imageTimeSeries.getImageTimeStamps(), imageTimeSeries.getSizeZ());
    Element root = new Element(MicroscopyXMLTags.FRAPStudyTag);
    Element next = new Element(MicroscopyXMLTags.FRAPDataTag);
    root.addContent(next);
    Element imageDataXML = MicroscopyXmlproducer.getXML(imageData, vcellXMLProducer, clientTaskStatusSupport, bSaveCompressed);
    next.addContent(imageDataXML);
    java.io.FileOutputStream fileOutStream = new java.io.FileOutputStream(vfrapFile);
    BufferedOutputStream bufferedStream = new BufferedOutputStream(fileOutStream);
    // XmlUtil.writeXmlToStream(root, false, bufferedStream);
    XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat());
    xmlOut.getFormat().setTextMode(Format.TextMode.PRESERVE);
    xmlOut.output(root, bufferedStream);
    bufferedStream.flush();
    fileOutStream.flush();
    fileOutStream.close();
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) Xmlproducer(cbit.vcell.xml.Xmlproducer) MicroscopyXmlproducer(cbit.vcell.microscopy.MicroscopyXmlproducer) ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset) Element(org.jdom.Element) BufferedOutputStream(java.io.BufferedOutputStream)

Example 10 with ImageDataset

use of cbit.vcell.VirtualMicroscopy.ImageDataset 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;
}
Also used : ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset) ClientTaskStatusSupport(org.vcell.util.ClientTaskStatusSupport) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Aggregations

ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)42 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)20 ROI (cbit.vcell.VirtualMicroscopy.ROI)9 Extent (org.vcell.util.Extent)9 File (java.io.File)8 Element (org.jdom.Element)8 ISize (org.vcell.util.ISize)8 Origin (org.vcell.util.Origin)7 CartesianMesh (cbit.vcell.solvers.CartesianMesh)6 UserCancelException (org.vcell.util.UserCancelException)6 ImageException (cbit.image.ImageException)5 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)5 FieldDataFileOperationSpec (cbit.vcell.field.io.FieldDataFileOperationSpec)5 Hashtable (java.util.Hashtable)5 Component (java.awt.Component)4 ArrayList (java.util.ArrayList)4 ImageTimeSeries (org.vcell.vmicro.workflow.data.ImageTimeSeries)4 VCImageUncompressed (cbit.image.VCImageUncompressed)3 AnnotatedImageDataset (cbit.vcell.VirtualMicroscopy.importer.AnnotatedImageDataset)3 MicroscopyXmlReader (cbit.vcell.VirtualMicroscopy.importer.MicroscopyXmlReader)3