Skip to content

Commit 58d9252

Browse files
committed
add Javadocs
1 parent c35f367 commit 58d9252

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

src/main/java/io/bioimage/modelrunner/model/processing/TransformationInstance.java

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import net.imglib2.type.numeric.RealType;
3737

3838
/**
39-
*
39+
* Class that creates an instance able to run the corresponding Bioimage.io processing routine
4040
* @author Carlos Jaier Garcia Lopez de Haro
4141
*/
4242

@@ -60,15 +60,58 @@ protected TransformationInstance(TransformSpec transform) throws RuntimeExceptio
6060
this.build();
6161
}
6262

63+
/**
64+
* Create a {@link TransformationInstance} from a {@link TransformSpec} created from a valid rdf.yaml Bioimage.io
65+
* spec file
66+
* @param transform
67+
* {@link TransformSpec} object from an rd.yaml file
68+
* @return the {@link TransformationInstance}
69+
* @throws RuntimeException if there is any error because the transformation defined by {@link TransformSpec} is not
70+
* valid or not yet supported
71+
* @throws IllegalArgumentException if there is any error because the transformation defined by {@link TransformSpec} is not
72+
* valid or not yet supported
73+
*/
6374
public static TransformationInstance create(TransformSpec transform) throws RuntimeException, IllegalArgumentException {
6475
return new TransformationInstance(transform);
6576
}
6677

78+
/**
79+
* Run the defined transformation on the input {@link Tensor} of interest.
80+
* This method creates a new object for the output tensor, so at the end,
81+
* there is one object for the input and another for the output.
82+
* If you want to do the transfromation in-place (modify the input tensor
83+
* instead of creating another one) use {@link #run(Tensor, boolean)}
84+
*
85+
* @param <T>
86+
* ImgLib2 data type of the input tensor
87+
* @param <R>
88+
* ImgLib2 data type of the resulting output tensor
89+
* @param tensor
90+
* the input tensor to be processed
91+
* @return the output tensor
92+
* @throws RuntimeException if there is any error running the transformation
93+
*/
6794
public <T extends RealType<T> & NativeType<T>, R extends RealType<R> & NativeType<R>>
6895
List<Tensor<R>> run(Tensor<T> tensor) throws RuntimeException {
6996
return run(tensor, false);
7097
}
7198

99+
/**
100+
* Run the defined transformation on the input {@link Tensor} of interest.
101+
*
102+
* @param <T>
103+
* ImgLib2 data type of the input tensor
104+
* @param <R>
105+
* ImgLib2 data type of the resulting output tensor
106+
* @param tensor
107+
* the input tensor to be processed
108+
* @param inplace
109+
* whether to apply the transformation to the input object and modify it or
110+
* to create a separate tensor as the output and do the modifications there.
111+
* With inplace=false, two separate tensors exist after the method is done.
112+
* @return the output tensor
113+
* @throws RuntimeException if there is any error running the transformation
114+
*/
72115
public <T extends RealType<T> & NativeType<T>, R extends RealType<R> & NativeType<R>>
73116
List<Tensor<R>> run(Tensor<T> tensor, boolean inplace) throws RuntimeException {
74117
Method m;
@@ -157,7 +200,7 @@ private void createInstanceWithArgs() throws RuntimeException {
157200
* @throws InvocationTargetExceptionif there is any error invoking the method
158201
* @throws IllegalAccessException if it is illegal to access the method
159202
*/
160-
public void setArg(String argName) {
203+
private void setArg(String argName) {
161204
Method mm = getMethodForArgument(argName);
162205
checkArgType(mm);
163206
try {
@@ -176,7 +219,7 @@ public void setArg(String argName) {
176219
* @return the method name
177220
* @throws IllegalArgumentException if no method is found for the given argument
178221
*/
179-
public Method getMethodForArgument(String argName) throws IllegalArgumentException {
222+
private Method getMethodForArgument(String argName) throws IllegalArgumentException {
180223
String mName = "set" + snakeCaseToCamelCaseFirstCap(argName);
181224
// Check that the method exists
182225
Method[] methods = this.cls.getMethods();

src/main/java/io/bioimage/modelrunner/transformations/TensorTransformation.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public interface TensorTransformation
5353
* Applies this transformation to the specified input tensor, and overwrites
5454
* it with the results. The input tensor must of type <code>float</code>.
5555
*
56+
* @param <R>
57+
* ImgLib2 data type of the input tensor
5658
* @param input
5759
* the input tensor.
5860
*/

0 commit comments

Comments
 (0)