diff --git a/src/main/java/ai/nets/samj/EfficientSamJ.java b/src/main/java/ai/nets/samj/EfficientSamJ.java index aace76b..3d7bcee 100644 --- a/src/main/java/ai/nets/samj/EfficientSamJ.java +++ b/src/main/java/ai/nets/samj/EfficientSamJ.java @@ -274,6 +274,9 @@ void updateImage(RandomAccessibleInterval rai) throws IOException, RuntimeExc private & NativeType> void addImage(RandomAccessibleInterval rai) throws IOException, RuntimeException, InterruptedException{ + if (rai.dimensionsAsLongArray()[0] * rai.dimensionsAsLongArray()[1] > MAX_ENCODED_IMAGE_SIZE * MAX_ENCODED_IMAGE_SIZE) { + this.targetDims = new long[] {0, 0, 0}; + } this.script = ""; sendImgLib2AsNp(rai); this.script += "" @@ -682,6 +685,11 @@ public boolean needsMoreResolution(int[] boundingBox) { return false; } + /** + * TODO what to do, is there a bounding box that is too big with respect to the encoded crop? + * @param boundingBox + * @return + */ public boolean boundingBoxTooBig(int[] boundingBox) { long xSize = boundingBox[2] - boundingBox[0]; long ySize = boundingBox[3] - boundingBox[1];