Skip to content

Commit

Permalink
add support for big images in efficientvit
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Apr 21, 2024
1 parent 50b1a75 commit c71eebc
Show file tree
Hide file tree
Showing 2 changed files with 311 additions and 14 deletions.
7 changes: 2 additions & 5 deletions src/main/java/ai/nets/samj/EfficientSamJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@
import io.bioimage.modelrunner.apposed.appose.Service;
import io.bioimage.modelrunner.apposed.appose.Service.Task;
import io.bioimage.modelrunner.apposed.appose.Service.TaskStatus;
import io.bioimage.modelrunner.numpy.DecodeNumpy;
import io.bioimage.modelrunner.tensor.shm.SharedMemoryArray;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.converter.RealTypeConverters;
import net.imglib2.img.array.ArrayImgs;
import net.imglib2.loops.LoopBuilder;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.integer.UnsignedByteType;
Expand Down Expand Up @@ -274,7 +272,7 @@ void updateImage(RandomAccessibleInterval<T> rai) throws IOException, RuntimeExc
*/
private <T extends RealType<T> & NativeType<T>>
void addImage(RandomAccessibleInterval<T> rai)
throws IOException, RuntimeException, InterruptedException{
throws IOException, RuntimeException, InterruptedException {
if (rai.dimensionsAsLongArray()[0] * rai.dimensionsAsLongArray()[1] > MAX_ENCODED_AREA_RS * MAX_ENCODED_AREA_RS
|| rai.dimensionsAsLongArray()[0] > MAX_ENCODED_SIDE || rai.dimensionsAsLongArray()[1] > MAX_ENCODED_SIDE) {
this.targetDims = new long[] {0, 0, 0};
Expand Down Expand Up @@ -933,8 +931,7 @@ void sendCropAsNp() {
sendCropAsNp(null);
}

private <T extends RealType<T> & NativeType<T>>
void sendCropAsNp(long[] cropSize) {
private <T extends RealType<T> & NativeType<T>> void sendCropAsNp(long[] cropSize) {
if (cropSize == null)
cropSize = new long[] {encodeCoords[3] - encodeCoords[1], encodeCoords[2] - encodeCoords[0], 3};
//RandomAccessibleInterval<T> crop =
Expand Down
Loading

0 comments on commit c71eebc

Please sign in to comment.