@@ -132,6 +132,9 @@ public SamEnvManagerAbstract getInstallationManger() {
132
132
133
133
/**
134
134
* 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
+ *
135
138
* @param image
136
139
* the image of interest for segmentation or annotation
137
140
* @param useThisLoggerForIt
@@ -322,6 +325,15 @@ public boolean isLoaded() {
322
325
return samj != null ;
323
326
}
324
327
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
+ */
325
337
public String persistEncoding () throws IOException , InterruptedException {
326
338
try {
327
339
return samj .persistEncoding ();
@@ -331,15 +343,31 @@ public String persistEncoding() throws IOException, InterruptedException {
331
343
}
332
344
}
333
345
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
+ */
334
355
public void selectEncoding (String encodingName ) throws IOException , InterruptedException {
335
356
try {
336
357
samj .selectEncoding (encodingName );
337
358
} 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 ());
339
360
throw e ;
340
361
}
341
362
}
342
363
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
+ */
343
371
public void deleteEncoding (String encodingName ) throws IOException , InterruptedException {
344
372
try {
345
373
samj .deleteEncoding (encodingName );
0 commit comments