Skip to content

Commit 03e2061

Browse files
authored
Merge pull request #336 from bls337/main
numChannels() should return the number of used channels
2 parents d4b37ca + 7ef5437 commit 03e2061

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/micromanager/lightsheetmanager/api/internal/DefaultChannelSettings.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,16 @@ public Builder copyBuilder() {
6666
}
6767

6868
/**
69-
* Returns the number of channels for the selected channel group,
69+
* Returns the number of used channels for the selected channel group,
7070
* and returns 0 if the channel group does not exist.
7171
*
7272
* @return the number of channels in the channel group
7373
*/
7474
@Override
7575
public int numChannels() {
76-
return groups_.getOrDefault(channelGroup_, EMPTY_CHANNELS).length;
76+
return Arrays.stream(groups_.getOrDefault(channelGroup_, EMPTY_CHANNELS))
77+
.filter(ChannelSpec::useChannel)
78+
.toArray(ChannelSpec[]::new).length;
7779
}
7880

7981
/**

0 commit comments

Comments
 (0)