Skip to content

Commit

Permalink
add Javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Sep 30, 2024
1 parent c35f367 commit 58d9252
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import net.imglib2.type.numeric.RealType;

/**
*
* Class that creates an instance able to run the corresponding Bioimage.io processing routine
* @author Carlos Jaier Garcia Lopez de Haro
*/

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

/**
* Create a {@link TransformationInstance} from a {@link TransformSpec} created from a valid rdf.yaml Bioimage.io
* spec file
* @param transform
* {@link TransformSpec} object from an rd.yaml file
* @return the {@link TransformationInstance}
* @throws RuntimeException if there is any error because the transformation defined by {@link TransformSpec} is not
* valid or not yet supported
* @throws IllegalArgumentException if there is any error because the transformation defined by {@link TransformSpec} is not
* valid or not yet supported
*/
public static TransformationInstance create(TransformSpec transform) throws RuntimeException, IllegalArgumentException {
return new TransformationInstance(transform);
}

/**
* Run the defined transformation on the input {@link Tensor} of interest.
* This method creates a new object for the output tensor, so at the end,
* there is one object for the input and another for the output.
* If you want to do the transfromation in-place (modify the input tensor
* instead of creating another one) use {@link #run(Tensor, boolean)}
*
* @param <T>
* ImgLib2 data type of the input tensor
* @param <R>
* ImgLib2 data type of the resulting output tensor
* @param tensor
* the input tensor to be processed
* @return the output tensor
* @throws RuntimeException if there is any error running the transformation
*/
public <T extends RealType<T> & NativeType<T>, R extends RealType<R> & NativeType<R>>
List<Tensor<R>> run(Tensor<T> tensor) throws RuntimeException {
return run(tensor, false);
}

/**
* Run the defined transformation on the input {@link Tensor} of interest.
*
* @param <T>
* ImgLib2 data type of the input tensor
* @param <R>
* ImgLib2 data type of the resulting output tensor
* @param tensor
* the input tensor to be processed
* @param inplace
* whether to apply the transformation to the input object and modify it or
* to create a separate tensor as the output and do the modifications there.
* With inplace=false, two separate tensors exist after the method is done.
* @return the output tensor
* @throws RuntimeException if there is any error running the transformation
*/
public <T extends RealType<T> & NativeType<T>, R extends RealType<R> & NativeType<R>>
List<Tensor<R>> run(Tensor<T> tensor, boolean inplace) throws RuntimeException {
Method m;
Expand Down Expand Up @@ -157,7 +200,7 @@ private void createInstanceWithArgs() throws RuntimeException {
* @throws InvocationTargetExceptionif there is any error invoking the method
* @throws IllegalAccessException if it is illegal to access the method
*/
public void setArg(String argName) {
private void setArg(String argName) {
Method mm = getMethodForArgument(argName);
checkArgType(mm);
try {
Expand All @@ -176,7 +219,7 @@ public void setArg(String argName) {
* @return the method name
* @throws IllegalArgumentException if no method is found for the given argument
*/
public Method getMethodForArgument(String argName) throws IllegalArgumentException {
private Method getMethodForArgument(String argName) throws IllegalArgumentException {
String mName = "set" + snakeCaseToCamelCaseFirstCap(argName);
// Check that the method exists
Method[] methods = this.cls.getMethods();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public interface TensorTransformation
* Applies this transformation to the specified input tensor, and overwrites
* it with the results. The input tensor must of type <code>float</code>.
*
* @param <R>
* ImgLib2 data type of the input tensor
* @param input
* the input tensor.
*/
Expand Down

0 comments on commit 58d9252

Please sign in to comment.