Skip to content

Commit

Permalink
add main class, keep implementing re-do FIBSEM align
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed Aug 1, 2023
1 parent 7b257f2 commit 4a9ab99
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.janelia.render.client.newsolver.blocksolveparameters.BlockDataSolveParameters;
import org.janelia.render.client.solver.MinimalTileSpec;

import mpicbg.models.AffineModel2D;
import mpicbg.models.Model;

/**
Expand All @@ -23,7 +22,10 @@ public class BlockData< M extends Model< M > > implements Serializable

private int id;

// contains solve-specific paramters and models
// the BlockFactory that created this BlockData
final BlockFactory factory;

// contains solve-specific parameters and models
final BlockDataSolveParameters<M> solveTypeParameters;

// used for global solve outside
Expand All @@ -41,6 +43,7 @@ public BlockData(
final int id )
{
this.id = id;
this.factory = factory;
this.solveTypeParameters = solveTypeParameters;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package org.janelia.render.client.newsolver;

import java.io.IOException;
import java.io.Serializable;
import java.util.function.Function;

import org.janelia.render.client.newsolver.blockfactories.ZBlock;
import org.janelia.render.client.newsolver.blocksolveparameters.FIBSEMSolveParameters;
import org.janelia.render.client.solver.DistributedSolveParameters;
import org.janelia.render.client.solver.RunParameters;

import mpicbg.models.Affine2D;

public class DistributedSolver
{
public static void main( String[] args ) throws IOException
{
final DistributedSolveParameters parameters = new DistributedSolveParameters();

// TODO: remove testing hack ...
if (args.length == 0) {
final String[] testArgs = {
"--baseDataUrl", "http://tem-services.int.janelia.org:8080/render-ws/v1",
"--owner", "Z0720_07m_BR", //"flyem", //"cosem", //"Z1217_33m_BR",
"--project", "Sec24", //"Z0419_25_Alpha3", //"jrc_hela_2", //"Sec10",
"--matchCollection", "Sec24_v1", //"Sec32_v1", //"Z0419_25_Alpha3_v1", //"jrc_hela_2_v1", //"Sec10_multi",

"--stack", "v5_acquire_trimmed",
"--targetStack", "v5_acquire_trimmed_test",
// "--minZ", "1234",
// "--maxZ", "1234",

// "--completeTargetStack",
// "--visualizeResults",

// note: prealign is with translation only
"--blockOptimizerLambdasRigid", "1.0,1.0,0.9,0.3,0.01",
"--blockOptimizerLambdasTranslation", "1.0,0.0,0.0,0.0,0.0",
"--blockOptimizerIterations", "100,100,50,25,25",
"--blockMaxPlateauWidth", "25,25,15,10,10",
//"--blockOptimizerIterations", "1000,1000,500,250,250",
//"--blockMaxPlateauWidth", "250,250,150,100,100",

//"--blockSize", "100",
"--minStitchingInliers", "100000000",// do not stitch first
"--maxNumMatches", "0", // no limit, default
"--threadsWorker", "1",
"--threadsGlobal", "60",
"--maxPlateauWidthGlobal", "50",
"--maxIterationsGlobal", "10000",
};
parameters.parse(testArgs);
} else {
parameters.parse(args);
}

RunParameters runParameters = DistributedSolveParameters.setupSolve( parameters );

//
// setup Z BlockFactory
//
final int minZ = (int)Math.round( runParameters.minZ );
final int maxZ = (int)Math.round( runParameters.maxZ );
final int blockSize = parameters.blockSize;
final int minBlockSize = parameters.minBlockSize;

final BlockFactory blockFactory = new ZBlock( minZ, maxZ, blockSize, minBlockSize );

//
// setup FIB-SEM solve parameters
//
final boolean rigidPreAlign = false;

FIBSEMSolveParameters solveParams = new FIBSEMSolveParameters(
null, //parameters.blockModel(),
(Function< Integer, Affine2D<?> > & Serializable )(z) -> parameters.stitchingModel(),
(Function< Integer, Integer > & Serializable )(z) -> parameters.minStitchingInliers,
parameters.blockOptimizerLambdasRigid,
parameters.blockOptimizerLambdasTranslation,
parameters.blockOptimizerIterations,
parameters.blockMaxPlateauWidth,
parameters.blockMaxAllowedError,
rigidPreAlign );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import java.io.Serializable;

import mpicbg.models.Model;
import mpicbg.models.CoordinateTransform;

/**
*
* @author preibischs
*
* @param <M> - the result model type
*/
public class BlockDataSolveParameters< M extends Model<M> > implements Serializable
public class BlockDataSolveParameters< M extends CoordinateTransform > implements Serializable
{
private static final long serialVersionUID = -813404780882760053L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ public class FIBSEMSolveParameters< B extends Model< B > & Affine2D< B >, S exte
{
private static final long serialVersionUID = 4247180309556813829L;

final int minZ;
final int maxZ;

final private B blockSolveModel;
final private Function< Integer, S > stitchingModelSupplier;
final private Function< Integer, Integer > minStitchingInliersSupplier; // if it is less, it is not stitched first
Expand All @@ -41,9 +38,7 @@ public FIBSEMSolveParameters(
final List<Integer> blockOptimizerIterations,
final List<Integer> blockMaxPlateauWidth,
final double blockMaxAllowedError,
final boolean rigidPreAlign,
final int minZ,
final int maxZ )
final boolean rigidPreAlign )
{
this.blockSolveModel = blockSolveModel.copy();
this.stitchingModelSupplier = stitchingModelSupplier;
Expand All @@ -54,13 +49,8 @@ public FIBSEMSolveParameters(
this.blockMaxPlateauWidth = blockMaxPlateauWidth;
this.blockMaxAllowedError = blockMaxAllowedError;
this.rigidPreAlign = rigidPreAlign;
this.minZ = minZ;
this.maxZ = maxZ;
}

public int minZ() { return minZ; }
public int maxZ() { return maxZ; }

public B blockSolveModelInstance() { return blockSolveModel.copy(); }

public S stitchingSolveModelInstance( final int z ) { return stitchingModelSupplier.apply( z ); }
Expand Down

0 comments on commit 4a9ab99

Please sign in to comment.