36
36
import net .imglib2 .type .numeric .RealType ;
37
37
38
38
/**
39
- *
39
+ * Class that creates an instance able to run the corresponding Bioimage.io processing routine
40
40
* @author Carlos Jaier Garcia Lopez de Haro
41
41
*/
42
42
@@ -60,15 +60,58 @@ protected TransformationInstance(TransformSpec transform) throws RuntimeExceptio
60
60
this .build ();
61
61
}
62
62
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
+ */
63
74
public static TransformationInstance create (TransformSpec transform ) throws RuntimeException , IllegalArgumentException {
64
75
return new TransformationInstance (transform );
65
76
}
66
77
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
+ */
67
94
public <T extends RealType <T > & NativeType <T >, R extends RealType <R > & NativeType <R >>
68
95
List <Tensor <R >> run (Tensor <T > tensor ) throws RuntimeException {
69
96
return run (tensor , false );
70
97
}
71
98
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
+ */
72
115
public <T extends RealType <T > & NativeType <T >, R extends RealType <R > & NativeType <R >>
73
116
List <Tensor <R >> run (Tensor <T > tensor , boolean inplace ) throws RuntimeException {
74
117
Method m ;
@@ -157,7 +200,7 @@ private void createInstanceWithArgs() throws RuntimeException {
157
200
* @throws InvocationTargetExceptionif there is any error invoking the method
158
201
* @throws IllegalAccessException if it is illegal to access the method
159
202
*/
160
- public void setArg (String argName ) {
203
+ private void setArg (String argName ) {
161
204
Method mm = getMethodForArgument (argName );
162
205
checkArgType (mm );
163
206
try {
@@ -176,7 +219,7 @@ public void setArg(String argName) {
176
219
* @return the method name
177
220
* @throws IllegalArgumentException if no method is found for the given argument
178
221
*/
179
- public Method getMethodForArgument (String argName ) throws IllegalArgumentException {
222
+ private Method getMethodForArgument (String argName ) throws IllegalArgumentException {
180
223
String mName = "set" + snakeCaseToCamelCaseFirstCap (argName );
181
224
// Check that the method exists
182
225
Method [] methods = this .cls .getMethods ();
0 commit comments