Search in sources :

Example 16 with FRAPData

use of cbit.vcell.microscopy.FRAPData in project vcell by virtualcell.

the class RoiForErrorPanel method refreshROIImage.

public void refreshROIImage() {
    FRAPData frapData = batchRunWorkspace.getWorkingFrapStudy().getFrapData();
    ROI[] allROIs = getAllROIs();
    Color[] allColors = getAllROIColors();
    ArrayList<ROI> plottedROIs = new ArrayList<ROI>();
    ArrayList<Color> plottedColors = new ArrayList<Color>();
    ArrayList<String> tempSelectedROIs = new ArrayList<String>();
    if (roi_bleachedCheckBox.isEnabled() && roi_bleachedCheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name());
    }
    if (roi_bleached_ring1CheckBox.isEnabled() && roi_bleached_ring1CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING1]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING1]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING1.name());
    }
    if (roi_bleached_ring2CheckBox.isEnabled() && roi_bleached_ring2CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING2]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING2]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING2.name());
    }
    if (roi_bleached_ring3CheckBox.isEnabled() && roi_bleached_ring3CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING3]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING3]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING3.name());
    }
    if (roi_bleached_ring4CheckBox.isEnabled() && roi_bleached_ring4CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING4]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING4]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING4.name());
    }
    if (roi_bleached_ring5CheckBox.isEnabled() && roi_bleached_ring5CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING5]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING5]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING5.name());
    }
    if (roi_bleached_ring6CheckBox.isEnabled() && roi_bleached_ring6CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING6]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING6]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING6.name());
    }
    if (roi_bleached_ring7CheckBox.isEnabled() && roi_bleached_ring7CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING7]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING7]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING7.name());
    }
    if (roi_bleached_ring8CheckBox.isEnabled() && roi_bleached_ring8CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING8]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING8]);
        tempSelectedROIs.add(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING8.name());
    }
    // save selected ROI names
    refreshSelectedROIs(tempSelectedROIs);
    // show ROI image
    ROI[] plottedROIArray = new ROI[plottedROIs.size()];
    plottedROIArray = plottedROIs.toArray(plottedROIArray);
    Color[] plottedColorArray = new Color[plottedColors.size()];
    plottedColorArray = plottedColors.toArray(plottedColorArray);
    roiImagePanel.refreshROIImage(plottedROIArray, plottedColorArray, frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()), Color.white);
}
Also used : FRAPData(cbit.vcell.microscopy.FRAPData) Color(java.awt.Color) ArrayList(java.util.ArrayList) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 17 with FRAPData

use of cbit.vcell.microscopy.FRAPData in project vcell by virtualcell.

the class RoiForErrorPanel method getAllROIs.

public ROI[] getAllROIs() {
    allROIs = new ROI[NUM_SELECTED_ROIS];
    // always use the first frap study'ROIs for display
    FRAPData frapData = batchRunWorkspace.getWorkingFrapStudy().getFrapData();
    allROIs[IDX_ROI_BLEACHED] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name());
    allROIs[IDX_ROI_BLEACHED_RING1] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING1.name());
    allROIs[IDX_ROI_BLEACHED_RING2] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING2.name());
    allROIs[IDX_ROI_BLEACHED_RING3] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING3.name());
    allROIs[IDX_ROI_BLEACHED_RING4] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING4.name());
    allROIs[IDX_ROI_BLEACHED_RING5] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING5.name());
    allROIs[IDX_ROI_BLEACHED_RING6] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING6.name());
    allROIs[IDX_ROI_BLEACHED_RING7] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING7.name());
    allROIs[IDX_ROI_BLEACHED_RING8] = frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING8.name());
    return allROIs;
}
Also used : FRAPData(cbit.vcell.microscopy.FRAPData)

Example 18 with FRAPData

use of cbit.vcell.microscopy.FRAPData in project vcell by virtualcell.

the class DefineROI_RoiForErrorPanel method refreshCheckboxes.

public void refreshCheckboxes() {
    FRAPData frapData = frapWorkspace.getWorkingFrapStudy().getFrapData();
    ROI[] rois = frapData.getRois();
    // disable all the checkboxes first
    setAllCheckboxesEnabled(false);
    setAllCheckboxesSelected(false);
    // disable ROIs with 0 pixel in it
    // or disselect checkboxes according to stored selected ROIS
    boolean[] storedSelectedROIs = frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation();
    for (int i = 0; i < rois.length; i++) {
        if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name()).getNonzeroPixelsCount() > 0) {
            roi_bleachedCheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleachedCheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING1.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING1.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring1CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring1CheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING2.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING2.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring2CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring2CheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING3.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING3.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring3CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring3CheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING4.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING4.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring4CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring4CheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING5.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING5.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring5CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring5CheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING6.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING6.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring6CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring6CheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING7.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING7.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring7CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring7CheckBox.setSelected(true);
            }
        } else if (rois[i].getROIName().equals(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING8.name()) && frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED_RING8.name()).getNonzeroPixelsCount() > 0) {
            roi_bleached_ring8CheckBox.setEnabled(true);
            if (storedSelectedROIs == null || storedSelectedROIs.length < 1 || storedSelectedROIs[i]) {
                roi_bleached_ring8CheckBox.setSelected(true);
            }
        }
    }
}
Also used : FRAPData(cbit.vcell.microscopy.FRAPData) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 19 with FRAPData

use of cbit.vcell.microscopy.FRAPData in project vcell by virtualcell.

the class DefineROI_RoiForErrorPanel method refreshROIImageForDisplay.

