Skip to content

Commit

Permalink
do not encode big images when clicking on go
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Apr 19, 2024
1 parent 9215584 commit e5f819e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/ai/nets/samj/EfficientSamJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ void updateImage(RandomAccessibleInterval<T> rai) throws IOException, RuntimeExc
private <T extends RealType<T> & NativeType<T>>
void addImage(RandomAccessibleInterval<T> 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 += ""
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit e5f819e

Please sign in to comment.