Skip to content

Commit

Permalink
keep improving javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 1, 2024
1 parent cbc4fe8 commit 1c8ea08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ private ImgLib2Builder()
* @return The {@link RandomAccessibleInterval} built from the {@link TType} tensor.
* @throws IllegalArgumentException If the {@link TType} tensor type is not supported.
*/
public static <T extends Type<T>> RandomAccessibleInterval<T> build(TType tensor) throws IllegalArgumentException
@SuppressWarnings("unchecked")
public static <T extends Type<T>> RandomAccessibleInterval<T> build(TType tensor) throws IllegalArgumentException
{
if (tensor instanceof TUint8)
{
Expand Down Expand Up @@ -95,13 +96,6 @@ else if (tensor instanceof TInt64)
}
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned byte-typed {@link TUint8} tensor.
*
* @param tensor
* The {@link TUint8} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link UnsignedByteType}.
*/
private static RandomAccessibleInterval<UnsignedByteType> buildFromTensorUByte(TUint8 tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -118,13 +112,6 @@ private static RandomAccessibleInterval<UnsignedByteType> buildFromTensorUByte(T
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned int32-typed {@link TInt32} tensor.
*
* @param tensor
* The {@link TInt32} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link IntType}.
*/
private static RandomAccessibleInterval<IntType> buildFromTensorInt(TInt32 tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -141,13 +128,6 @@ private static RandomAccessibleInterval<IntType> buildFromTensorInt(TInt32 tenso
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned float32-typed {@link TFloat32} tensor.
*
* @param tensor
* The {@link TFloat32} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link FloatType}.
*/
private static RandomAccessibleInterval<FloatType> buildFromTensorFloat(TFloat32 tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -164,13 +144,6 @@ private static RandomAccessibleInterval<FloatType> buildFromTensorFloat(TFloat32
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned float64-typed {@link TFloat64} tensor.
*
* @param tensor
* The {@link TFloat64} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link DoubleType}.
*/
private static RandomAccessibleInterval<DoubleType> buildFromTensorDouble(TFloat64 tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -187,13 +160,6 @@ private static RandomAccessibleInterval<DoubleType> buildFromTensorDouble(TFloat
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned int64-typed {@link TInt64} tensor.
*
* @param tensor
* The {@link TInt64} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link LongType}.
*/
private static RandomAccessibleInterval<LongType> buildFromTensorLong(TInt64 tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private TensorBuilder() {}
* @throws IllegalArgumentException If the type of the {@link io.bioimage.modelrunner.tensor.Tensor}
* is not supported
*/
public static TType build(io.bioimage.modelrunner.tensor.Tensor tensor)
public static <T extends RealType<T> & NativeType<T>> TType build(io.bioimage.modelrunner.tensor.Tensor<T> tensor)
throws IllegalArgumentException
{
return build(tensor.getData());
Expand Down Expand Up @@ -122,17 +122,7 @@ else if (Util.getTypeFromInterval(array) instanceof LongType) {
}
}

/**
* Creates a {@link TType} tensor of type {@link TUint8} from an
* {@link RandomAccessibleInterval} of type {@link UnsignedByteType}
*
* @param tensor
* The {@link RandomAccessibleInterval} to fill the tensor with.
* @return The {@link TType} tensor filled with the {@link RandomAccessibleInterval} data.
* @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is
* not compatible
*/
public static TUint8 buildUByte(RandomAccessibleInterval<UnsignedByteType> tensor)
private static TUint8 buildUByte(RandomAccessibleInterval<UnsignedByteType> tensor)
throws IllegalArgumentException
{
long[] ogShape = tensor.dimensionsAsLongArray();
Expand All @@ -159,17 +149,7 @@ public static TUint8 buildUByte(RandomAccessibleInterval<UnsignedByteType> tenso
return ndarray;
}

/**
* Creates a {@link TInt32} tensor of type {@link TInt32} from an
* {@link RandomAccessibleInterval} of type {@link IntType}
*
* @param tensor
* The {@link RandomAccessibleInterval} to fill the tensor with.
* @return The {@link TInt32} tensor filled with the {@link RandomAccessibleInterval} data.
* @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is
* not compatible
*/
public static TInt32 buildInt(RandomAccessibleInterval<IntType> tensor)
private static TInt32 buildInt(RandomAccessibleInterval<IntType> tensor)
throws IllegalArgumentException
{
long[] ogShape = tensor.dimensionsAsLongArray();
Expand Down Expand Up @@ -197,16 +177,6 @@ public static TInt32 buildInt(RandomAccessibleInterval<IntType> tensor)
return ndarray;
}

/**
* Creates a {@link TInt64} tensor of type {@link TInt64} from an
* {@link RandomAccessibleInterval} of type {@link LongType}
*
* @param tensor
* The {@link RandomAccessibleInterval} to fill the tensor with.
* @return The {@link TInt64} tensor filled with the {@link RandomAccessibleInterval} data.
* @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is
* not compatible
*/
private static TInt64 buildLong(RandomAccessibleInterval<LongType> tensor)
throws IllegalArgumentException
{
Expand Down Expand Up @@ -235,17 +205,7 @@ private static TInt64 buildLong(RandomAccessibleInterval<LongType> tensor)
return ndarray;
}

/**
* Creates a {@link TFloat32} tensor of type {@link TFloat32} from an
* {@link RandomAccessibleInterval} of type {@link FloatType}
*
* @param tensor
* The {@link RandomAccessibleInterval} to fill the tensor with.
* @return The {@link TFloat32} tensor filled with the {@link RandomAccessibleInterval} data.
* @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is
* not compatible
*/
public static TFloat32 buildFloat(
private static TFloat32 buildFloat(
RandomAccessibleInterval<FloatType> tensor)
throws IllegalArgumentException
{
Expand Down Expand Up @@ -273,16 +233,6 @@ public static TFloat32 buildFloat(
return ndarray;
}

/**
* Creates a {@link TFloat64} tensor of type {@link TFloat64} from an
* {@link RandomAccessibleInterval} of type {@link DoubleType}
*
* @param tensor
* The {@link RandomAccessibleInterval} to fill the tensor with.
* @return The {@link TFloat64} tensor filled with the {@link RandomAccessibleInterval} data.
* @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is
* not compatible
*/
private static TFloat64 buildDouble(
RandomAccessibleInterval<DoubleType> tensor)
throws IllegalArgumentException
Expand Down

0 comments on commit 1c8ea08

Please sign in to comment.