public void refreshROIImageForDisplay() {
    FRAPData frapData = frapWorkspace.getWorkingFrapStudy().getFrapData();
    ROI[] allROIs = getAllROIs();
    Color[] allColors = getAllROIColors();
    ArrayList<ROI> plottedROIs = new ArrayList<ROI>();
    ArrayList<Color> plottedColors = new ArrayList<Color>();
    if (roi_bleachedCheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED]);
    }
    if (roi_bleached_ring1CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING1]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING1]);
    }
    if (roi_bleached_ring2CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING2]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING2]);
    }
    if (roi_bleached_ring3CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING3]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING3]);
    }
    if (roi_bleached_ring4CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING4]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING4]);
    }
    if (roi_bleached_ring5CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING5]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING5]);
    }
    if (roi_bleached_ring6CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING6]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING6]);
    }
    if (roi_bleached_ring7CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING7]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING7]);
    }
    if (roi_bleached_ring8CheckBox.isSelected()) {
        plottedROIs.add(allROIs[IDX_ROI_BLEACHED_RING8]);
        plottedColors.add(allColors[IDX_ROI_BLEACHED_RING8]);
    }
    // show ROI image
    ROI[] plottedROIArray = new ROI[plottedROIs.size()];
    plottedROIArray = plottedROIs.toArray(plottedROIArray);
    Color[] plottedColorArray = new Color[plottedColors.size()];
    plottedColorArray = plottedColors.toArray(plottedColorArray);
    roiImagePanel.refreshROIImage(plottedROIArray, plottedColorArray, frapData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()), Color.white);
}
Also used : FRAPData(cbit.vcell.microscopy.FRAPData) Color(java.awt.Color) ArrayList(java.util.ArrayList) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 20 with FRAPData

use of cbit.vcell.microscopy.FRAPData in project vcell by virtualcell.

the class FrapDataUtils method createFrapData.

public static FRAPData createFrapData(ArrayList<SourceDataInfo> sourceDataInfoArr, double[] times, int slice, Double maxIntensity, ClientTaskStatusSupport progressListener) throws ImageException {
    if (sourceDataInfoArr.size() != times.length) {
        throw new ImageException("Error FRAPData.createFrapData: times array length must equal SourceDataInfo vector size");
    }
    // construct
    int XY_SIZE = sourceDataInfoArr.get(0).getXSize() * sourceDataInfoArr.get(0).getYSize();
    int SLICE_OFFSET = slice * XY_SIZE;
    // slice always 2D data
    int Z_SIZE = 1;
    // find scale factor to scale up the data to avoid losing precision when casting double to short
    double linearScaleFactor = 1;
    if (maxIntensity != null) {
        double maxDataValue = 0;
        for (int i = 0; i < times.length; i++) {
            if (sourceDataInfoArr.get(i).getMinMax() != null) {
                maxDataValue = Math.max(maxDataValue, sourceDataInfoArr.get(i).getMinMax().getMax());
            } else {
                double[] doubleData = (double[]) sourceDataInfoArr.get(i).getData();
                for (int j = 0; j < doubleData.length; j++) {
                    maxDataValue = Math.max(maxDataValue, doubleData[j]);
                }
            }
        }
        linearScaleFactor = maxIntensity.doubleValue() / maxDataValue;
    }
    // saving each time step 2D double array to a UShortImage
    UShortImage[] dataImages = new UShortImage[times.length];
    for (int i = 0; i < times.length; i++) {
        double[] doubleData = (double[]) sourceDataInfoArr.get(i).getData();
        short[] shortData = new short[XY_SIZE];
        for (int j = 0; j < shortData.length; j++) {
            shortData[j] = (short) (doubleData[j + (SLICE_OFFSET)] * linearScaleFactor);
        }
        dataImages[i] = new UShortImage(shortData, sourceDataInfoArr.get(i).getOrigin(), sourceDataInfoArr.get(i).getExtent(), sourceDataInfoArr.get(i).getXSize(), sourceDataInfoArr.get(i).getYSize(), Z_SIZE);
        if (progressListener != null) {
            int progress = (int) (((i + 1) * 1.0 / times.length) * 100);
            progressListener.setProgress(progress);
        }
    }
    ImageDataset imageDataSet = new ImageDataset(dataImages, times, Z_SIZE);
    FRAPData frapData = new FRAPData(imageDataSet, new String[] { FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name(), FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name(), FRAPData.VFRAP_ROI_ENUM.ROI_BACKGROUND.name() });
    return frapData;
}
Also used : ImageException(cbit.image.ImageException) ImageDataset(cbit.vcell.VirtualMicroscopy.ImageDataset) FRAPData(cbit.vcell.microscopy.FRAPData) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage)

Aggregations

FRAPData (cbit.vcell.microscopy.FRAPData)20 ROI (cbit.vcell.VirtualMicroscopy.ROI)7 ArrayList (java.util.ArrayList)6 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)4 Color (java.awt.Color)4 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)3 ImageException (cbit.image.ImageException)2 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)2 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 Hashtable (java.util.Hashtable)2 DataJobEvent (cbit.rmi.event.DataJobEvent)1 DataJobListener (cbit.rmi.event.DataJobListener)1 ImageLoadingProgress (cbit.vcell.VirtualMicroscopy.ImageLoadingProgress)1 DataIdentifier (cbit.vcell.simdata.DataIdentifier)1 DataSetControllerImpl (cbit.vcell.simdata.DataSetControllerImpl)1 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)1 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)1 CartesianMesh (cbit.vcell.solvers.CartesianMesh)1 Rectangle (java.awt.Rectangle)1 BitSet (java.util.BitSet)1