Skip to content

Commit

Permalink
Merge pull request #270 from bls337/main
Browse files Browse the repository at this point in the history
fix settings acqMode with stage scanning
  • Loading branch information
bls337 authored Apr 19, 2024
2 parents 64982dc + 2fc35a1 commit 2780f60
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
Binary file modified lib/MMJ_.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ public Builder(final DefaultAcquisitionSettingsSCAPE acqSettings) {
@Override
public Builder acquisitionMode(final AcquisitionMode acqMode) {
acquisitionMode_ = acqMode;
if (acqMode == AcquisitionMode.STAGE_SCAN
useStageScanning_ = acqMode == AcquisitionMode.STAGE_SCAN
|| acqMode == AcquisitionMode.STAGE_SCAN_INTERLEAVED
|| acqMode == AcquisitionMode.STAGE_SCAN_UNIDIRECTIONAL) {
useStageScanning_ = true;
}
|| acqMode == AcquisitionMode.STAGE_SCAN_UNIDIRECTIONAL;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ public void close() {
// }
// }


// No more instructions (i.e. AcquisitionEvents); tell the acquisition to initiate shutdown
// once everything finishes
currentAcquisition_.finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import org.micromanager.acqj.main.AcqEngMetadata;
import org.micromanager.acqj.main.AcquisitionEvent;
import org.micromanager.acqj.util.AcquisitionEventIterator;
import org.micromanager.internal.MMStudio;
import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsSCAPE;
import org.micromanager.lightsheetmanager.model.channels.ChannelSpec;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Stream;
// import java.util.stream.Stream;

/**
* This function creates lazy sequences (i.e. iterators) of acquisition events by translating
Expand Down Expand Up @@ -160,7 +161,7 @@ public static Iterator<AcquisitionEvent> createAcqEvents(

Function<AcquisitionEvent, Iterator<AcquisitionEvent>> zStack = zStack(0,
acquisitionSettings.volumeSettings().slicesPerView());

ArrayList<Function<AcquisitionEvent, Iterator<AcquisitionEvent>>> acqFunctions = new ArrayList<>();
acqFunctions.add(cameras);
acqFunctions.add(zStack);
Expand Down Expand Up @@ -290,24 +291,59 @@ public AcquisitionEvent next() {
*/
public static Function<AcquisitionEvent, Iterator<AcquisitionEvent>> positions(
PositionList positionList) {
return (AcquisitionEvent event) -> {
Stream.Builder<AcquisitionEvent> builder = Stream.builder();
if (positionList == null) {
builder.accept(event);
} else {
for (int index = 0; index < positionList.getNumberOfPositions(); index++) {
AcquisitionEvent posEvent = event.copy();
MultiStagePosition msp = positionList.getPosition(index);
return (AcquisitionEvent event) -> new Iterator<AcquisitionEvent>() {
int index = 0;

@Override
public boolean hasNext() {
return index < positionList.getNumberOfPositions();
}

@Override
public AcquisitionEvent next() {
System.out.println("called! " + index);
AcquisitionEvent posEvent = event.copy();
MultiStagePosition msp = positionList.getPosition(index);
if (msp != null) {
posEvent.setX(msp.getX());
posEvent.setY(msp.getY());
posEvent.setAxisPosition(POSITION_AXIS, index);
builder.accept(posEvent);
}
posEvent.setAxisPosition(POSITION_AXIS, index);

index++;
return posEvent;
}
return builder.build().iterator();
};
}

// /**
// * Iterate over an arbitrary list of positions. Adds in position indices to
// * the axes that assume the order in the list provided correspond to the
// * desired indices
// *
// * @param positionList
// * @return
// */
// public static Function<AcquisitionEvent, Iterator<AcquisitionEvent>> positions(
// PositionList positionList) {
// return (AcquisitionEvent event) -> {
// Stream.Builder<AcquisitionEvent> builder = Stream.builder();
// if (positionList == null) {
// builder.accept(event);
// } else {
// for (int index = 0; index < positionList.getNumberOfPositions(); index++) {
// AcquisitionEvent posEvent = event.copy();
// MultiStagePosition msp = positionList.getPosition(index);
// posEvent.setX(msp.getX());
// posEvent.setY(msp.getY());
// posEvent.setAxisPosition(POSITION_AXIS, index);
// builder.accept(posEvent);
// }
// }
// return builder.build().iterator();
// };
// }


}

Expand Down

0 comments on commit 2780f60

Please sign in to comment.