Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.micromanager.lightsheetmanager.api.data.AcquisitionMode;
import org.micromanager.lightsheetmanager.api.data.CameraMode;
import org.micromanager.lightsheetmanager.api.internal.DefaultChannelSettings;
import org.micromanager.lightsheetmanager.api.internal.DefaultScanSettings;
import org.micromanager.lightsheetmanager.api.internal.DefaultSheetCalibration;
import org.micromanager.lightsheetmanager.api.internal.DefaultSliceCalibration;
Expand Down Expand Up @@ -116,6 +117,13 @@ interface Builder<T extends AcquisitionSettings.Builder<T>> extends AcquisitionS
*/
//Builder copyBuilder();

/**
* Returns the immutable DefaultChannelSettings instance.
*
* @return immutable DefaultChannelSettings instance.
*/
DefaultChannelSettings channelSettings();

/**
* Returns the immutable DefaultTimingSettings instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ interface Builder {

ChannelSpec[] channels();

ChannelSpec[] usedChannels();
ChannelSpec[] allChannels();

}
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,14 @@ private DefaultAcquisitionSettingsSCAPE(Builder builder) {
// timePointInterval_,
// postMoveDelay_
// );
// }

// @Override
// public AcquisitionSettingsDISPIM.Builder copyBuilder() {
// return null;
// }

/**
* Returns the immutable DefaultChannelSettings instance.
*
* @return immutable DefaultChannelSettings instance.
*/
//@Override
@Override
public DefaultChannelSettings channelSettings() {
return channelSettings_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,25 @@ public String[] channelGroups() {
}

/**
* Returns the channels for the selected channel group.
* Returns the used channels for the selected channel group.
*
* @return the channels for the channel group.
* @return the channels for the channel group
*/
@Override
public ChannelSpec[] channels() {
return groups_.getOrDefault(channelGroup_, EMPTY_CHANNELS);
return Arrays.stream(groups_.getOrDefault(channelGroup_, EMPTY_CHANNELS))
.filter(ChannelSpec::useChannel)
.toArray(ChannelSpec[]::new);
}

/**
* Returns all channels for the selected channel group.
*
* @return all channels for the selected channel group
*/
@Override
public ChannelSpec[] usedChannels() {
return Arrays.stream(groups_.get(channelGroup_))
.filter(ChannelSpec::isUsed)
.toArray(ChannelSpec[]::new);
public ChannelSpec[] allChannels() {
return groups_.getOrDefault(channelGroup_, EMPTY_CHANNELS);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class ChannelTable extends JScrollPane {
public ChannelTable(final LightSheetManager model) {
model_ = Objects.requireNonNull(model);

// set the channel group first to get the correct channel array
final String channelGroup = model_.acquisitions().settings().channelSettings().channelGroup();
final ChannelSpec[] channels = model_.acquisitions().settings().channelSettings().channels();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Object getValueAt(int row, int col) {
final ChannelSpec channelSpec = data_.getChannelByIndex(row);
switch (col) {
case COLUMN_USE:
return channelSpec.isUsed();
return channelSpec.useChannel();
case COLUMN_PRESET:
return channelSpec.getName();
case COLUMN_OFFSET:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ private void createEventHandlers() {
cmbChannelGroup_.registerListener(e -> {
final String channelGroup = cmbChannelGroup_.getSelected();
table_.updatePresetComboBoxes(channelGroup);
// set the channel group to use when we get the channels
model_.acquisitions().settingsBuilder().channelSettingsBuilder().channelGroup(channelGroup);
model_.acquisitions().updateAcquisitionSettings();
// update the table data model and refresh ui
table_.getData().setChannels(channelGroup, model_.acquisitions().settings().channelSettings().channels());
table_.getData().setChannelGroup(channelGroup);
model_.acquisitions().settingsBuilder().channelSettingsBuilder().channelGroup(channelGroup);
table_.refreshData();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public ChannelSpec(final boolean useChannel, final String group, final String na
}

public ChannelSpec(final ChannelSpec channel) {
this.useChannel_ = channel.useChannel_;
this.group_ = channel.group_;
this.name_ = channel.name_;
this.offset_ = channel.offset_;
useChannel_ = channel.useChannel_;
group_ = channel.group_;
name_ = channel.name_;
offset_ = channel.offset_;
}

public String getName() {
Expand All @@ -54,7 +54,7 @@ public void setOffset(final double offset) {
offset_ = offset;
}

public boolean isUsed() {
public boolean useChannel() {
return useChannel_;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ChannelSpec[] getChannels() {

public ChannelSpec[] getUsedChannels() {
return channels_.stream()
.filter(ChannelSpec::isUsed)
.filter(ChannelSpec::useChannel)
.toArray(ChannelSpec[]::new);
}

Expand Down
Loading