Search in sources :

Example 11 with FRAPData

use of cbit.vcell.microscopy.FRAPData 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 12 with FRAPData

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

the class DefineROI_BackgroundROIDescriptor method preNextProcess.

public ArrayList<AsynchClientTask> preNextProcess() {
    // create AsynchClientTask arraylist
    ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
    final String nextROIStr = null;
    AsynchClientTask setCurrentROITask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // save current ROI and load ROI in the panel it goes next to
            ((DefineROI_Panel) imgPanel).setCurrentROI(nextROIStr, true);
            FRAPData fData = ((DefineROI_Panel) imgPanel).getFrapWorkspace().getWorkingFrapStudy().getFrapData();
            fData.setCurrentlyDisplayedROI(fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()), true);
        }
    };
    taskArrayList.add(setCurrentROITask);
    return taskArrayList;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) FRAPData(cbit.vcell.microscopy.FRAPData) ArrayList(java.util.ArrayList)

Example 13 with FRAPData

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

the class BatchRunROIImgPanel method setCurrentROI.

public void setCurrentROI(String roiName, boolean bSave) {
    if (getBatchRunWorkspace() != null && getBatchRunWorkspace().getWorkingFrapStudy() != null && getBatchRunWorkspace().getWorkingFrapStudy().getFrapData() != null) {
        FRAPData fData = getBatchRunWorkspace().getWorkingFrapStudy().getFrapData();
        fData.setCurrentlyDisplayedROI(fData.getRoi(roiName), bSave);
    }
}
Also used : FRAPData(cbit.vcell.microscopy.FRAPData)

Example 14 with FRAPData

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

the class RoiForErrorPanel method refreshCheckboxes.

public void refreshCheckboxes() {
    FRAPData frapData = batchRunWorkspace.getWorkingFrapStudy().getFrapData();
    ROI[] rois = frapData.getRois();
    // enable 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 = batchRunWorkspace.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 15 with FRAPData

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

the class RoiForErrorPanel method refreshROIImageForDisplay.

public void refreshROIImageForDisplay() {
    FRAPData frapData = batchRunWorkspace.getFrapStudies().get(0).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)

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