Search in sources :

Example 36 with ROI

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

the class ROIAssistPanel method fillVoidsAction.

private void fillVoidsAction() {
    final String CELL_ROI = "CELL_ROI";
    AsynchClientTask voidTask = new AsynchClientTask("Finding voids", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            short[] filledVoidsPixels = dataToThreshold.getCurrentlyDisplayedROI().getPixelsXYZ();
            boolean bVoidsExisted = fillVoids(filledVoidsPixels, false);
            if (!bVoidsExisted) {
                DialogUtils.showInfoDialog(ROIAssistPanel.this, "No internal voids were found, no changes were made.");
                throw UserCancelException.CANCEL_GENERIC;
            }
            UShortImage ushortImage = new UShortImage(filledVoidsPixels, originalROI.getRoiImages()[0].getOrigin(), originalROI.getRoiImages()[0].getExtent(), originalROI.getISize().getX(), originalROI.getISize().getY(), originalROI.getISize().getZ());
            ROI newCellROI = new ROI(ushortImage, originalROI.getROIName());
            hashTable.put(CELL_ROI, newCellROI);
        }
    };
    AsynchClientTask updateDisplayTask = new AsynchClientTask("Updating display", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            dataToThreshold.addReplaceRoi((ROI) hashTable.get(CELL_ROI));
        }
    };
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { voidTask, updateDisplayTask }, false, false, null, true);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 37 with ROI

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

the class ROIAssistPanel method processTimepoint.

private void processTimepoint() {
    final String NEW_ROI = "NEW_ROI";
    AsynchClientTask calcROI = new AsynchClientTask("Calculating ROI", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            short[] shortPixels = new short[enhancedDataToThresholdShort.length];
            for (int i = 0; i < enhancedDataToThresholdShort.length; i++) {
                shortPixels[i] = (short) (isSet(/*originalROI.getROIName(),*/
                enhancedDataToThresholdShort[i], thresholdSlider.getValue(), thresholdSliderIntensityLookup, (maskBitSet != null ? maskBitSet.get(i) : true)) ? 0xFFFF : 0);
            }
            UShortImage ushortImage = new UShortImage(shortPixels, originalROI.getRoiImages()[0].getOrigin(), originalROI.getRoiImages()[0].getExtent(), originalROI.getISize().getX(), originalROI.getISize().getY(), originalROI.getISize().getZ());
            final ROI newCellROI = new ROI(ushortImage, originalROI.getROIName());
            hashTable.put(NEW_ROI, newCellROI);
        }
    };
    AsynchClientTask displayROI = new AsynchClientTask("displayROI", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            dataToThreshold.addReplaceRoi((ROI) hashTable.get(NEW_ROI));
        }
    };
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { calcROI, displayROI }, false, false, null, true);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) ROI(cbit.vcell.VirtualMicroscopy.ROI)

Example 38 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI 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 39 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI 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)

Example 40 with ROI

use of cbit.vcell.VirtualMicroscopy.ROI 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)

Aggregations

ROI (cbit.vcell.VirtualMicroscopy.ROI)72 UShortImage (cbit.vcell.VirtualMicroscopy.UShortImage)26 RowColumnResultSet (cbit.vcell.math.RowColumnResultSet)10 ArrayList (java.util.ArrayList)10 UserCancelException (org.vcell.util.UserCancelException)10 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)9 ImageException (cbit.image.ImageException)8 Image (cbit.vcell.VirtualMicroscopy.Image)7 FRAPData (cbit.vcell.microscopy.FRAPData)7 BioModel (cbit.vcell.biomodel.BioModel)6 FloatImage (cbit.vcell.VirtualMicroscopy.FloatImage)5 FieldFunctionArguments (cbit.vcell.field.FieldFunctionArguments)5 RegionInfo (cbit.vcell.geometry.RegionImage.RegionInfo)5 File (java.io.File)5 Hashtable (java.util.Hashtable)5 Element (org.jdom.Element)5 Extent (org.vcell.util.Extent)5 VCImage (cbit.image.VCImage)4 VCImageUncompressed (cbit.image.VCImageUncompressed)4 Expression (cbit.vcell.parser.Expression)4