Search in sources :

Example 1 with NullCameraModel

use of uk.ac.sussex.gdsc.smlm.model.camera.NullCameraModel in project GDSC-SMLM by aherbert.

the class Noise method createCameraModel.

private void createCameraModel() {
    yAxisTitle = Y_AXIS_PHOTON;
    switch(calibration.getCameraType()) {
        case CCD:
            cameraModel = new CcdCameraModel(calibration.getBias(), calibration.getCountPerPhoton());
            break;
        case EMCCD:
            cameraModel = new EmCcdCameraModel(calibration.getBias(), calibration.getCountPerPhoton());
            break;
        case SCMOS:
            cameraModel = CameraModelManager.load(calibration.getCameraModelName());
            if (cameraModel == null) {
                throw new IllegalStateException("No camera model for camera type: " + calibration.getCameraType());
            }
            cameraModel = PeakFit.cropCameraModel(cameraModel, IJImageSource.getBounds(imp), null, false);
            // Store for next time
            final Rectangle bounds = cameraModel.getBounds();
            final int ox = bounds.x;
            final int oy = bounds.y;
            // Reset origin for filtering
            if (ox != 0 || oy != 0) {
                cameraModel = cameraModel.copy();
                cameraModel.setOrigin(0, 0);
            }
            break;
        case CAMERA_TYPE_NA:
        case UNRECOGNIZED:
        default:
            cameraModel = new NullCameraModel();
            yAxisTitle = Y_AXIS_COUNT;
            break;
    }
}
Also used : CcdCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.CcdCameraModel) EmCcdCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.EmCcdCameraModel) EmCcdCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.EmCcdCameraModel) Rectangle(java.awt.Rectangle) NullCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.NullCameraModel)

Example 2 with NullCameraModel

use of uk.ac.sussex.gdsc.smlm.model.camera.NullCameraModel in project GDSC-SMLM by aherbert.

the class FitConfiguration method getCameraModel.

/**
 * Gets the camera model.
 *
 * @return the camera model
 * @throws IllegalStateException if no camera model exists for the camera type
 */
public CameraModel getCameraModel() {
    if (cameraModel == null) {
        final int value = getCameraTypeValue();
        switch(value) {
            case CameraType.CAMERA_TYPE_NA_VALUE:
                // We can support this by doing nothing to pixels values
                cameraModel = new NullCameraModel();
                break;
            case CameraType.CCD_VALUE:
            case CameraType.EMCCD_VALUE:
                final double bias = calibration.getBias();
                final double gain = calibration.getCountPerPhoton();
                final double variance = MathUtils.pow2(calibration.getReadNoise());
                // This will throw an exception if the calibration is invalid.
                cameraModel = (value == CameraType.EMCCD_VALUE) ? new EmCcdCameraModel(bias, gain, variance) : new CcdCameraModel(bias, gain, variance);
                break;
            case CameraType.SCMOS_VALUE:
            default:
                throw new IllegalStateException("No camera model for camera type: " + getCameraType());
        }
    }
    return cameraModel;
}
Also used : CcdCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.CcdCameraModel) EmCcdCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.EmCcdCameraModel) EmCcdCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.EmCcdCameraModel) NullCameraModel(uk.ac.sussex.gdsc.smlm.model.camera.NullCameraModel)

Aggregations

CcdCameraModel (uk.ac.sussex.gdsc.smlm.model.camera.CcdCameraModel)2 EmCcdCameraModel (uk.ac.sussex.gdsc.smlm.model.camera.EmCcdCameraModel)2 NullCameraModel (uk.ac.sussex.gdsc.smlm.model.camera.NullCameraModel)2 Rectangle (java.awt.Rectangle)1