-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create object to make mask creation easier
- Loading branch information
1 parent
80fb4bc
commit d34b9a5
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |