Skip to content

Commit

Permalink
Throw error in builder when output channels and output classes mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan committed Aug 5, 2024
1 parent 15b10f3 commit f612894
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/qupath/ext/instanseg/core/InstanSeg.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ public InstanSeg build() {
if (outputClasses == null) {
var tmp = outputCells();
}
if (outputClasses.size() > 1 && numOutputChannels == 1) {
throw new IllegalArgumentException("Cannot have multiple output types when using only one output channel.");
}
return new InstanSeg(
this.tileDims,
this.downsample,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public List<PathObject> convertToObjects(Parameters<Mat, Mat> params, Mat output
if (nChannels < 1 || nChannels > 2)
throw new IllegalArgumentException("Expected 1 or 2 channels, but found " + nChannels);


List<Map<Number, ROI>> roiMaps = new ArrayList<>();
for (var mat : OpenCVTools.splitChannels(output)) {
var image = OpenCVTools.matToSimpleImage(mat, 0);
Expand Down

0 comments on commit f612894

Please sign in to comment.