Skip to content

Commit

Permalink
create object to make mask creation easier
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 25, 2024
1 parent 80fb4bc commit d34b9a5
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/main/java/ai/nets/samj/annotation/Mask.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*-
* #%L
* Library to call models of the family of SAM (Segment Anything Model) from Java
* %%
* Copyright (C) 2024 SAMJ developers.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ai.nets.samj.annotation;

import java.awt.Polygon;
import java.util.List;

import net.imglib2.RandomAccessibleInterval;
import net.imglib2.type.numeric.integer.UnsignedByteType;

/**
* Class that contains the information required to create the contour and mask about the object annotated in an image
* in a fast and efficient manner.
*
* @author Carlos Garcia Lopez de Haro
*/
public class Mask {

private final Polygon contour;

private final long[] rleEncoding;

private Mask(Polygon contour, long[] rleEncoding) {
this.contour = contour;
this.rleEncoding = rleEncoding;
}

public static Mask build(Polygon contour, long[] rleEncoding) {
return new Mask(contour, rleEncoding);
}

public Polygon getContour() {
return this.contour;
}

public long[] getRLEMask() {
return this.rleEncoding;
}

public static RandomAccessibleInterval<UnsignedByteType> getMask(long width, long height, List<Mask> objects) {
return null;
}
}

0 comments on commit d34b9a5

Please sign in to comment.