Skip to content

Commit

Permalink
Merge pull request #267 from bls337/main
Browse files Browse the repository at this point in the history
remove commented code
  • Loading branch information
bls337 authored Apr 18, 2024
2 parents f2f69cc + dd72767 commit 296a098
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,155 +116,7 @@ public boolean prepareControllerForAcquisitionOffsetOnly(
return true;
}

// /**
// * Sets all the controller's properties according to volume settings
// * and otherwise gets controller all ready for acquisition
// * (except for final trigger).
// *
// * @param settings
// * @param channelOffset
// * @return false if there was some error that should abort acquisition
// */
// public boolean prepareControllerForAcquisition(
// final DefaultAcquisitionSettingsDISPIM settings,
// final double channelOffset) {
// // turn off beam and scan on both sides (they are turned off by SPIM state machine anyway)
// // also ensures that properties match reality at end of acquisition
// // SPIM state machine restores position of beam at end of SPIM state machine, now it
// // will be restored to blanking position
// scanner_.setBeamOn(false);
// //scanner2_.setBeamOn(false);
// scanner_.sa().setModeX(SingleAxis.Mode.DISABLED);
// //scanner2_.sa().setModeX(SingleAxis.Mode.DISABLED);
//
// final int numViews = settings.volumeSettings().numViews();
// final int firstView = settings.volumeSettings().firstView();
//
// // set up controller with appropriate SPIM parameters for each active side
// // some of these things only need to be done once if the same micro-mirror
// // card is used (as is typical) but keeping code universal to handle
// // case where MM devices reside on different controller cards
// // Note: firstView starts counting from 1...n views
// if (numViews > 1 || firstView == 1) {
// final boolean success = prepareControllerForAcquisitionSide(settings, 1, channelOffset, false);
// if (!success) {
// return false;
// }
// }
// if (numViews > 1 || firstView != 1) {
// final boolean success = prepareControllerForAcquisitionSide(settings, 2, channelOffset, false);
// if (!success) {
// return false;
// }
// }
//
// if (settings.isUsingStageScanning()
// && settings.acquisitionMode() == AcquisitionMode.STAGE_SCAN_INTERLEAVED) {
// if (numViews != 2) {
// studio_.logs().showError("Interleaved stage scan only possible for 2-sided acquisition.");
// return false;
// }
// if (settings.cameraMode() == CameraMode.OVERLAP) {
// studio_.logs().showError("Interleaved stage scan not compatible with overlap camera mode");
// return false;
// }
// }
//
// // make sure set to use TTL signal from backplane in case PLOGIC_LASER is set to PLogicMode different from diSPIM shutter
// plcCamera_.setPreset(12);
// plcLaser_.setPreset(12);
//
// // make sure shutter is set to the PLOGIC_LASER device
// try {
// core_.setShutterDevice(plcLaser_.getDeviceName());
// } catch (Exception e) {
// studio_.logs().showError("could not set shutter to " + plcLaser_.getDeviceName());
// }
//
// if (settings.isUsingStageScanning()) {
// // scanning with ASI stage
// // algorithm is as follows:
// // use the # of slices and slice spacing that the user specifies
// // because the XY stage is 45 degrees from the objectives have to move it sqrt(2) * slice step size
// // for now use the current X position as the start of acquisition and always start in positive X direction
// // for now always do serpentine scan with 2 passes at the same Y location, one pass each direction over the sample
// // => total scan distance = # slices * slice step size * sqrt(2)
// // scan start position = current X position
// // scan stop position = scan start position + total distance
// // slow axis start = current Y position
// // slow axis stop = current Y position
// // X motor speed = slice step size * sqrt(2) / slice duration
// // number of scans = number of sides (1 or 2)
// // scan mode = serpentine for 2-sided non-interleaved, raster otherwise (need to revisit for 2D stage scanning)
// // X acceleration time = use whatever current setting is
// // scan settling time = delay before side
//
// double actualMotorSpeed;
//
// // figure out the speed we should be going according to slice period, slice spacing, geometry, etc.
// final double requestedMotorSpeed = computeScanSpeed(settings, scanner_.getSPIMNumScansPerSlice()); // in mm/sec
//
// final boolean isInterleaved = (settings.acquisitionMode() == AcquisitionMode.STAGE_SCAN_INTERLEAVED);
//
// final float maxSpeed = xyStage_.getMaxSpeedX();
// if (requestedMotorSpeed > maxSpeed * 0.8) {
// // trying to go near max speed smooth scanning will be compromised
// studio_.logs().showError("Required stage speed is too fast, please reduce step size or increase sample exposure.");
// return false;
// }
// if (requestedMotorSpeed < maxSpeed / 2000) {
// // 1/2000 of the max speed is approximate place where smooth scanning breaks down (speed quantum is ~1/12000 max speed);
// // this also prevents setting to 0 which the controller rejects
// studio_.logs().showError("Required stage speed is too slow, please increase step size or decrease sample exposure.");
// return false;
// }
// xyStage_.setSpeedX(requestedMotorSpeed);
//
// // ask for the actual speed to calculate the actual step size
// actualMotorSpeed = xyStage_.getSpeedXUm() / 1000;
//
// // set the acceleration to a reasonable value for the (usually very slow) scan speed
// xyStage_.setAccelerationX(computeScanAcceleration(actualMotorSpeed,
// xyStage_.getMaxSpeedX(), settings.scanSettings().scanAccelerationFactor()));
//
// int numLines = settings.volumeSettings().numViews();
// if (isInterleaved) {
// numLines = 1; // assure in acquisition code that we can't have single-sided interleaved
// }
// numLines *= ((double) settings.numChannels() / computeScanChannelsPerPass(settings));
// xyStage_.setScanNumLines(numLines);
//
// final boolean isStageScan2Sided = (settings.acquisitionMode() == AcquisitionMode.STAGE_SCAN) && settings.volumeSettings().numViews() == 2;
// xyStage_.setScanPattern(isStageScan2Sided ? ASIXYStage.ScanPattern.SERPENTINE : ASIXYStage.ScanPattern.RASTER);
//
// if (xyStage_.getAxisPolarityX() != ASIXYStage.AxisPolarity.NORMAL) {
// studio_.logs().showError(
// "Stage scanning requires X axis polarity set to " + ASIXYStage.AxisPolarity.NORMAL);
// return false;
// }
//
// if (settings.isUsingMultiplePositions()) {
// // use current position as center position for stage scanning
// // multi-position situation is handled in position-switching code instead
// Point2D.Double p = xyStage_.getXYPosition();
// // TODO: error if getXYPosition fails (return null?)
// // TODO: prepareStageScanForAcquisition(p.x, p.y, settings.getSPIMMode())
// prepareStageScanForAcquisition(p.x, p.y, settings);
// }
// } else {
// scanDistance_ = 0;
// }
//
// // sets PLogic "acquisition running" flag
// plcCamera_.setPreset(3);
// plcLaser_.setPreset(3);
//
// studio_.logs().logMessage("Finished preparing controller for acquisition with offset " + channelOffset +
// " with mode " + settings.acquisitionMode() + " and settings:\n" + settings);
// return true;
// }

public boolean prepareControllerForAcquisitionSCAPE(
public boolean prepareControllerForAcquisition(
final DefaultAcquisitionSettingsSCAPE settings,
final double channelOffset) {
// turn off beam and scan on both sides (they are turned off by SPIM state machine anyway)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ private boolean doHardwareCalculations(PLogicSCAPE plc) {
}

double extraChannelOffset = 0.0;
plc.prepareControllerForAcquisitionSCAPE(acqSettings_, extraChannelOffset);
plc.prepareControllerForAcquisition(acqSettings_, extraChannelOffset);
return true;
}

Expand Down

0 comments on commit 296a098

Please sign in to comment.