Skip to content

Commit 7c2a684

Browse files
committed
finish javadoc for the class
1 parent 0d62b24 commit 7c2a684

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/main/java/io/bioimage/modelrunner/tensor/shm/SharedMemoryFile.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,47 @@
2323
import java.io.FileNotFoundException;
2424
import java.io.IOException;
2525

26+
import io.bioimage.modelrunner.tensor.Tensor;
2627
import io.bioimage.modelrunner.numpy.DecodeNumpy;
28+
2729
import net.imglib2.RandomAccessibleInterval;
2830
import net.imglib2.type.NativeType;
2931
import net.imglib2.type.numeric.RealType;
3032

3133
/**
32-
* Class that maps {@link Tensor} objects to the shared memory for interprocessing communication
34+
* TODO get rid of this class in favour of shared memory IPC
35+
* Class that maps {@link Tensor} objects to a temporal file for inter-processing communication
3336
*
3437
* @author Carlos Garcia Lopez de Haro
3538
*/
3639
public final class SharedMemoryFile
3740
{
41+
/**
42+
* Create a .npy Numpy file from a {@link RandomAccessibleInterval}
43+
* @param <T>
44+
* the ImgLib2 data type of the {@link RandomAccessibleInterval}
45+
* @param fileDir
46+
* file path to the .npy file that is going to be created
47+
* @param rai
48+
* the {@link RandomAccessibleInterval} of interest
49+
* @throws FileNotFoundException if the parent directory where the file wants to be created does not exist
50+
* @throws IOException if there is any error creating the file
51+
*/
3852
public static <T extends RealType<T> & NativeType<T>>
3953
void buildFileFromRai(String fileDir, RandomAccessibleInterval<T> rai) throws FileNotFoundException, IOException {
4054
DecodeNumpy.writeRaiToNpyFile(fileDir, rai);
4155
}
4256

57+
/**
58+
* Read a {@link RandomAccessibleInterval} from a .npy Numpy file created to share between processes
59+
* @param <T>
60+
* the ImgLib2 data type of the {@link RandomAccessibleInterval}
61+
* @param fileName
62+
* name of the .npy file that contains a {@link RandomAccessibleInterval}
63+
* @return a {@link RandomAccessibleInterval}
64+
* @throws FileNotFoundException if the file is not found
65+
* @throws IOException if there is any error reading the file
66+
*/
4367
public static <T extends RealType<T> & NativeType<T>>
4468
RandomAccessibleInterval<T> buildRaiFromFile(String fileName) throws FileNotFoundException, IOException {
4569
return DecodeNumpy.retrieveImgLib2FromNpy(fileName);

0 commit comments

Comments
 (0)