Skip to content

Commit

Permalink
keep adding javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Sep 30, 2024
1 parent 0327607 commit 1bc5b7d
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions src/main/java/io/bioimage/modelrunner/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -526,7 +525,6 @@ public void closeModel()
* @throws RunModelException
* if the is any problem running the model
*/
@SuppressWarnings("unchecked")
public <T extends RealType<T> & NativeType<T>, R extends RealType<R> & NativeType<R>>
void runModel( List< Tensor < T > > inTensors, List< Tensor < R > > outTensors ) throws RunModelException
{
Expand Down Expand Up @@ -558,8 +556,8 @@ void runModel( List< Tensor < T > > inTensors, List< Tensor < R > > outTensors )
* @return the resulting tensors
* @throws ModelSpecsException if the parameters of the rdf.yaml file are not correct
* @throws RunModelException if the model has not been previously loaded
* @throws IOException
* @throws FileNotFoundException
* @throws IOException if any of the required files is missing or corrupt
* @throws FileNotFoundException if any of the required files is missing
* @throws IllegalArgumentException if the model is not a Bioimage.io model or if lacks a Bioimage.io
* rdf.yaml specs file in the model folder.
*/
Expand All @@ -585,8 +583,8 @@ List<Tensor<T>> runBMZ(List<Tensor<R>> inputTensors) throws ModelSpecsException,
* @return the resulting tensors
* @throws ModelSpecsException if the parameters of the rdf.yaml file are not correct
* @throws RunModelException if the model has not been previously loaded
* @throws IOException
* @throws FileNotFoundException
* @throws IOException if any of the required files is missing or corrupt
* @throws FileNotFoundException if any of the required files is missing
* @throws IllegalArgumentException if the model is not a Bioimage.io model or if lacks a Bioimage.io
* rdf.yaml specs file in the model folder.
*/
Expand Down Expand Up @@ -619,8 +617,9 @@ else if (descriptor == null)
* ImgLib2 data type of the input images
* @param inputTensors
* list of the input tensors that are going to be inputed to the model
* @param tileMap
* Map containing the tiles for all the image tensors with their corresponding names each
* @param tiles
* List of {@link TileInfo} objects containing information about the image size and tile
* size of each of the input tensors to the model
* @return the resulting tensors
* @throws ModelSpecsException if the parameters of the rdf.yaml file are not correct
* @throws RunModelException if the model has not been previously loaded
Expand All @@ -645,8 +644,9 @@ List<Tensor<T>> runBMZ(List<Tensor<R>> inputTensors,
* ImgLib2 data type of the input images
* @param inputTensors
* list of the input tensors that are going to be inputed to the model
* @param tileMap
* Map containing the tiles for all the image tensors with their corresponding names each
* @param tiles
* List of {@link TileInfo} objects containing information about the image size and tile
* size of each of the input tensors to the model
* @param tileCounter
* consumer that counts the number of tiles processed out of the total, if null, nothing is counted
* @return the resulting tensors
Expand Down Expand Up @@ -705,6 +705,18 @@ List<Tensor<T>> runTiling(List<Tensor<R>> inputTensors, TileMaker tiles, TilingC
return outputTensors;
}

/**
*
* @param <T>
* nothing
* @param args
* nothing
* @throws IOException nothing
* @throws ModelSpecsException nothing
* @throws LoadEngineException nothing
* @throws RunModelException nothing
* @throws LoadModelException nothing
*/
public static <T extends NativeType<T> & RealType<T>> void main(String[] args) throws IOException, ModelSpecsException, LoadEngineException, RunModelException, LoadModelException {

String mm = "/home/carlos/git/JDLL/models/NucleiSegmentationBoundaryModel_17122023_143125";
Expand All @@ -717,7 +729,7 @@ public static <T extends NativeType<T> & RealType<T>> void main(String[] args) t
l.get(0).getAxesOrderString(), new long[] {1, 1, 512, 512}, l.get(0).getAxesOrderString());
List<TileInfo> tileList = new ArrayList<TileInfo>();
tileList.add(tile);
List<Tensor<T>> out = model.runBMZ(l, tileList);
model.runBMZ(l, tileList);
System.out.println(false);

}
Expand Down Expand Up @@ -794,9 +806,9 @@ public boolean isLoaded() {
* If the model does not contain a specs file, the methods returns null
* @return the {@link ModelDescriptor} instance that contains the specs defined in the
* Bioimage.io rdf.yaml specs file.
* @throws IOException
* @throws ModelSpecsException
* @throws FileNotFoundException
* @throws IOException if any of the required files is corrupt or missing
* @throws ModelSpecsException if the specs of rdf.yaml file are not compliant with the Bioimage.io specs
* @throws FileNotFoundException if any of the files required is not found
*/
public ModelDescriptor getBioimageioSpecs() throws FileNotFoundException, ModelSpecsException, IOException {
if (descriptor == null && new File(modelFolder + File.separator + Constants.RDF_FNAME).isFile()) {
Expand All @@ -807,8 +819,8 @@ public ModelDescriptor getBioimageioSpecs() throws FileNotFoundException, ModelS

/**
* Create consumer used to be used with {@link Model} for the methods {@link #runBMZ(List, TilingConsumer)}
* or {@link #runBioimageioModelOnImgLib2WithTiling(List, Map, TilingConsumer)}.
* The coonsumer helps to track the number if tiles that have already been processed.
* or {@link #runBMZ(List, List, TilingConsumer)}.
* The consumer helps to track the number if tiles that have already been processed.
* @return a consumer to track the tiling process
*/
public static TilingConsumer createTilingConsumer() {
Expand Down

0 comments on commit 1bc5b7d

Please sign in to comment.