Skip to content

Commit

Permalink
correct javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 1, 2024
1 parent dc6b0e2 commit 67df3c1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.Arrays;

import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.Img;
import net.imglib2.img.array.ArrayImgs;
import net.imglib2.type.Type;
import net.imglib2.type.numeric.integer.IntType;
Expand Down Expand Up @@ -83,12 +82,6 @@ public static < T extends Type< T > > RandomAccessibleInterval<T> build(Tensor<
}
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned byte-typed {@link Tensor}.
*
* @param tensor The tensor data is read from.
* @return The RandomAccessibleInterval built from the tensor, of type {@link UnsignedByteType}.
*/
private static RandomAccessibleInterval<UnsignedByteType> buildFromTensorUByte(Tensor<UInt8> tensor) {
long[] arrayShape = tensor.shape();
if (CommonUtils.int32Overflows(arrayShape, 1))
Expand All @@ -106,12 +99,6 @@ private static RandomAccessibleInterval<UnsignedByteType> buildFromTensorUByte(T
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned integer-typed {@link Tensor}.
*
* @param tensor The tensor data is read from.
* @return The RandomAccessibleInterval built from the tensor, of type {@link IntType}.
*/
private static RandomAccessibleInterval<IntType> buildFromTensorInt(Tensor<Integer> tensor) {
long[] arrayShape = tensor.shape();
if (CommonUtils.int32Overflows(arrayShape, 4))
Expand All @@ -129,12 +116,6 @@ private static RandomAccessibleInterval<IntType> buildFromTensorInt(Tensor<Integ
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned float-typed {@link Tensor}.
*
* @param tensor The tensor data is read from.
* @return The RandomAccessibleInterval built from the tensor, of type {@link FloatType}.
*/
private static RandomAccessibleInterval<FloatType> buildFromTensorFloat(Tensor<Float> tensor) {
long[] arrayShape = tensor.shape();
if (CommonUtils.int32Overflows(arrayShape, 4))
Expand All @@ -152,12 +133,6 @@ private static RandomAccessibleInterval<FloatType> buildFromTensorFloat(Tensor<F
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned double-typed {@link Tensor}.
*
* @param tensor The tensor data is read from.
* @return The RandomAccessibleInterval built from the tensor, of type {@link DoubleType}.
*/
private static RandomAccessibleInterval<DoubleType> buildFromTensorDouble(Tensor<Double> tensor) {
long[] arrayShape = tensor.shape();
if (CommonUtils.int32Overflows(arrayShape, 8))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@

import net.imglib2.Cursor;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.blocks.PrimitiveBlocks;
import net.imglib2.img.Img;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.integer.ByteType;
import net.imglib2.type.numeric.integer.IntType;
import net.imglib2.type.numeric.integer.UnsignedByteType;
import net.imglib2.type.numeric.real.DoubleType;
Expand Down Expand Up @@ -82,6 +80,7 @@ Tensor<?> build(io.bioimage.modelrunner.tensor.Tensor<T> tensor) {
* @return The tensor created from the sequence.
* @throws IllegalArgumentException If the {@link RandomAccessibleInterval} dtype is not supported.
*/
@SuppressWarnings("unchecked")
public static Tensor<?> build(RandomAccessibleInterval<?> rai)
{
if (Util.getTypeFromInterval(rai) instanceof UnsignedByteType) {
Expand All @@ -102,14 +101,6 @@ else if (Util.getTypeFromInterval(rai) instanceof DoubleType) {
}
}

/**
* Creates a unsigned byte-typed {@link Tensor} based on the provided
* {@link RandomAccessibleInterval} and the desired dimension order for the
* resulting tensor.
*
* @param tensor The {@link RandomAccessibleInterval} to be converted.
* @return The {@link Tensor} created from the sequence.
*/
private static Tensor<UInt8> buildUByte(
RandomAccessibleInterval<UnsignedByteType> tensor)
{
Expand Down Expand Up @@ -137,14 +128,6 @@ private static Tensor<UInt8> buildUByte(
return ndarray;
}

/**
* Creates a integer-typed {@link Tensor} based on the provided
* {@link RandomAccessibleInterval} and the desired dimension order for the
* resulting tensor.
*
* @param tensor The {@link RandomAccessibleInterval} to be converted.
* @return The {@link Tensor} created from the sequence.
*/
private static Tensor<Integer> buildInt(
RandomAccessibleInterval<IntType> tensor)
{
Expand Down Expand Up @@ -172,14 +155,6 @@ private static Tensor<Integer> buildInt(
return ndarray;
}

/**
* Creates a float-typed {@link Tensor} based on the provided
* {@link RandomAccessibleInterval} and the desired dimension order for the
* resulting tensor.
*
* @param tensor The {@link RandomAccessibleInterval} to be converted.
* @return The {@link Tensor} created from the sequence.
*/
private static Tensor<Float> buildFloat(
RandomAccessibleInterval<FloatType> tensor)
{
Expand Down Expand Up @@ -207,14 +182,6 @@ private static Tensor<Float> buildFloat(
return ndarray;
}

/**
* Creates a double-typed {@link Tensor} based on the provided
* {@link RandomAccessibleInterval} and the desired dimension order for the
* resulting tensor.
*
* @param tensor The {@link RandomAccessibleInterval} to be converted.
* @return The {@link Tensor} created from the sequence.
*/
private static Tensor<Double> buildDouble(
RandomAccessibleInterval<DoubleType> tensor)
{
Expand Down

0 comments on commit 67df3c1

Please sign in to comment.