Search in sources :

Example 1 with ImageLoadingProgress

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

the class FRAPDataPanel method propertyChange.

// implementation of propertychange as a propertyChangeListener
public void propertyChange(PropertyChangeEvent e) {
    if (e.getSource() instanceof ImageLoadingProgress && e.getPropertyName().equals("ImageLoadingProgress")) {
        int prog = ((Integer) e.getNewValue()).intValue();
        VirtualFrapMainFrame.updateProgress(prog);
    } else if (e.getPropertyName().equals(VFrap_OverlayEditorPanelJAI.FRAP_DATA_CROP_PROPERTY)) {
        try {
            crop((Rectangle) e.getNewValue());
        } catch (Exception ex) {
            PopupGenerator.showErrorDialog(this, "Error Cropping:\n" + ex.getMessage());
        }
    } else if (e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_CURRENTLY_DISPLAYED_ROI_WITH_SAVE)) {
        // To save only when the image is editable in this panel
        if (isEditable) {
            getOverlayEditorPanelJAI().saveUserChangesToROI();
        }
        // Set new ROI on viewer
        getOverlayEditorPanelJAI().setROI(getFrapWorkspace().getWorkingFrapStudy().getFrapData().getCurrentlyDisplayedROI());
    } else if (e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_CURRENTLY_DISPLAYED_ROI_WITHOUT_SAVE)) {
        // Set new ROI on viewer
        getOverlayEditorPanelJAI().setROI(getFrapWorkspace().getWorkingFrapStudy().getFrapData().getCurrentlyDisplayedROI());
    } else if (e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_FRAPSTUDY_NEW) || e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_FRAPSTUDY_UPDATE) || e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_FRAPSTUDY_BATCHRUN)) {
        if (e.getNewValue() instanceof FRAPStudy) {
            FRAPStudy fStudy = (FRAPStudy) e.getNewValue();
            FRAPStudy oldFrapStudy = (FRAPStudy) e.getOldValue();
            FRAPData fData = ((fStudy != null) ? (fStudy.getFrapData()) : (null));
            FRAPData oldFrapData = (oldFrapStudy != null) ? (oldFrapStudy.getFrapData()) : (null);
            if (oldFrapData != null) {
                oldFrapData.removePropertyChangeListener(this);
            }
            if (fData != null) {
                fData.addPropertyChangeListener(this);
            }
            if (e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_FRAPSTUDY_NEW) || e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_FRAPSTUDY_BATCHRUN)) {
                overlayEditorPanel.setImages((fData == null ? null : fData.getImageDataset()), true);
            } else {
                overlayEditorPanel.setImages((fData == null ? null : fData.getImageDataset()), false);
            }
            if (fData != null && fData.getROILength() > 0) {
                overlayEditorPanel.setRoiSouceData(fData);
                if (e.getPropertyName().equals(FRAPSingleWorkspace.PROPERTY_CHANGE_FRAPSTUDY_BATCHRUN)) {
                    fData.setCurrentlyDisplayedROIForBatchRun(fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()));
                } else {
                    fData.setCurrentlyDisplayedROI(fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()));
                }
            }
        }
    } else if (e.getPropertyName().equals(FRAPSingleWorkspace.FRAPDATA_VERIFY_INFO_PROPERTY)) {
        FRAPData fData = (FRAPData) e.getNewValue();
        overlayEditorPanel.setImages((fData == null ? null : fData.getImageDataset()), true);
        overlayEditorPanel.setRoiSouceData(fData);
        fData.setCurrentlyDisplayedROI(fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()));
    }
}
Also used : FRAPData(cbit.vcell.microscopy.FRAPData) ImageLoadingProgress(cbit.vcell.VirtualMicroscopy.ImageLoadingProgress) Rectangle(java.awt.Rectangle) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) ImageException(cbit.image.ImageException)

Aggregations

ImageException (cbit.image.ImageException)1 ImageLoadingProgress (cbit.vcell.VirtualMicroscopy.ImageLoadingProgress)1 FRAPData (cbit.vcell.microscopy.FRAPData)1 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)1 Rectangle (java.awt.Rectangle)1