Skip to content

Commit

Permalink
change Pair references to SerializableValuePair references for Spark …
Browse files Browse the repository at this point in the history
…(maybe come back later and define a proper class instead of using ambiguous pair)
  • Loading branch information
trautmane committed Sep 6, 2023
1 parent fa582a2 commit 9c98876
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.janelia.render.client.newsolver.blockfactories.BlockFactory;
import org.janelia.render.client.newsolver.blocksolveparameters.BlockDataSolveParameters;
import org.janelia.render.client.newsolver.solvers.Worker;
import org.janelia.render.client.solver.SerializableValuePair;

import net.imglib2.util.Pair;
import net.imglib2.util.ValuePair;
Expand Down Expand Up @@ -59,7 +60,7 @@ public class BlockData<M, R, P extends BlockDataSolveParameters<M, R, P>> implem

// TODO: specifically collected should go into the Parameter objects? We need to make sure each has it's own instance then
// the errors per tile
final HashMap< String, List< Pair< String, Double > > > idToBlockErrorMap = new HashMap<>();
final HashMap< String, List< SerializableValuePair< String, Double > > > idToBlockErrorMap = new HashMap<>();
// coefficient-tile intensity average for global intensity-correction
final HashMap<String, ArrayList<Double>> idToAverages = new HashMap<>();
// TODO: goes into the ZBlockFactory??
Expand Down Expand Up @@ -109,7 +110,7 @@ public WeightFunction createWeightFunctions() {

public ResolvedTileSpecCollection rtsc() { return rtsc; }
public HashMap< String, R > idToNewModel() { return idToNewModel; }
public HashMap< String, List< Pair< String, Double > > > idToBlockErrorMap() { return idToBlockErrorMap; }
public HashMap< String, List<SerializableValuePair< String, Double >> > idToBlockErrorMap() { return idToBlockErrorMap; }
public HashMap<String, ArrayList<Double>> idToAverages() { return idToAverages; }

public HashMap< Integer, HashSet< String > > zToTileId() { return zToTileId; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
import org.janelia.alignment.spec.ResolvedTileSpecCollection;
import org.janelia.alignment.spec.TileSpec;
import org.janelia.alignment.spec.TransformSpec;

import net.imglib2.util.Pair;
import org.janelia.render.client.solver.SerializableValuePair;

public class AssemblyMaps< M >
{
final public HashMap< String, M > idToFinalModelGlobal = new HashMap<>();
final public HashMap< String, TileSpec > idToTileSpecGlobal = new HashMap<>();
final public HashMap< Integer, HashSet<String> > zToTileIdGlobal = new HashMap<>();
final public HashMap< String, List< Pair< String, Double > > > idToErrorMapGlobal = new HashMap<>();
final public HashMap< String, List<SerializableValuePair< String, Double >> > idToErrorMapGlobal = new HashMap<>();
final public Set<TransformSpec> sharedTransformSpecs = new HashSet<>();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.janelia.render.client.newsolver.BlockData;
import org.janelia.render.client.newsolver.blocksolveparameters.FIBSEMIntensityCorrectionParameters;
import org.janelia.render.client.newsolver.solvers.Worker;
import org.janelia.render.client.solver.SerializableValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -234,8 +235,8 @@ private void solveForGlobalCoefficients(final HashMap<String, ArrayList<Tile<? e
t.updateCost();
return t.getDistance();
}).average().orElse(Double.MAX_VALUE);
final List<Pair<String, Double>> errorList = new ArrayList<>();
errorList.add(new ValuePair<>(tileId, error));
final List<SerializableValuePair<String, Double>> errorList = new ArrayList<>();
errorList.add(new SerializableValuePair<>(tileId, error));
blockData.idToBlockErrorMap().put(tileId, errorList);
});

Expand Down

0 comments on commit 9c98876

Please sign in to comment.