Skip to content

Commit 6ca918b

Browse files
committed
keep adding javadoc
1 parent 7109acd commit 6ca918b

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/main/java/ai/nets/samj/communication/model/SAMModel.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ public SamEnvManagerAbstract getInstallationManger() {
132132

133133
/**
134134
* Instantiate a SAM based model. Provide also an image that will be encoded by the model encoder
135+
* @param <T>
136+
* ImgLib2 datatype of the image
137+
*
135138
* @param image
136139
* the image of interest for segmentation or annotation
137140
* @param useThisLoggerForIt
@@ -322,6 +325,15 @@ public boolean isLoaded() {
322325
return samj != null;
323326
}
324327

328+
/**
329+
* Decide to maintain the encoded area in memory and not deleting it as it is done usually.
330+
* Usually when we want to switch between the same encoded areas many times and we want to avoid
331+
* re-encoding
332+
*
333+
* @return the name given to the encoded area
334+
* @throws IOException if it is not possible to maintain it
335+
* @throws InterruptedException if the connection with Python is lost
336+
*/
325337
public String persistEncoding() throws IOException, InterruptedException {
326338
try {
327339
return samj.persistEncoding();
@@ -331,15 +343,31 @@ public String persistEncoding() throws IOException, InterruptedException {
331343
}
332344
}
333345

346+
/**
347+
* Select the name of the encoded image or part of the image that we want to use now.
348+
* Useful for when we have encoded various parts of the image and we want to switch between them
349+
* without having to reencode
350+
* @param encodingName
351+
* the unique name given to the encoded area that we want
352+
* @throws IOException if there is no encoded area by the wanted name
353+
* @throws InterruptedException if the connection with Python is interrupted abruptly
354+
*/
334355
public void selectEncoding(String encodingName) throws IOException, InterruptedException {
335356
try {
336357
samj.selectEncoding(encodingName);
337358
} catch (IOException | InterruptedException | RuntimeException e) {
338-
log.error(getName()+", unable to persist the encoding named '" + encodingName + "': "+e.getMessage());
359+
log.error(getName()+", unable to fetch the encoding named '" + encodingName + "': "+e.getMessage());
339360
throw e;
340361
}
341362
}
342363

364+
/**
365+
* Deelte from memory the encoding selected
366+
* @param encodingName
367+
* the name of the name that we want to delete
368+
* @throws IOException if the name provided does not correspond to an encoding
369+
* @throws InterruptedException if the connection with Python is lost
370+
*/
343371
public void deleteEncoding(String encodingName) throws IOException, InterruptedException {
344372
try {
345373
samj.deleteEncoding(encodingName);

0 commit comments

Comments
 (0)